@@ -123,6 +123,10 @@ public class Args {
123123 @ Parameter (names = {"--storage-db-version" }, description = "Storage db version.(1 or 2)" )
124124 private String storageDbVersion = "" ;
125125
126+ @ Parameter (names = {
127+ "--storage-db-engine" }, description = "Storage db engine.(leveldb or rocksdb)" )
128+ private String storageDbEngine = "" ;
129+
126130 @ Parameter (names = {
127131 "--storage-db-synchronous" }, description = "Storage db is synchronous or not.(true or flase)" )
128132 private String storageDbSynchronous = "" ;
@@ -612,6 +616,10 @@ public static void setParam(final String[] args, final String confFileName) {
612616 .map (Integer ::valueOf )
613617 .orElse (Storage .getDbVersionFromConfig (config )));
614618
619+ INSTANCE .storage .setDbEngine (Optional .ofNullable (INSTANCE .storageDbEngine )
620+ .filter (StringUtils ::isNotEmpty )
621+ .orElse (Storage .getDbEngineFromConfig (config )));
622+
615623 INSTANCE .storage .setDbSync (Optional .ofNullable (INSTANCE .storageDbSynchronous )
616624 .filter (StringUtils ::isNotEmpty )
617625 .map (Boolean ::valueOf )
@@ -1140,8 +1148,7 @@ private static double calcMaxTimeRatio() {
11401148 private static void initRocksDbSettings (Config config ) {
11411149 String prefix = "storage.dbSettings." ;
11421150
1143- if (Args .getInstance ().getStorage ().getDbVersion () == 3
1144- || Args .getInstance ().getStorage ().getDbVersion () == 4 ) {
1151+ if (Args .getInstance ().getStorage ().getDbEngine ().equals ("ROCKSDB" )) {
11451152 int levelNumber = config .hasPath (prefix + "levelNumber" )
11461153 ? config .getInt (prefix + "levelNumber" ) : 7 ;
11471154 int compactThreads = config .hasPath (prefix + "compactThreads" )
@@ -1173,8 +1180,7 @@ private static void initRocksDbSettings(Config config) {
11731180
11741181 private static void initRocksDbBackupProperty (Config config ) {
11751182 boolean enable = false ;
1176- if (Args .getInstance ().getStorage ().getDbVersion () == 3
1177- || Args .getInstance ().getStorage ().getDbVersion () == 4 ) {
1183+ if (Args .getInstance ().getStorage ().getDbEngine ().toUpperCase ().equals ("ROCKSDB" )) {
11781184 enable =
11791185 config .hasPath ("storage.backup.enable" ) && config .getBoolean ("storage.backup.enable" );
11801186 }
@@ -1223,6 +1229,7 @@ private static void logConfig() {
12231229 logger .info ("Code version : {}" , Version .getVersion ());
12241230 logger .info ("************************ DB config *************************" );
12251231 logger .info ("DB version : {}" , args .getStorage ().getDbVersion ());
1232+ logger .info ("DB engine : {}" , args .getStorage ().getDbEngine ());
12261233 logger .info ("***************************************************************" );
12271234 logger .info ("\n " );
12281235 }
0 commit comments