Skip to content

Commit

Permalink
fix(metering): Overriding the cluster name passed to SingleClusterPla…
Browse files Browse the repository at this point in the history
…nner for TenantIngestionMetering changes (#1660)

* fix(metering): Overriding the cluster name .passed to SingleClusterPlanner for TenantIngestionMetering changes

* Updating main
  • Loading branch information
sandeep6189 authored Aug 24, 2023
1 parent a01a9f1 commit 6a4ed51
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ case class TenantIngestionMetering(settings: FilodbSettings,
dsIterProducer().foreach { dsRef =>
val fut = Client.asyncAsk(
coordActorProducer(),
LogicalPlan2Query(dsRef, TsCardinalities(prefix, numGroupByFields)),
LogicalPlan2Query(dsRef, TsCardinalities(prefix, numGroupByFields, 2, overrideClusterName = CLUSTER_TYPE)),
ASK_TIMEOUT)
fut.onComplete {
case Success(QueryResult(_, _, rv, _, _, _, _)) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -830,9 +830,15 @@ class SingleClusterPlanner(val dataset: Dataset,
private def materializeTsCardinalities(qContext: QueryContext,
lp: TsCardinalities,
forceInProcess: Boolean): PlanResult = {
// If no clusterName is passed in the logical plan, we use the passed clusterName in the SingleClusterPlanner
// We are using the passed cluster name in logical plan for tenant metering apis
val clusterNameToPass = lp.overrideClusterName match {
case "" => clusterName
case _ => lp.overrideClusterName
}
val metaExec = shardMapperFunc.assignedShards.map{ shard =>
val dispatcher = dispatcherForShard(shard, forceInProcess, qContext)
exec.TsCardExec(qContext, dispatcher, dsRef, shard, lp.shardKeyPrefix, lp.numGroupByFields, clusterName,
exec.TsCardExec(qContext, dispatcher, dsRef, shard, lp.shardKeyPrefix, lp.numGroupByFields, clusterNameToPass,
lp.version)
}
PlanResult(metaExec)
Expand Down
3 changes: 2 additions & 1 deletion query/src/main/scala/filodb/query/LogicalPlan.scala
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,8 @@ case class TsCardinalities(shardKeyPrefix: Seq[String],
numGroupByFields: Int,
version: Int = 1,
datasets: Seq[String] = Seq(),
userDatasets: String = "") extends LogicalPlan {
userDatasets: String = "",
overrideClusterName: String = "") extends LogicalPlan {
import TsCardinalities._

require(numGroupByFields >= 1 && numGroupByFields <= 3,
Expand Down
2 changes: 1 addition & 1 deletion version.sbt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
version in ThisBuild := "0.9.22.2"
version in ThisBuild := "0.9.22.3"

0 comments on commit 6a4ed51

Please sign in to comment.