Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't show "Registering schema..." when CREATE_SCHEMA=false #381

Merged
merged 3 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,11 @@ protected boolean cleanUpData(List<DBConfig> 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,17 @@ protected boolean preCheck() {
if (config.isIS_DOUBLE_WRITE()) {
dbConfigs.add(config.getANOTHER_DBConfig());
}
return cleanUpData(dbConfigs, measurement) && registerSchema(measurement);
if (config.isIS_DELETE_DATA()) {
if (!cleanUpData(dbConfigs, measurement)) {
return false;
}
}
if (config.isCREATE_SCHEMA()) {
if (!registerSchema(measurement)) {
return false;
}
}
return true;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,17 @@ protected boolean preCheck() {
if (config.isIS_DOUBLE_WRITE()) {
dbConfigs.add(config.getANOTHER_DBConfig());
}
return cleanUpData(dbConfigs, measurement) && registerSchema(measurement);
if (config.isIS_DELETE_DATA()) {
if (!cleanUpData(dbConfigs, measurement)) {
return false;
}
}
if (config.isCREATE_SCHEMA()) {
if (!registerSchema(measurement)) {
return false;
}
}
return true;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -510,15 +510,13 @@ public Double registerSchema(List<DeviceSchema> schemaList) throws TsdbException
double createSchemaTimeInSecond = 0.0;
LOGGER.info("Registering schema...");
try {
if (config.isCREATE_SCHEMA()) {
for (IDatabase database : databases) {
Double registerTime = database.registerSchema(schemaList);
if (null == registerTime) {
LOGGER.error("Failed to create schema for {}.", database.getClass().getName());
return null;
}
createSchemaTimeInSecond = Math.max(createSchemaTimeInSecond, registerTime);
for (IDatabase database : databases) {
Double registerTime = database.registerSchema(schemaList);
if (null == registerTime) {
LOGGER.error("Failed to create schema for {}.", database.getClass().getName());
return null;
}
createSchemaTimeInSecond = Math.max(createSchemaTimeInSecond, registerTime);
}
measurement.setCreateSchemaTime(createSchemaTimeInSecond);
} catch (Exception e) {
Expand Down
Loading