tkalkirill commented on code in PR #1506: URL: https://github.com/apache/ignite-3/pull/1506#discussion_r1072276069
########## modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/mv/AbstractPageMemoryMvPartitionStorage.java: ########## @@ -800,67 +732,65 @@ public PartitionTimestampCursor scan(HybridTimestamp timestamp) throws StorageEx } else { return new TimestampCursor(treeCursor, timestamp); } - } finally { - closeBusyLock.leaveBusy(); - } + }); } @Override public @Nullable RowId closestRowId(RowId lowerBound) throws StorageException { - if (!closeBusyLock.enterBusy()) { - throwStorageClosedException(); - } + return busy(() -> { + throwExceptionIfStorageInProgressOfRebalance(state.get(), this::createStorageInfo); - try (Cursor<VersionChain> cursor = versionChainTree.find(new VersionChainKey(lowerBound), null)) { - return cursor.hasNext() ? cursor.next().rowId() : null; - } catch (Exception e) { - throw new StorageException("Error occurred while trying to read a row id", e); - } finally { - closeBusyLock.leaveBusy(); - } + try (Cursor<VersionChain> cursor = versionChainTree.find(new VersionChainKey(lowerBound), null)) { + return cursor.hasNext() ? cursor.next().rowId() : null; + } catch (Exception e) { + throw new StorageException("Error occurred while trying to read a row id", e); + } + }); } @Override public long rowsCount() { - if (!closeBusyLock.enterBusy()) { - throwStorageClosedException(); - } + return busy(() -> { + throwExceptionIfStorageInProgressOfRebalance(state.get(), this::createStorageInfo); - try { - return versionChainTree.size(); - } catch (IgniteInternalCheckedException e) { - throw new StorageException("Error occurred while fetching the size.", e); - } finally { - closeBusyLock.leaveBusy(); - } + try { + return versionChainTree.size(); + } catch (IgniteInternalCheckedException e) { + throw new StorageException("Error occurred while fetching the size", e); + } + }); } private abstract class BasePartitionTimestampCursor implements PartitionTimestampCursor { - protected final Cursor<VersionChain> treeCursor; + final Cursor<VersionChain> treeCursor; Review Comment: Fix it. -- 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: notifications-unsubscr...@ignite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org