From 22fdca588d4d4314e407514d7de58b72ff217a29 Mon Sep 17 00:00:00 2001 From: fanjianye Date: Sun, 28 Apr 2024 11:06:31 +0800 Subject: [PATCH] different bookie trigger gcOverreplicatedLedger randomly --- .../bookkeeper/bookie/ScanAndCompareGarbageCollector.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/ScanAndCompareGarbageCollector.java b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/ScanAndCompareGarbageCollector.java index be73dab3066..99af039276c 100644 --- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/ScanAndCompareGarbageCollector.java +++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/ScanAndCompareGarbageCollector.java @@ -94,9 +94,10 @@ public ScanAndCompareGarbageCollector(LedgerManager ledgerManager, CompactableLe this.selfBookieAddress = BookieImpl.getBookieId(conf); this.gcOverReplicatedLedgerIntervalMillis = conf.getGcOverreplicatedLedgerWaitTimeMillis(); - this.lastOverReplicatedLedgerGcTimeMillis = System.currentTimeMillis(); if (gcOverReplicatedLedgerIntervalMillis > 0) { this.enableGcOverReplicatedLedger = true; + this.lastOverReplicatedLedgerGcTimeMillis = System.currentTimeMillis() + + (long) (gcOverReplicatedLedgerIntervalMillis * Math.random()); } this.maxConcurrentRequests = conf.getGcOverreplicatedLedgerMaxConcurrentRequests(); LOG.info("Over Replicated Ledger Deletion : enabled={}, interval={}, maxConcurrentRequests={}",