You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by aw...@apache.org on 2020/11/21 01:31:08 UTC

[kudu] 02/02: tablet: use proper locking when starting transaction

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

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

commit 88d4edfc66d728a643ed2e40959156686b06a8df
Author: Andrew Wong <aw...@cloudera.com>
AuthorDate: Fri Nov 20 16:23:34 2020 -0800

    tablet: use proper locking when starting transaction
    
    This is a follow-up to fd7a40367a81555230eac62a1a8d1467433ed100.
    
    Before this, TxnParticipantTest.TestConcurrentTransactions failed 2/20
    times in ASAN mode. With this patch, it passed 200/200 times.
    
    Change-Id: I85d39f0ec4322a9e3c834bc952c97a5112f764eb
    Reviewed-on: http://gerrit.cloudera.org:8080/16759
    Reviewed-by: Alexey Serbin <as...@cloudera.com>
    Tested-by: Kudu Jenkins
---
 src/kudu/tablet/tablet.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/kudu/tablet/tablet.cc b/src/kudu/tablet/tablet.cc
index f3193bc..3ee5d89 100644
--- a/src/kudu/tablet/tablet.cc
+++ b/src/kudu/tablet/tablet.cc
@@ -991,7 +991,7 @@ void Tablet::CreateTxnRowSets(int64_t txn_id, scoped_refptr<TxnMetadata> txn_met
                              &new_mrs));
   scoped_refptr<TxnRowSets> rowsets(new TxnRowSets(std::move(new_mrs)));
   {
-    shared_lock<rw_spinlock> l(component_lock_);
+    std::lock_guard<rw_spinlock> l(component_lock_);
     // TODO(awong): can we ever get here?
     if (ContainsKey(uncommitted_rowsets_by_txn_id_, txn_id)) {
       return;