You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by ka...@apache.org on 2020/04/18 10:38:56 UTC

[incubator-doris] branch master updated: Fix rowset_meta race condition for commit_txn in TxnManager (#3330)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 67b0da5  Fix rowset_meta race condition for commit_txn in TxnManager (#3330)
67b0da5 is described below

commit 67b0da5652adea3c00fb03f1ea4b931713a1062b
Author: caiconghui <55...@users.noreply.github.com>
AuthorDate: Sat Apr 18 05:38:48 2020 -0500

    Fix rowset_meta race condition for commit_txn in TxnManager (#3330)
---
 be/src/common/config.h      | 2 +-
 be/src/olap/txn_manager.cpp | 1 +
 be/src/olap/txn_manager.h   | 8 ++++----
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/be/src/common/config.h b/be/src/common/config.h
index 9b06918..dbd9f53 100644
--- a/be/src/common/config.h
+++ b/be/src/common/config.h
@@ -506,7 +506,7 @@ namespace config {
     CONF_Int32(txn_map_shard_size, "128");
 
     // txn_lock shard size, the value is 2^n, n=0,1,2,3,4
-    // this is a an enhancement for better performance to publish txn
+    // this is a an enhancement for better performance to commit and publish txn
     CONF_Int32(txn_shard_size, "1024")
 
 } // namespace config
diff --git a/be/src/olap/txn_manager.cpp b/be/src/olap/txn_manager.cpp
index 8fdec4d..35b3633 100755
--- a/be/src/olap/txn_manager.cpp
+++ b/be/src/olap/txn_manager.cpp
@@ -185,6 +185,7 @@ OLAPStatus TxnManager::commit_txn(
         return OLAP_ERR_ROWSET_INVALID;
     }
 
+    MutexLock txn_lock(&_get_txn_lock(transaction_id));
     {
         // get tx
         ReadLock rdlock(&_get_txn_map_lock(transaction_id));
diff --git a/be/src/olap/txn_manager.h b/be/src/olap/txn_manager.h
index 75ad152..d16e453 100755
--- a/be/src/olap/txn_manager.h
+++ b/be/src/olap/txn_manager.h
@@ -183,16 +183,16 @@ private:
     const int32_t _txn_shard_size;
 
     // _txn_map_locks[i] protect _txn_tablet_maps[i], i=0,1,2...,and i < _txn_map_shard_size
-    txn_tablet_map_t *_txn_tablet_maps;
+    txn_tablet_map_t* _txn_tablet_maps;
     // transaction_id -> corresponding partition ids
     // This is mainly for the clear txn task received from FE, which may only has transaction id,
     // so we need this map to find out which partitions are corresponding to a transaction id.
     // The _txn_partition_maps[i] should be constructed/deconstructed/modified alongside with '_txn_tablet_maps[i]'
-    txn_partition_map_t *_txn_partition_maps;
+    txn_partition_map_t* _txn_partition_maps;
 
-    RWMutex *_txn_map_locks;
+    RWMutex* _txn_map_locks;
 
-    Mutex *_txn_mutex;
+    Mutex* _txn_mutex;
     DISALLOW_COPY_AND_ASSIGN(TxnManager);
 };  // TxnManager
 


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