Alexey Serbin has posted comments on this change. ( http://gerrit.cloudera.org:8080/17159 )
Change subject: KUDU-2612: acquire and release partition lock ...................................................................... Patch Set 9: Code-Review+2 (9 comments) Overall looks good! Just a few nits. http://gerrit.cloudera.org:8080/#/c/17159/9/src/kudu/integration-tests/txn_write_ops-itest.cc File src/kudu/integration-tests/txn_write_ops-itest.cc: http://gerrit.cloudera.org:8080/#/c/17159/9/src/kudu/integration-tests/txn_write_ops-itest.cc@352 PS9, Line 352: error.IsTimedOut() nit: could you add a comment explaining why both IsAborted() and IsTimedOut() are possible result codes here? http://gerrit.cloudera.org:8080/#/c/17159/9/src/kudu/tablet/ops/write_op.h File src/kudu/tablet/ops/write_op.h: http://gerrit.cloudera.org:8080/#/c/17159/9/src/kudu/tablet/ops/write_op.h@179 PS9, Line 179: locks nit: lock? http://gerrit.cloudera.org:8080/#/c/17159/9/src/kudu/tablet/ops/write_op.cc File src/kudu/tablet/ops/write_op.cc: http://gerrit.cloudera.org:8080/#/c/17159/9/src/kudu/tablet/ops/write_op.cc@217 PS9, Line 217: rows nit: row http://gerrit.cloudera.org:8080/#/c/17159/9/src/kudu/tablet/ops/write_op.cc@574 PS9, Line 574: completion_callback()->set_error(s, code); : return s; nit: does it make sense to add CHECK(!s.ok()) before setting the error code and returning? http://gerrit.cloudera.org:8080/#/c/17159/5/src/kudu/tablet/tablet.h File src/kudu/tablet/tablet.h: http://gerrit.cloudera.org:8080/#/c/17159/5/src/kudu/tablet/tablet.h@172 PS5, Line 172: // Acquire a shared lock on the given transaction, to ensure the : // transaction's state doesn't change while the given write is in flight. : Status AcquireTxnLock(int64_t txn_id, WriteOpState* op_state); > IIRC from my discussion with Hao, doing this in the BEGIN_TXN lets us catch Thank you very much for going an extra mile! I think it's crucial to shrink the lock time to have better throughput for concurrent operations. http://gerrit.cloudera.org:8080/#/c/17159/9/src/kudu/tablet/txn_participant-test.cc File src/kudu/tablet/txn_participant-test.cc: http://gerrit.cloudera.org:8080/#/c/17159/9/src/kudu/tablet/txn_participant-test.cc@525 PS9, Line 525: Status s = Write(0); : ASSERT_TRUE(s.IsAborted()) << s.ToString(); : ASSERT_STR_CONTAINS(s.ToString(), "partition lock that is held by another"); : : s = Write(0, kTxnTwo); : ASSERT_TRUE(s.IsAborted()) << s.ToString(); : ASSERT_STR_CONTAINS(s.ToString(), "partition lock that is held by another"); nit: is it possible to turn this into a functor and reuse it in the code of this scenario? http://gerrit.cloudera.org:8080/#/c/17159/9/src/kudu/tablet/txn_participant.h File src/kudu/tablet/txn_participant.h: http://gerrit.cloudera.org:8080/#/c/17159/9/src/kudu/tablet/txn_participant.h@115 PS9, Line 115: It is thus expected that repeat callers are taking : // the same lock nit: is it possible to check for this invariant in the implementation of this method? http://gerrit.cloudera.org:8080/#/c/17159/9/src/kudu/tablet/txn_participant.h@117 PS9, Line 117: AcquirePartitionLock nit: would AdoptPartitionLock() be a better name for this method? http://gerrit.cloudera.org:8080/#/c/17159/9/src/kudu/tablet/txn_participant.cc File src/kudu/tablet/txn_participant.cc: http://gerrit.cloudera.org:8080/#/c/17159/9/src/kudu/tablet/txn_participant.cc@78 PS9, Line 78: TabletServerErrorPB::Code code = tserver::TabletServerErrorPB::UNKNOWN_ERROR; nit: maybe, move this under the 'if ()' clause below? -- To view, visit http://gerrit.cloudera.org:8080/17159 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: kudu Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: If26733cae16810f3b3afd1fd05dcb984e6366939 Gerrit-Change-Number: 17159 Gerrit-PatchSet: 9 Gerrit-Owner: Hao Hao <hao....@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-Reviewer: Tidy Bot (241) Gerrit-Comment-Date: Tue, 13 Apr 2021 05:59:24 +0000 Gerrit-HasComments: Yes