Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ public void release(Blocker blocker) {
} catch (TException e) {
throw new IllegalStateException(
"failed to release " + tableIdentifier + "'s blocker " + blocker.blockerId(), e);
} finally {
// Regardless of whether the lock was successfully released, we will no longer renew the lock.
if (blocker instanceof RenewableBlocker) {
((RenewableBlocker) blocker).cancelRenew();
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.apache.amoro.AmsClient;
import org.apache.amoro.api.BlockableOperation;
import org.apache.amoro.api.NoSuchObjectException;
import org.apache.amoro.shade.guava32.com.google.common.annotations.VisibleForTesting;
import org.apache.amoro.shade.guava32.com.google.common.base.Preconditions;
import org.apache.amoro.shade.guava32.com.google.common.util.concurrent.ThreadFactoryBuilder;
import org.apache.amoro.table.TableIdentifier;
Expand Down Expand Up @@ -103,6 +104,11 @@ public void renewAsync() {
.scheduleAtFixedRate(this::doRenew, interval, interval, TimeUnit.MILLISECONDS);
}

@VisibleForTesting
public ScheduledFuture getRenewTaskFuture() {
return this.renewTaskFuture;
}

private void doRenew() {
try {
this.expirationTime =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ public void testBlockAndRelease() throws OperationConflictException {
BasicTableBlockerManager blockerManager = (BasicTableBlockerManager) tableBlockerManager;

Blocker block = blockerManager.block(OPERATIONS);
Assert.assertTrue(block instanceof RenewableBlocker);

blockerManager.release(block);
Assert.assertTrue(((RenewableBlocker) block).getRenewTaskFuture() == null);
}
}