@@ -89,6 +89,7 @@ public class TxCacheDB implements DB<byte[], byte[]>, Flusher {
8989 private final Path cacheProperties ;
9090 private final Path cacheDir ;
9191 private AtomicBoolean isValid = new AtomicBoolean (false );
92+ private boolean txCacheInitOptimization ;
9293
9394 @ Getter
9495 @ Setter
@@ -128,6 +129,8 @@ public TxCacheDB(String name, RecentTransactionStore recentTransactionStore,
128129 this .cacheFile0 = Paths .get (cacheDir .toString (), "bloomFilters_0" );
129130 this .cacheFile1 = Paths .get (cacheDir .toString (), "bloomFilters_1" );
130131 this .cacheProperties = Paths .get (cacheDir .toString (), "txCache.properties" );
132+ this .txCacheInitOptimization = CommonParameter .getInstance ()
133+ .getStorage ().isTxCacheInitOptimization ();
131134
132135 }
133136
@@ -280,6 +283,12 @@ public void reset() {
280283 }
281284
282285 private boolean recovery () {
286+ if (!txCacheInitOptimization ) {
287+ logger .info ("txCache init optimization is disabled, skip fast recovery mode." );
288+ logger .info ("If you want fast recovery mode,"
289+ + " please set `storage.txCache.initOptimization = true` in config.conf." );
290+ return false ;
291+ }
283292 FileUtil .createDirIfNotExists (this .cacheDir .toString ());
284293 logger .info ("recovery bloomFilters start." );
285294 CompletableFuture <Boolean > loadProperties = CompletableFuture .supplyAsync (this ::loadProperties );
0 commit comments