thetumbled commented on code in PR #21085:
URL: https://github.com/apache/pulsar/pull/21085#discussion_r1309554504
##########
pulsar-common/src/main/java/org/apache/pulsar/policies/data/loadbalancer/BundleData.java:
##########
@@ -103,4 +97,13 @@ public int getTopics() {
public void setTopics(int topics) {
this.topics = topics;
}
+
+ @Override
+ public int compareTo(BundleData o) {
+ int result = this.longTermData.compareTo(o.longTermData);
+ if (result == 0) {
+ result = this.shortTermData.compareTo(o.shortTermData);
+ }
Review Comment:
May be we should prefer to update short-term data than long-term data?
There are other approach to sort out the BundleData. We can add a field
`lastestSample` to save the lastest `NamespaceBundleStats` in `BundleData` when
we call
https://github.com/apache/pulsar/blob/d099ac4fa2f217b9c5f0a5e660c83048e829c5d7/pulsar-common/src/main/java/org/apache/pulsar/policies/data/loadbalancer/BundleData.java#L77-L81
Then we can sort the BundleData based on `lastestSample` as
ExtensibleLoadManager does.
As `NamespaceBundleStats` is unchangeable, we can avoid the concurrent
problem too.
WDYT, @hangc0276 @codelipenghui
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]