Alexey Serbin has posted comments on this change. ( 
http://gerrit.cloudera.org:8080/16586 )

Change subject: KUDU-2612: add TxnManager::BeginTransaction()
......................................................................


Patch Set 1:

(6 comments)

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@371
PS1, Line 371: proxy_
> Should be 'p'?
Indeed.  Thanks!


http://gerrit.cloudera.org:8080/#/c/16586/1/src/kudu/master/txn_manager-test.cc@374
PS1, Line 374:
> nit: spacing?
Done


http://gerrit.cloudera.org:8080/#/c/16586/1/src/kudu/master/txn_manager-test.cc@399
PS1, Line 399:   txn_initiator(kNumTransactions, nullptr);
> Would it make sense to also check that we have kNumTransactions transaction
Done


http://gerrit.cloudera.org:8080/#/c/16586/1/src/kudu/master/txn_manager-test.cc@426
PS1, Line 426: insert
> nit: emplace?
I'm not sure emplace() would fit here: that's a range insert.  At least, I 
don't see range std::unordered_set::emplace in the C++ stdlib API: 
https://en.cppreference.com/w/cpp/container/unordered_set


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:       while (true) {
             :         if (next_txn_id_.compare_exchange_strong(stored_txn_id, 
try_txn_id + 1) ||
             :             stored_txn_id > try_txn_id) {
             :           break;
             :         }
             :       }
> I don't fully understand this. Wouldn't try_txn_id + 1 = next_txn_id_ in th
Ah, I guess there was a swap of the 'try_txn_id' and 'highest_seen_txn_id', 
indeed.  Most likely I messed it up while doing second iteration or so.  Good 
catch!

The idea is to make the thread that has gotten a transaction reserved 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.

With this approach, max(next_txn_id_, stored_txn_id_) isn't needed since it's 
done automatically.

Is it clearer now with try_txn_id <--> highest_seen_txn_id swap and the comment 
added?


http://gerrit.cloudera.org:8080/#/c/16586/1/src/kudu/master/txn_manager.cc@134
PS1, Line 134:     if (s.IsNotFound()) {
> Maybe not as a part of this patch, but I'm curious whether you think it's w
Yep, good point.  I think we can track whether a request to add some particular 
range has already been sent.  I guess that would require tracking the range 
since we cannot assume that's a single range all over the place because the 
rate of incoming BeginTransaction request might be high.  So, I'd rather put it 
into a separate patch to 1) add targeted tests as well 2) make reviewing easier.



--
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: 1
Gerrit-Owner: Alexey Serbin <aser...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <aser...@cloudera.com>
Gerrit-Reviewer: Andrew Wong <aw...@cloudera.com>
Gerrit-Reviewer: Hao Hao <hao....@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Comment-Date: Tue, 13 Oct 2020 01:21:55 +0000
Gerrit-HasComments: Yes

Reply via email to