Andrew Wong has posted comments on this change. ( http://gerrit.cloudera.org:8080/16586 )
Change subject: KUDU-2612: add TxnManager::BeginTransaction() ...................................................................... Patch Set 2: Code-Review+1 (6 comments) Overall LGTM. Just some nits left. http://gerrit.cloudera.org:8080/#/c/16586/1/src/kudu/master/txn_manager-test.cc File src/kudu/master/txn_manager-test.cc: http://gerrit.cloudera.org:8080/#/c/16586/1/src/kudu/master/txn_manager-test.cc@426 PS1, Line 426: > I'm not sure emplace() would fit here: that's a range insert. At least, I Yep, you're right. emplace() doesn't take in iterators like this. http://gerrit.cloudera.org:8080/#/c/16586/2/src/kudu/master/txn_manager-test.cc File src/kudu/master/txn_manager-test.cc: http://gerrit.cloudera.org:8080/#/c/16586/2/src/kudu/master/txn_manager-test.cc@405 PS2, Line 405: static constexpr int64_t kNumTransactions = 10000; nit: Would it also make sense to check that we have added several new tablets for the transaction status table, to more explicitly test the AddNewRangePartition logic? http://gerrit.cloudera.org:8080/#/c/16586/2/src/kudu/master/txn_manager-test.cc@407 PS2, Line 407: txn_initiator(kNumTransactions, &txn_ids); nit: not that we expect concurrency issues here, but maybe also dedupe these before comparing? http://gerrit.cloudera.org:8080/#/c/16586/1/src/kudu/master/txn_manager.cc File src/kudu/master/txn_manager.cc: http://gerrit.cloudera.org:8080/#/c/16586/1/src/kudu/master/txn_manager.cc@119 PS1, Line 119: // with the highest 'highest_seen_txn_id' so far updating 'next_txn_id_' : // until it succeeds or bail if there is another thread that received a : // greater 'highest_seen_txn_id' back from TxnStatusManager. : int64_t stored_txn_id = try_txn_id + 1; : while (true) { : > Ah, I guess there was a swap of the 'try_txn_id' and 'highest_seen_txn_id', Yep, this is a lot clearer now. http://gerrit.cloudera.org:8080/#/c/16586/2/src/kudu/master/txn_manager.cc File src/kudu/master/txn_manager.cc: http://gerrit.cloudera.org:8080/#/c/16586/2/src/kudu/master/txn_manager.cc@123 PS2, Line 123: while (true) { nit: should we DCHECK that highest_seen_txn_id >= 0 here too? http://gerrit.cloudera.org:8080/#/c/16586/2/src/kudu/master/txn_manager.cc@124 PS2, Line 124: next_txn_id_.compare_exchange_strong(stored_txn_id, : highest_seen_txn_id + 1) || : stored_txn_id > highest_seen_txn_id) { Maybe reverse the order so we don't have to compare the atomic if stored_txn_id > highest_seen_txn_id? -- To view, visit http://gerrit.cloudera.org:8080/16586 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: kudu Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I51c476d92bb5b147ffd03fd9f3163ab86d581496 Gerrit-Change-Number: 16586 Gerrit-PatchSet: 2 Gerrit-Owner: Alexey Serbin <[email protected]> Gerrit-Reviewer: Alexey Serbin <[email protected]> Gerrit-Reviewer: Andrew Wong <[email protected]> Gerrit-Reviewer: Hao Hao <[email protected]> Gerrit-Reviewer: Kudu Jenkins (120) Gerrit-Comment-Date: Tue, 13 Oct 2020 23:02:37 +0000 Gerrit-HasComments: Yes
