diff --git a/core/src/main/java/cn/edu/tsinghua/iot/benchmark/mode/BaseMode.java b/core/src/main/java/cn/edu/tsinghua/iot/benchmark/mode/BaseMode.java index ad9147f4f..4cbd14bb4 100644 --- a/core/src/main/java/cn/edu/tsinghua/iot/benchmark/mode/BaseMode.java +++ b/core/src/main/java/cn/edu/tsinghua/iot/benchmark/mode/BaseMode.java @@ -115,13 +115,11 @@ protected boolean cleanUpData(List dbConfigs, Measurement measurement) DBWrapper dbWrapper = new DBWrapper(dbConfigs, measurement); try { dbWrapper.init(); - if (config.isIS_DELETE_DATA()) { - try { - dbWrapper.cleanup(); - } catch (TsdbException e) { - LOGGER.error("Cleanup {} failed because ", config.getNET_DEVICE(), e); - return false; - } + try { + dbWrapper.cleanup(); + } catch (TsdbException e) { + LOGGER.error("Cleanup {} failed because ", config.getNET_DEVICE(), e); + return false; } } catch (TsdbException e) { LOGGER.error("Initialize {} failed because ", config.getNET_DEVICE(), e); diff --git a/core/src/main/java/cn/edu/tsinghua/iot/benchmark/mode/TestWithDefaultPathMode.java b/core/src/main/java/cn/edu/tsinghua/iot/benchmark/mode/TestWithDefaultPathMode.java index 78f49dd57..c7b922383 100644 --- a/core/src/main/java/cn/edu/tsinghua/iot/benchmark/mode/TestWithDefaultPathMode.java +++ b/core/src/main/java/cn/edu/tsinghua/iot/benchmark/mode/TestWithDefaultPathMode.java @@ -45,8 +45,10 @@ protected boolean preCheck() { if (config.isIS_DOUBLE_WRITE()) { dbConfigs.add(config.getANOTHER_DBConfig()); } - if (!cleanUpData(dbConfigs, measurement)) { - return false; + if (config.isIS_DELETE_DATA()) { + if (!cleanUpData(dbConfigs, measurement)) { + return false; + } } if (config.isCREATE_SCHEMA()) { if (!registerSchema(measurement)) { diff --git a/core/src/main/java/cn/edu/tsinghua/iot/benchmark/mode/VerificationWriteMode.java b/core/src/main/java/cn/edu/tsinghua/iot/benchmark/mode/VerificationWriteMode.java index 4d209f9c1..efc6143e4 100644 --- a/core/src/main/java/cn/edu/tsinghua/iot/benchmark/mode/VerificationWriteMode.java +++ b/core/src/main/java/cn/edu/tsinghua/iot/benchmark/mode/VerificationWriteMode.java @@ -40,8 +40,10 @@ protected boolean preCheck() { if (config.isIS_DOUBLE_WRITE()) { dbConfigs.add(config.getANOTHER_DBConfig()); } - if (!cleanUpData(dbConfigs, measurement)) { - return false; + if (config.isIS_DELETE_DATA()) { + if (!cleanUpData(dbConfigs, measurement)) { + return false; + } } if (config.isCREATE_SCHEMA()) { if (!registerSchema(measurement)) {