tkalkirill commented on code in PR #7109:
URL: https://github.com/apache/ignite-3/pull/7109#discussion_r2571402696
##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/gc/GcUpdateHandler.java:
##########
@@ -130,46 +133,32 @@ private VacuumResult internalVacuumBatch(HybridTimestamp
lowWatermark, IntHolder
});
}
- private VacuumResult internalVacuum(HybridTimestamp lowWatermark, Locker
locker, boolean useTryLock) {
- while (true) {
- // Check if the storage engine needs resources before continuing.
- if (locker.shouldRelease()) {
- return VacuumResult.SHOULD_RELEASE;
- }
-
- GcEntry gcEntry = storage.peek(lowWatermark);
-
- if (gcEntry == null) {
- return VacuumResult.NO_GARBAGE_LEFT;
- }
-
- RowId rowId = gcEntry.getRowId();
+ private VacuumResult internalVacuum(GcEntry gcEntry, Locker locker,
boolean useTryLock) {
+ RowId rowId = gcEntry.getRowId();
- if (useTryLock) {
- if (!locker.tryLock(rowId)) {
- return VacuumResult.FAILED_ACQUIRE_LOCK;
- }
- } else {
- locker.lock(rowId);
+ if (useTryLock) {
+ if (!locker.tryLock(rowId)) {
+ return VacuumResult.FAILED_ACQUIRE_LOCK;
}
+ } else {
+ locker.lock(rowId);
+ }
- BinaryRow binaryRow = storage.vacuum(gcEntry);
-
- if (binaryRow == null) {
- // Removed by another thread, let's try to take another.
- continue;
- }
+ BinaryRow binaryRow = storage.vacuum(gcEntry);
- try (Cursor<ReadResult> cursor = storage.scanVersions(rowId)) {
- // TODO: IGNITE-21005 We need to choose only those indexes
that are not available for transactions
- indexUpdateHandler.tryRemoveFromIndexes(binaryRow, rowId,
cursor, null);
- }
+ if (binaryRow == null) {
+ return VacuumResult.REMOVED_BY_ANOTHER_THREAD;
Review Comment:
I added it only to support the previous behavior, without making any major
changes.
We can try to remove it in a separate ticket.
--
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]