/** * Determine current startup mode. See BootMode for detailed explanation of each mode. * * @param config * @return */ private StartupMode checkStartupMode(Configuration config) throws IOException { // Check on disk mode first StartupMode bootMode = checkStartupModeOnDisk(config); if (bootMode != null) { return bootMode; } // Check geodb restore flag in zk if (checkConfigBool(config, Constants.STARTUPMODE_RESTORE_REINIT)) { _log.info("Found geodbrestore config: {}", Constants.STARTUPMODE_RESTORE_REINIT); GeodbRestoreMode mode = new GeodbRestoreMode(config); mode.setCoordinator(_coordinator); mode.setSchemaUtil(_schemaUtil); mode.setDbDir(dbDir); return mode; } // Check geodb reinit ZK flag for add-vdc if (checkConfigBool(config, Constants.REINIT_DB)) { _log.info("Found reinit config: {}", Constants.REINIT_DB); // reinit both system table and StorageOS tables DbReinitMode mode = new DbReinitMode(config); mode.setCoordinator(_coordinator); mode.setSchemaUtil(_schemaUtil); mode.setDbDir(dbDir); return mode; } // check geodb cleanup mode for remove-vdc List<String> obsoletePeers = checkConfigList(config, Constants.OBSOLETE_CASSANDRA_PEERS); if (!obsoletePeers.isEmpty()) { // drop peers ip/tokens from system table ObsoletePeersCleanupMode mode = new ObsoletePeersCleanupMode(config); mode.setCoordinator(_coordinator); mode.setSchemaUtil(_schemaUtil); mode.setObsoletePeers(obsoletePeers); return mode; } else { NormalMode mode = new NormalMode(config); mode.setCoordinator(_coordinator); mode.setSchemaUtil(_schemaUtil); return mode; } }