MarcosZyk commented on code in PR #9306:
URL: https://github.com/apache/iotdb/pull/9306#discussion_r1133833508
##########
confignode/src/main/java/org/apache/iotdb/confignode/manager/ClusterSchemaManager.java:
##########
@@ -158,53 +158,41 @@ public TSStatus setDatabase(DatabaseSchemaPlan
databaseSchemaPlan) {
/** Alter Database */
public TSStatus alterDatabase(DatabaseSchemaPlan databaseSchemaPlan) {
TSStatus result;
- boolean isDatabaseExisted;
- TDatabaseSchema storageGroupSchema = databaseSchemaPlan.getSchema();
+ TDatabaseSchema databaseSchema = databaseSchemaPlan.getSchema();
- try {
- isDatabaseExisted =
clusterSchemaInfo.isDatabaseExisted(storageGroupSchema.getName());
- } catch (IllegalPathException e) {
- // Reject if DatabaseName is illegal
- result = new TSStatus(TSStatusCode.ILLEGAL_PATH.getStatusCode());
- result.setMessage("Failed to alter database. " + e.getMessage());
- return result;
- }
-
- if (!isDatabaseExisted) {
+ if (!isDatabaseExist(databaseSchema.getName())) {
// Reject if Database doesn't exist
result = new TSStatus(TSStatusCode.DATABASE_NOT_EXIST.getStatusCode());
result.setMessage(
- "Failed to alter database. The Database "
- + storageGroupSchema.getName()
- + " doesn't exist.");
+ "Failed to alter database. The Database " + databaseSchema.getName()
+ " doesn't exist.");
return result;
}
Review Comment:
I think the PartitionManager only takes care of whether a database occupies
physical resources in cluster, rather than namely ```isDatabaseExist```. A
database exists as only as it exists in clusterSchemaInfo and can be queried by
```show databases```.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]