morningman commented on code in PR #19167:
URL: https://github.com/apache/doris/pull/19167#discussion_r1180078624
##########
fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java:
##########
@@ -2538,6 +2541,13 @@ private void createTablets(String clusterName,
MaterializedIndex index, ReplicaS
if (chooseBackendsArbitrary) {
backendsPerBucketSeq = Maps.newHashMap();
}
+
+ Map<Tag, Integer> nextIndexs = new HashMap<>();
+ for (Map.Entry<Tag, Short> entry :
replicaAlloc.getAllocMap().entrySet()) {
+ // TODO: random roundrobin starting position
+ nextIndexs.put(entry.getKey(), 0);
Review Comment:
If always starts with 0, it will causing the first node always has more
tablets than others.
If intro random start position, than it will be the same as previous
implementation
##########
fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java:
##########
@@ -2538,6 +2541,13 @@ private void createTablets(String clusterName,
MaterializedIndex index, ReplicaS
if (chooseBackendsArbitrary) {
backendsPerBucketSeq = Maps.newHashMap();
}
+
+ Map<Tag, Integer> nextIndexs = new HashMap<>();
+ for (Map.Entry<Tag, Short> entry :
replicaAlloc.getAllocMap().entrySet()) {
+ // TODO: random roundrobin starting position
+ nextIndexs.put(entry.getKey(), 0);
Review Comment:
At very early time, Doris use RR to distribute tablets.
There was a field `nextBEIdx` in `SystemInfoService`, to save the start
position.
But it is hard to maintain that value, because we have to consider `tag`,
`storage_medium`, `cluster`, etc. So you have to maintain the `idx` for each
combination.
So we changed the distribution method to totally random.
##########
fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java:
##########
@@ -2538,6 +2541,13 @@ private void createTablets(String clusterName,
MaterializedIndex index, ReplicaS
if (chooseBackendsArbitrary) {
backendsPerBucketSeq = Maps.newHashMap();
}
+
+ Map<Tag, Integer> nextIndexs = new HashMap<>();
+ for (Map.Entry<Tag, Short> entry :
replicaAlloc.getAllocMap().entrySet()) {
+ // TODO: random roundrobin starting position
+ nextIndexs.put(entry.getKey(), 0);
Review Comment:
I think of an implementation, for reference:
1. Select all candidate BE list according to the conditions (`tag`,
`storage_medium`, etc.).
2. In the list, select the BE with the least number of tablets as the
starting node to start executing RoundRobin.
This method should be logically clearer, which is to separate the step of
"filtering BE by condition" from the "execution of RR".
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]