@@ -625,6 +625,11 @@ public static void setParam(final String[] args, final String confFileName) {
625625 .filter (StringUtils ::isNotEmpty )
626626 .orElse (Storage .getDbEngineFromConfig (config )));
627627
628+ if (INSTANCE .storage .getDbEngine ().toUpperCase ().equals ("ROCKSDB" )
629+ && INSTANCE .storage .getDbVersion () == 1 ) {
630+ throw new RuntimeException ("db.version = 1 is not supported by ROCKSDB engine." );
631+ }
632+
628633 INSTANCE .storage .setDbSync (Optional .ofNullable (INSTANCE .storageDbSynchronous )
629634 .filter (StringUtils ::isNotEmpty )
630635 .map (Boolean ::valueOf )
@@ -848,8 +853,10 @@ public static void setParam(final String[] args, final String confFileName) {
848853 config .getString ("trx.reference.block" ) : "head" ;
849854
850855 INSTANCE .trxExpirationTimeInMilliseconds =
851- config .hasPath ("trx.expiration.timeInMilliseconds" ) && config .getLong ("trx.expiration.timeInMilliseconds" ) > 0 ?
852- config .getLong ("trx.expiration.timeInMilliseconds" ) : Constant .TRANSACTION_DEFAULT_EXPIRATION_TIME ;
856+ config .hasPath ("trx.expiration.timeInMilliseconds" )
857+ && config .getLong ("trx.expiration.timeInMilliseconds" ) > 0 ?
858+ config .getLong ("trx.expiration.timeInMilliseconds" )
859+ : Constant .TRANSACTION_DEFAULT_EXPIRATION_TIME ;
853860
854861 INSTANCE .minEffectiveConnection = config .hasPath ("node.rpc.minEffectiveConnection" ) ?
855862 config .getInt ("node.rpc.minEffectiveConnection" ) : 1 ;
@@ -872,8 +879,10 @@ public static void setParam(final String[] args, final String confFileName) {
872879 config .hasPath ("event.subscribe.filter" ) ? getEventFilter (config ) : null ;
873880
874881 initBackupProperty (config );
875- initRocksDbBackupProperty (config );
876- initRocksDbSettings (config );
882+ if (Args .getInstance ().getStorage ().getDbEngine ().toUpperCase ().equals ("ROCKSDB" )) {
883+ initRocksDbBackupProperty (config );
884+ initRocksDbSettings (config );
885+ }
877886
878887 logConfig ();
879888 }
@@ -1156,43 +1165,35 @@ private static double calcMaxTimeRatio() {
11561165
11571166 private static void initRocksDbSettings (Config config ) {
11581167 String prefix = "storage.dbSettings." ;
1159-
1160- if (Args .getInstance ().getStorage ().getDbEngine ().equals ("ROCKSDB" )) {
1161- int levelNumber = config .hasPath (prefix + "levelNumber" )
1162- ? config .getInt (prefix + "levelNumber" ) : 7 ;
1163- int compactThreads = config .hasPath (prefix + "compactThreads" )
1164- ? config .getInt (prefix + "compactThreads" )
1165- : max (Runtime .getRuntime ().availableProcessors (), 1 );
1166- int blocksize = config .hasPath (prefix + "blocksize" )
1167- ? config .getInt (prefix + "blocksize" ) : 16 ;
1168- long maxBytesForLevelBase = config .hasPath (prefix + "maxBytesForLevelBase" )
1169- ? config .getInt (prefix + "maxBytesForLevelBase" ) : 256 ;
1170- double maxBytesForLevelMultiplier = config .hasPath (prefix + "maxBytesForLevelMultiplier" )
1171- ? config .getDouble (prefix + "maxBytesForLevelMultiplier" ) : 10 ;
1172- String compressionStr = config .hasPath (prefix + "compressionTypeListStr" )
1173- ? config .getString (prefix + "compressionTypeListStr" ) : "no:no:lz4:lz4:lz4:zstd:zstd" ;
1174- int level0FileNumCompactionTrigger =
1175- config .hasPath (prefix + "level0FileNumCompactionTrigger" ) ? config
1176- .getInt (prefix + "level0FileNumCompactionTrigger" ) : 2 ;
1177- long targetFileSizeBase = config .hasPath (prefix + "targetFileSizeBase" ) ? config
1178- .getLong (prefix + "targetFileSizeBase" ) : 64 ;
1179- int targetFileSizeMultiplier = config .hasPath (prefix + "targetFileSizeMultiplier" ) ? config
1180- .getInt (prefix + "targetFileSizeMultiplier" ) : 1 ;
1181-
1182- INSTANCE .rocksDBCustomSettings = DBSettings
1183- .initCustomSettings (levelNumber , compactThreads , blocksize , maxBytesForLevelBase ,
1184- maxBytesForLevelMultiplier , compressionStr , level0FileNumCompactionTrigger ,
1185- targetFileSizeBase , targetFileSizeMultiplier );
1186- DBSettings .loggingSettings ();
1187- }
1168+ int levelNumber = config .hasPath (prefix + "levelNumber" )
1169+ ? config .getInt (prefix + "levelNumber" ) : 7 ;
1170+ int compactThreads = config .hasPath (prefix + "compactThreads" )
1171+ ? config .getInt (prefix + "compactThreads" )
1172+ : max (Runtime .getRuntime ().availableProcessors (), 1 );
1173+ int blocksize = config .hasPath (prefix + "blocksize" )
1174+ ? config .getInt (prefix + "blocksize" ) : 16 ;
1175+ long maxBytesForLevelBase = config .hasPath (prefix + "maxBytesForLevelBase" )
1176+ ? config .getInt (prefix + "maxBytesForLevelBase" ) : 256 ;
1177+ double maxBytesForLevelMultiplier = config .hasPath (prefix + "maxBytesForLevelMultiplier" )
1178+ ? config .getDouble (prefix + "maxBytesForLevelMultiplier" ) : 10 ;
1179+ int level0FileNumCompactionTrigger =
1180+ config .hasPath (prefix + "level0FileNumCompactionTrigger" ) ? config
1181+ .getInt (prefix + "level0FileNumCompactionTrigger" ) : 2 ;
1182+ long targetFileSizeBase = config .hasPath (prefix + "targetFileSizeBase" ) ? config
1183+ .getLong (prefix + "targetFileSizeBase" ) : 64 ;
1184+ int targetFileSizeMultiplier = config .hasPath (prefix + "targetFileSizeMultiplier" ) ? config
1185+ .getInt (prefix + "targetFileSizeMultiplier" ) : 1 ;
1186+
1187+ INSTANCE .rocksDBCustomSettings = DBSettings
1188+ .initCustomSettings (levelNumber , compactThreads , blocksize , maxBytesForLevelBase ,
1189+ maxBytesForLevelMultiplier , level0FileNumCompactionTrigger ,
1190+ targetFileSizeBase , targetFileSizeMultiplier );
1191+ DBSettings .loggingSettings ();
11881192 }
11891193
11901194 private static void initRocksDbBackupProperty (Config config ) {
1191- boolean enable = false ;
1192- if (Args .getInstance ().getStorage ().getDbEngine ().toUpperCase ().equals ("ROCKSDB" )) {
1193- enable =
1194- config .hasPath ("storage.backup.enable" ) && config .getBoolean ("storage.backup.enable" );
1195- }
1195+ boolean enable =
1196+ config .hasPath ("storage.backup.enable" ) && config .getBoolean ("storage.backup.enable" );
11961197 String propPath = config .hasPath ("storage.backup.propPath" )
11971198 ? config .getString ("storage.backup.propPath" ) : "prop.properties" ;
11981199 String bak1path = config .hasPath ("storage.backup.bak1path" )
0 commit comments