tkalkirill commented on code in PR #1325:
URL: https://github.com/apache/ignite-3/pull/1325#discussion_r1030637335
##########
modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/index/sorted/PageMemorySortedIndexStorage.java:
##########
@@ -120,22 +188,63 @@ public void remove(IndexRow row) {
remove.afterCompletion();
} catch (IgniteInternalCheckedException e) {
throw new StorageException("Failed to remove value from index", e);
+ } finally {
+ closeBusyLock.leaveBusy();
}
}
@Override
public Cursor<IndexRow> scan(@Nullable BinaryTuplePrefix lowerBound,
@Nullable BinaryTuplePrefix upperBound, int flags) {
- boolean includeLower = (flags & GREATER_OR_EQUAL) != 0;
- boolean includeUpper = (flags & LESS_OR_EQUAL) != 0;
-
- SortedIndexRowKey lower = createBound(lowerBound, !includeLower);
-
- SortedIndexRowKey upper = createBound(upperBound, includeUpper);
+ if (!closeBusyLock.enterBusy()) {
+ throwStorageClosedException();
+ }
try {
- return map(sortedIndexTree.find(lower, upper),
this::toIndexRowImpl);
+ boolean includeLower = (flags & GREATER_OR_EQUAL) != 0;
+ boolean includeUpper = (flags & LESS_OR_EQUAL) != 0;
+
+ SortedIndexRowKey lower = createBound(lowerBound, !includeLower);
+
+ SortedIndexRowKey upper = createBound(upperBound, includeUpper);
+
+ Cursor<SortedIndexRow> cursor = sortedIndexTree.find(lower, upper);
+
+ return new Cursor<>() {
+ @Override
+ public void close() {
+ cursor.close();
+ }
+
+ @Override
+ public boolean hasNext() {
Review Comment:
Sounds reasonable, tried to 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]