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

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


The following commit(s) were added to refs/heads/branch-2.0 by this push:
     new 9226229bc86 [fix](load) fix merged row number miscounting because of 
race condition (#26516)
9226229bc86 is described below

commit 9226229bc863c3e227ae32a256e69568916c0714
Author: zhengyu <[email protected]>
AuthorDate: Tue Nov 7 23:14:20 2023 +0800

    [fix](load) fix merged row number miscounting because of race condition 
(#26516)
    
    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 ebdd76ec471..7d81d6344a2 100644
--- a/be/src/olap/delta_writer.h
+++ b/be/src/olap/delta_writer.h
@@ -201,7 +201,7 @@ private:
     int64_t _cur_max_version;
 
     // total rows num written by DeltaWriter
-    int64_t _total_received_rows = 0;
+    std::atomic<int64_t> _total_received_rows = 0;
 
     std::shared_ptr<PartialUpdateInfo> _partial_update_info;
 
diff --git a/be/src/olap/memtable.h b/be/src/olap/memtable.h
index 9e3103364a5..7d74b8ce43f 100644
--- a/be/src/olap/memtable.h
+++ b/be/src/olap/memtable.h
@@ -160,16 +160,16 @@ 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 delete_bitmap_ns = 0;
     int64_t segment_writer_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