-
Notifications
You must be signed in to change notification settings - Fork 228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Partition Assignment V2. #1917
base: develop
Are you sure you want to change the base?
Conversation
82f0f45
to
8fb4fa3
Compare
Create a trait class PartitionAssignmentTrait to support both V1 and V2 assignemnt. Query service has to re-compile but does not have to change anything. For single partition assignment queries, the behavior does not change. For multiple partition assignment queries without partition assignment change, use MultiPartitionDistConcatExec to assemble all time series. For multiple partition assignment queries with partition assignment, stitch the time series before and after changes.
@@ -22,15 +22,34 @@ import filodb.query.LogicalPlan._ | |||
import filodb.query.exec._ | |||
|
|||
//scalastyle:off file.size.limit | |||
case class PartitionDetails(partitionName: String, httpEndPoint: String, | |||
grpcEndPoint: Option[String], proportion: Float) | |||
trait PartitionAssignmentTrait { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: maybe we can add a Scala doc for the trait to just outline the use of proportionMap, timerange and some examples ?
=> (pa.partitionName, params.startSecs * 1000L, | ||
params.endSecs * 1000L, pa.grpcEndPoint) | ||
case Some(pa: PartitionAssignmentTrait) | ||
=> (pa.proportionMap.keys.head, params.startSecs * 1000L, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: should we add a simple helper function in PartitionAssignmentTrait
to get the keys and values of proportionMap ?
@@ -388,24 +407,46 @@ class MultiPartitionPlanner(val partitionLocationProvider: PartitionLocationProv | |||
PlanResult(execPlan:: Nil) | |||
} | |||
|
|||
private def materializeForPartition(logicalPlan: LogicalPlan, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: please add a Scala doc
val proportionMap: Map[String, PartitionDetails] = | ||
Map(partitionName -> PartitionDetails(partitionName, httpEndPoint, grpcEndPoint, 1.0f)) | ||
} | ||
case class PartitionAssignmentV2(proportionMap: Map[String, PartitionDetails], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we add an assertion in PartitionAssignmentV2
such that all the proportion
in proportionMap
will sum up to 1.0f ?
|
||
execPlan.isInstanceOf[StitchRvsExec] shouldEqual (true) | ||
// Should have two MultiPartitionDistConcatExec for before and after assignment change. | ||
execPlan.children.count(plan => plan.isInstanceOf[MultiPartitionDistConcatExec]) shouldEqual 2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for adding good unit tests @yu-shipit 👍
Create a trait class PartitionAssignmentTrait to support both V1 and V2 assignemnt. Query service has to re-compile but does not have to change anything. For single partition assignment queries, the behavior does not change. For multiple partition assignment queries without partition assignment change, use MultiPartitionDistConcatExec to assemble all time series. For multiple partition namespace queries with partition assignment, stitch the time series before and after changes.
Pull Request checklist
Current behavior : (link exiting issues here : https://help.github.com/articles/basic-writing-and-formatting-syntax/#referencing-issues-and-pull-requests)
New behavior :
Filodb can support queries for multi-partitioned assignment.
Add two APIs for supporting that.
getPartitions
andgetMetadataPartitionsTrait
are deprecated but still can be used for backwards compatibility.BREAKING CHANGES
Breaking changes may include:
Other information: