diff --git a/common/src/main/java/org/tron/common/setting/RocksDbSettings.java b/common/src/main/java/org/tron/common/setting/RocksDbSettings.java index d5df5e261b5..8c95e0e1e24 100644 --- a/common/src/main/java/org/tron/common/setting/RocksDbSettings.java +++ b/common/src/main/java/org/tron/common/setting/RocksDbSettings.java @@ -211,13 +211,16 @@ protected void log(InfoLogLevel infoLogLevel, String logMsg) { options.setTargetFileSizeBase(settings.getTargetFileSizeBase()); // table options - final BlockBasedTableConfig tableCfg; - options.setTableFormatConfig(tableCfg = new BlockBasedTableConfig()); + // NOTE: setTableFormatConfig() materializes the native table factory at call + // time, so it MUST be the last call after all tableCfg setters; otherwise the + // setters mutate only the Java object and never reach the native layer. + BlockBasedTableConfig tableCfg = new BlockBasedTableConfig(); tableCfg.setBlockSize(settings.getBlockSize()); tableCfg.setBlockCache(RocksDbSettings.getCache()); tableCfg.setCacheIndexAndFilterBlocks(true); tableCfg.setPinL0FilterAndIndexBlocksInCache(true); tableCfg.setFilter(new BloomFilter(10, false)); + options.setTableFormatConfig(tableCfg); if (Constant.MARKET_PAIR_PRICE_TO_ORDER.equals(dbName)) { ComparatorOptions comparatorOptions = new ComparatorOptions(); options.setComparator(new MarketOrderPriceComparatorForRocksDB(comparatorOptions));