tkalkirill commented on code in PR #1325:
URL: https://github.com/apache/ignite-3/pull/1325#discussion_r1031370615
##########
modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/mv/AbstractPageMemoryMvPartitionStorage.java:
##########
@@ -834,23 +958,45 @@ public boolean hasNext() {
}
while (true) {
- if (!treeCursor.hasNext()) {
- iterationExhausted = true;
- return false;
+ if (!closeBusyLock.enterBusy()) {
+ throwStorageClosedException();
}
- VersionChain chain = treeCursor.next();
- ReadResult result = findLatestRowVersion(chain);
+ try {
+ if (!treeCursor.hasNext()) {
+ iterationExhausted = true;
+ return false;
+ }
- if (result.isEmpty() && !result.isWriteIntent()) {
- continue;
- }
+ VersionChain chain = treeCursor.next();
+ ReadResult result = findLatestRowVersion(chain);
- nextRead = result;
- currentChain = chain;
+ if (result.isEmpty() && !result.isWriteIntent()) {
+ continue;
+ }
- return true;
+ nextRead = result;
+ currentChain = chain;
+
+ return true;
+ } finally {
+ closeBusyLock.leaveBusy();
+ }
}
}
}
+
+ /**
+ * Throws an exception that the storage is already closed.
+ */
+ protected void throwStorageClosedException() {
+ throw new StorageClosedException("Storage is already closed");
+ }
+
+ /**
+ * Returns the partition ID.
+ */
+ public int partitionId() {
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]