Skip to content

Commit 986322d

Browse files
MINOR: Moving the rollback out of lock in share partition (#20153)
Moving rollback out of lock, if persister returns a completed future for write state then same data-plane-request-handler thread should not call purgatory safeTryAndComplete while holding SharePartition's write lock. Reviewers: Andrew Schofield <[email protected]>, Abhinav Dixit <[email protected]>
1 parent c058c13 commit 986322d

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

core/src/main/java/kafka/server/share/SharePartition.java

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -958,14 +958,12 @@ public CompletableFuture<Void> acknowledge(
958958
break;
959959
}
960960
}
961-
962-
// If the acknowledgement is successful then persist state, complete the state transition
963-
// and update the cached state for start offset. Else rollback the state transition.
964-
rollbackOrProcessStateUpdates(future, throwable, updatedStates, stateBatches);
965961
} finally {
966962
lock.writeLock().unlock();
967963
}
968-
964+
// If the acknowledgement is successful then persist state, complete the state transition
965+
// and update the cached state for start offset. Else rollback the state transition.
966+
rollbackOrProcessStateUpdates(future, throwable, updatedStates, stateBatches);
969967
return future;
970968
}
971969

@@ -1014,13 +1012,12 @@ && checkForStartOffsetWithinBatch(inFlightBatch.firstOffset(), inFlightBatch.las
10141012
break;
10151013
}
10161014
}
1017-
1018-
// If the release acquired records is successful then persist state, complete the state transition
1019-
// and update the cached state for start offset. Else rollback the state transition.
1020-
rollbackOrProcessStateUpdates(future, throwable, updatedStates, stateBatches);
10211015
} finally {
10221016
lock.writeLock().unlock();
10231017
}
1018+
// If the release acquired records is successful then persist state, complete the state transition
1019+
// and update the cached state for start offset. Else rollback the state transition.
1020+
rollbackOrProcessStateUpdates(future, throwable, updatedStates, stateBatches);
10241021
return future;
10251022
}
10261023

0 commit comments

Comments
 (0)