You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by gr...@apache.org on 2020/12/03 22:06:27 UTC

[kudu] 01/03: [TxnStatusManagerTest] fix replica restart in GetTransactionStatus

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

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

commit 71941276d2dadd94397eabea30e357176e819d88
Author: Alexey Serbin <al...@apache.org>
AuthorDate: Thu Dec 3 11:49:49 2020 -0800

    [TxnStatusManagerTest] fix replica restart in GetTransactionStatus
    
    Before this patch, there was an issue with accessing already deleted
    txn_manager_ member in the TxnStatusManagerTest.TxnStatusManagerTest
    scenario and ASAN rightfully reported on that:
    
      src/kudu/transactions/txn_status_manager.cc:161:53: runtime error: \
        member call on address 0x6150000e7480 which does not point to an \
        object of type 'kudu::tablet::TabletReplica'
      0x6150000e7480: note: object has invalid vptr
    
    Change-Id: I62f86cfc686a121a1689e6f3942aa4050406ffe2
    Reviewed-on: http://gerrit.cloudera.org:8080/16818
    Reviewed-by: Andrew Wong <aw...@cloudera.com>
    Tested-by: Alexey Serbin <as...@cloudera.com>
---
 src/kudu/transactions/txn_status_manager-test.cc | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/kudu/transactions/txn_status_manager-test.cc b/src/kudu/transactions/txn_status_manager-test.cc
index 99c7160..eb81571 100644
--- a/src/kudu/transactions/txn_status_manager-test.cc
+++ b/src/kudu/transactions/txn_status_manager-test.cc
@@ -471,7 +471,13 @@ TEST_F(TxnStatusManagerTest, GetTransactionStatus) {
   ASSERT_OK(txn_manager_->BeginTransaction(4, kOwner, nullptr, &ts_error));
 
   // Make the TxnStatusManager start from scratch.
-  ASSERT_OK(RestartReplica());
+  {
+    ASSERT_OK(RestartReplica());
+    decltype(txn_manager_) txn_manager_reloaded(
+        new TxnStatusManager(tablet_replica_.get()));
+    ASSERT_OK(txn_manager_reloaded->LoadFromTablet());
+    txn_manager_ = std::move(txn_manager_reloaded);
+  }
 
   // Committed, aborted, and in-flight transactions should be known to the
   // TxnStatusManager even after restarting the underlying replica and