You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2020/08/24 12:19:52 UTC

[GitHub] [incubator-doris] weizuo93 commented on a change in pull request #4373: [Optimize]Optimize the disk selection strategy on BE for tablet creation

weizuo93 commented on a change in pull request #4373:
URL: https://github.com/apache/incubator-doris/pull/4373#discussion_r475558052



##########
File path: be/src/olap/storage_engine.cpp
##########
@@ -428,6 +428,18 @@ std::vector<DataDir*> StorageEngine::get_stores_for_create_tablet(
     std::random_device rd;
     srand(rd());
     std::random_shuffle(stores.begin(), stores.end());
+    // Two random choices
+    for (int i = 0; i < stores.size(); i++) {
+        int j = i + 1;
+        if (j < stores.size()) {
+            if (stores[i]->tablet_set().size() > stores[j]->tablet_set().size()) {
+                std::swap(stores[i], stores[j]);
+            }
+            std::random_shuffle(stores.begin() + j, stores.end());

Review comment:
       @chaoyli 
   The purpose of the this random_shuffle is that:
          If it failed to create tablet on the first disk selected using "two random choices", it is necessary to select another disk from the remaining disks to create the tablet by using "two random choices" again. This random_shuffle is the beginning of the next "two random choices".




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org