Skip to content

Commit

Permalink
[improve][offload] Allow to disable the managedLedgerOffloadDeletionL…
Browse files Browse the repository at this point in the history
…agInMillis (#22689)
  • Loading branch information
zymap committed May 16, 2024
1 parent 101aee4 commit 73fd61d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2578,6 +2578,7 @@ boolean isOffloadedNeedsDelete(OffloadContext offload, Optional<OffloadPolicies>
long elapsedMs = clock.millis() - offload.getTimestamp();
return offloadPolicies.filter(policies -> offload.getComplete() && !offload.getBookkeeperDeleted()
&& policies.getManagedLedgerOffloadDeletionLagInMillis() != null
&& policies.getManagedLedgerOffloadDeletionLagInMillis() >= 0
&& elapsedMs > policies.getManagedLedgerOffloadDeletionLagInMillis()).isPresent();
}

Expand Down Expand Up @@ -4559,4 +4560,4 @@ public Position getTheSlowestNonDurationReadPosition() {
}
return theSlowestNonDurableReadPosition;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,10 @@ public void isOffloadedNeedsDeleteTest() throws Exception {
needsDelete = managedLedger.isOffloadedNeedsDelete(offloadContext, Optional.of(offloadPolicies));
Assert.assertTrue(needsDelete);

offloadPolicies.setManagedLedgerOffloadDeletionLagInMillis(-1L);
needsDelete = managedLedger.isOffloadedNeedsDelete(offloadContext, Optional.of(offloadPolicies));
Assert.assertFalse(needsDelete);

offloadPolicies.setManagedLedgerOffloadDeletionLagInMillis(1000L * 2);
needsDelete = managedLedger.isOffloadedNeedsDelete(offloadContext, Optional.of(offloadPolicies));
Assert.assertFalse(needsDelete);
Expand Down

0 comments on commit 73fd61d

Please sign in to comment.