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

dataroaring pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new bf8793de70c [fix](load) fix merged row number miscounting because of 
race condition (#26470)
bf8793de70c is described below

commit bf8793de70c1e15ec6b9975edc5e64d1b3e5d7e2
Author: zhengyu <[email protected]>
AuthorDate: Mon Nov 6 22:50:32 2023 +0800

    [fix](load) fix merged row number miscounting because of race condition 
(#26470)
    
    row numbers miscounting because of race condition, will cause load to
    fail sometimes with warning 'the rows number written doesn't match'.
    
    Signed-off-by: freemandealer <[email protected]>
---
 be/src/olap/delta_writer.h | 2 +-
 be/src/olap/memtable.h     | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/be/src/olap/delta_writer.h b/be/src/olap/delta_writer.h
index 303f17f14f8..fd41473292e 100644
--- a/be/src/olap/delta_writer.h
+++ b/be/src/olap/delta_writer.h
@@ -133,7 +133,7 @@ private:
     std::shared_mutex _slave_node_lock;
 
     // total rows num written by DeltaWriter
-    int64_t _total_received_rows = 0;
+    std::atomic<int64_t> _total_received_rows = 0;
 
     RuntimeProfile* _profile = nullptr;
     RuntimeProfile::Counter* _close_wait_timer = nullptr;
diff --git a/be/src/olap/memtable.h b/be/src/olap/memtable.h
index b98e7411e3b..cade509aac5 100644
--- a/be/src/olap/memtable.h
+++ b/be/src/olap/memtable.h
@@ -155,14 +155,14 @@ public:
         return *this;
     }
 
-    int64_t raw_rows = 0;
-    int64_t merged_rows = 0;
+    std::atomic<int64_t> raw_rows = 0;
+    std::atomic<int64_t> merged_rows = 0;
     int64_t sort_ns = 0;
     int64_t agg_ns = 0;
     int64_t put_into_output_ns = 0;
     int64_t duration_ns = 0;
-    int64_t sort_times = 0;
-    int64_t agg_times = 0;
+    std::atomic<int64_t> sort_times = 0;
+    std::atomic<int64_t> agg_times = 0;
 };
 
 class MemTable {


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to