ibessonov commented on code in PR #1976:
URL: https://github.com/apache/ignite-3/pull/1976#discussion_r1180308170
##########
modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/mv/PersistentPageMemoryMvPartitionStorage.java:
##########
@@ -136,19 +137,31 @@ public void afterCheckpointEnd(CheckpointProgress
progress) {
@Override
public <V> V runConsistently(WriteClosure<V> closure) throws
StorageException {
- return busy(() -> {
- throwExceptionIfStorageNotInRunnableOrRebalanceState(state.get(),
this::createStorageInfo);
+ LocalLocker locker = THREAD_LOCAL_LOCKER.get();
- checkpointTimeoutLock.checkpointReadLock();
+ if (locker != null) {
+ return closure.execute(locker);
+ } else {
+ return busy(() -> {
+
throwExceptionIfStorageNotInRunnableOrRebalanceState(state.get(),
this::createStorageInfo);
- try {
- return closure.execute();
- } finally {
- updateVersionChainLockByRowId.releaseAllLockByCurrentThread();
+ LocalLocker locker0 = new LocalLocker(lockByRowId);
- checkpointTimeoutLock.checkpointReadUnlock();
- }
- });
+ checkpointTimeoutLock.checkpointReadLock();
+
+ THREAD_LOCAL_LOCKER.set(locker0);
+
+ try {
+ return closure.execute(locker0);
+ } finally {
+ THREAD_LOCAL_LOCKER.set(null);
+
+ locker0.unlockAll();
Review Comment:
`unlockAll` can't fail. The only possible exception is
`IllegalMonitorStateException`, which we hope will never happen. So the order
is deliberate.
--
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]