ibessonov commented on code in PR #7095:
URL: https://github.com/apache/ignite-3/pull/7095#discussion_r2577202831
##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/StorageUpdateHandler.java:
##########
@@ -242,10 +242,18 @@ private Entry<UUID, TimedBinaryRow>
processEntriesUntilBatchLimit(
@Nullable List<Integer> indexIds
) {
return storage.runConsistently(locker -> {
+ if (locker.shouldRelease()) {
+ return lastUnprocessedEntry;
+ }
Review Comment:
This is probably excessive, we have only acquired the lock, it's fine to do
a small piece of work before we start checking.
##########
modules/table/src/test/java/org/apache/ignite/internal/table/distributed/StorageUpdateHandlerTest.java:
##########
@@ -222,4 +226,44 @@ void testUpdateAllBatchedTryLockFailed() {
assertEquals(row3, result3.binaryRow());
}
+ /**
+ * Tests that {@link StorageUpdateHandler#handleUpdateAll} respects {@code
shouldRelease()} from the storage engine.
+ *
+ * <p>This test verifies that the implementation checks {@code
shouldRelease()} during batch processing
+ * to allow the storage engine to perform critical operations like
checkpoints.
Review Comment:
It is not obvious for me "how" it does it, I only see "shouldRelease" in the
comments, not in the implementation. What exactly does this test validate?
##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/StorageUpdateHandler.java:
##########
@@ -242,10 +242,18 @@ private Entry<UUID, TimedBinaryRow>
processEntriesUntilBatchLimit(
@Nullable List<Integer> indexIds
) {
return storage.runConsistently(locker -> {
+ if (locker.shouldRelease()) {
+ return lastUnprocessedEntry;
+ }
+
List<RowId> processedRowIds = new ArrayList<>();
int batchLength = 0;
Entry<UUID, TimedBinaryRow> entryToProcess = lastUnprocessedEntry;
while (entryToProcess != null) {
+ if (!processedRowIds.isEmpty() && locker.shouldRelease()) {
+ break;
+ }
+
Review Comment:
By the way, what if we combine this condition with the condition below? I
think this could make the code a little bit easier to follow
--
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]