Elia-Renzoni commented on code in PR #1612:
URL: https://github.com/apache/ratis/pull/1612#discussion_r4195273742
##########
ratis-server/src/main/java/org/apache/ratis/server/raftlog/RaftLogBase.java:
##########
@@ -153,7 +165,8 @@ protected void updateSnapshotIndexFromStateMachine() {
@Override
public void updateSnapshotIndex(long newSnapshotIndex) {
- try(AutoCloseableLock writeLock = writeLock()) {
+ try(AutoCloseableLock commitLock = writeLock(LockType.COMMIT_INDEX);
+ AutoCloseableLock snapshotLock = writeLock(LockType.SNAPSHOT_INDEX)) {
Review Comment:
Yes, you're right. I've pushed commit
fac0204dd16060a4d2520fd4f5d1e9dbfb24819a with the fix. However, I've changed
the original scope of the PR quite a bit I had previously added two separate
locks, but since snapshotIndexLock was effectively unused, I've gone back to a
single lock as before and used updateToMax to update the index atomically. What
do you think of the latest changes?
--
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]