@@ -150,11 +150,6 @@ public IoTConsensusServerImpl(
150150 this .searchIndex = new AtomicLong (consensusReqReader .getCurrentSearchIndex ());
151151 this .ioTConsensusServerMetrics = new IoTConsensusServerMetrics (this );
152152 this .logDispatcher = new LogDispatcher (this , clientManager );
153- // Since the underlying wal does not persist safelyDeletedSearchIndex, IoTConsensus needs to
154- // update wal with its syncIndex recovered from the consensus layer when initializing.
155- // This prevents wal from being piled up if the safelyDeletedSearchIndex is not updated after
156- // the restart and Leader migration occurs
157- checkAndUpdateSafeDeletedSearchIndex ();
158153 // see message in logs for details
159154 checkAndUpdateSearchIndex ();
160155 }
@@ -839,8 +834,11 @@ public void cleanupLocalSnapshot() {
839834 * If there is only one replica, set it to Long.MAX_VALUE.、 If there are multiple replicas, get
840835 * the latest SafelyDeletedSearchIndex again. This enables wal to be deleted in a timely manner.
841836 */
842- public void checkAndUpdateSafeDeletedSearchIndex () {
843- if (configuration .size () == 1 ) {
837+ void checkAndUpdateSafeDeletedSearchIndex () {
838+ if (configuration .isEmpty ()) {
839+ logger .error (
840+ "Configuration is empty, which is unexpected. Safe deleted search index won't be updated this time." );
841+ } else if (configuration .size () == 1 ) {
844842 consensusReqReader .setSafelyDeletedSearchIndex (Long .MAX_VALUE );
845843 } else {
846844 consensusReqReader .setSafelyDeletedSearchIndex (getMinFlushedSyncIndex ());
0 commit comments