You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by mo...@apache.org on 2022/07/13 01:56:03 UTC

[doris] 01/02: [Fix](distrubution) fix random tablet (#10756)

This is an automated email from the ASF dual-hosted git repository.

morningman pushed a commit to branch dev-1.1.1
in repository https://gitbox.apache.org/repos/asf/doris.git

commit 0cc242c67c931f288f48c64fd0a69ff4eecacf5e
Author: lihangyu <15...@163.com>
AuthorDate: Mon Jul 11 23:12:56 2022 +0800

    [Fix](distrubution) fix random tablet (#10756)
    
    _compute_tablet_index catched up a local variable
---
 be/src/exec/tablet_info.cpp | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/be/src/exec/tablet_info.cpp b/be/src/exec/tablet_info.cpp
index 2a4c43a4c7..13b9ff077f 100644
--- a/be/src/exec/tablet_info.cpp
+++ b/be/src/exec/tablet_info.cpp
@@ -208,9 +208,8 @@ Status OlapTablePartitionParam::init() {
         }
     }
     if (_distributed_slot_descs.empty()) {
-        Random random(UnixMillis());
-        _compute_tablet_index = [&random](Tuple* key, int64_t num_buckets) -> uint32_t {
-            return random.Uniform(num_buckets);
+        _compute_tablet_index = [](Tuple* key, int64_t num_buckets) -> uint32_t {
+            return butil::fast_rand() % num_buckets;
         };
     } else {
         _compute_tablet_index = [this](Tuple* key, int64_t num_buckets) -> uint32_t {
@@ -457,9 +456,8 @@ Status VOlapTablePartitionParam::init() {
         }
     }
     if (_distributed_slot_locs.empty()) {
-        Random random(UnixMillis());
-        _compute_tablet_index = [&random](BlockRow* key, int64_t num_buckets) -> uint32_t {
-            return random.Uniform(num_buckets);
+        _compute_tablet_index = [](BlockRow* key, int64_t num_buckets) -> uint32_t {
+            return butil::fast_rand() % num_buckets;
         };
     } else {
         _compute_tablet_index = [this](BlockRow* key, int64_t num_buckets) -> uint32_t {


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