rpuch commented on code in PR #1976:
URL: https://github.com/apache/ignite-3/pull/1976#discussion_r1180341660
##########
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:
This is the exception I kept in mind :) Sometimes there are bugs in code, so
'the impossible' happens. In this case, 'the impossible' will leave a lock
locked forever, which may cause other errors/hangs that can make it really
difficult to see what's going on while debugging
--
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]