szetszwo commented on code in PR #4319:
URL: https://github.com/apache/ozone/pull/4319#discussion_r1119538226
##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/SCMHADBTransactionBufferImpl.java:
##########
@@ -56,13 +58,23 @@ private BatchOperation getCurrentBatchOperation() {
@Override
public <KEY, VALUE> void addToBuffer(
Table<KEY, VALUE> table, KEY key, VALUE value) throws IOException {
- table.putWithBatch(getCurrentBatchOperation(), key, value);
+ rwLock.readLock().lock();
Review Comment:
Are you sure we can use a read lock? Unless `currentBatchOperation` is
thread safe, we need a write lock here.
If we change this and `removeFromBuffer` to write lock, then everything uses
the write lock. We may change them to simply `synchronized`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]