Skip to content

Commit

Permalink
fix(metering): Overriding the cluster name .passed to SingleClusterPl…
Browse files Browse the repository at this point in the history
…anner for TenantIngestionMetering changes
  • Loading branch information
sandeep6189 authored Aug 23, 2023
1 parent 89095e2 commit 1e56ef9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 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

0 comments on commit 1e56ef9

Please sign in to comment.