This is an automated email from the ASF dual-hosted git repository.
yongzao pushed a commit to branch more-logs-4-partition-allocation
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to
refs/heads/more-logs-4-partition-allocation by this push:
new 8a5c5ea7587 add database not exists exception
8a5c5ea7587 is described below
commit 8a5c5ea75871c44c0910fbe1933fc663b6bdc9b2
Author: YongzaoDan <[email protected]>
AuthorDate: Mon Mar 31 15:24:45 2025 +0800
add database not exists exception
---
.../manager/partition/PartitionManager.java | 30 ++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git
a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/partition/PartitionManager.java
b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/partition/PartitionManager.java
index 18fd09e13d4..dd538a94694 100644
---
a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/partition/PartitionManager.java
+++
b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/partition/PartitionManager.java
@@ -250,6 +250,21 @@ public class PartitionManager {
return resp;
}
+ // Here we check if the related Databases exist again,
+ // due to we don't have a transaction mechanism.
+ for (final String database : req.getPartitionSlotsMap().keySet()) {
+ if (!isDatabaseExist(database)) {
+ return new SchemaPartitionResp(
+ new TSStatus(TSStatusCode.DATABASE_NOT_EXIST.getStatusCode())
+ .setMessage(
+ String.format(
+ "Create SchemaPartition failed because the database:
%s is not exists",
+ database)),
+ false,
+ null);
+ }
+ }
+
// Filter unassigned SchemaPartitionSlots
final Map<String, List<TSeriesPartitionSlot>>
unassignedSchemaPartitionSlotsMap =
partitionInfo.filterUnassignedSchemaPartitionSlots(req.getPartitionSlotsMap());
@@ -380,6 +395,21 @@ public class PartitionManager {
return resp;
}
+ // Here we check if the related Databases exist again,
+ // due to we don't have a transaction mechanism.
+ for (final String database : req.getPartitionSlotsMap().keySet()) {
+ if (!isDatabaseExist(database)) {
+ return new DataPartitionResp(
+ new TSStatus(TSStatusCode.DATABASE_NOT_EXIST.getStatusCode())
+ .setMessage(
+ String.format(
+ "Create DataPartition failed because the database:
%s is not exists",
+ database)),
+ false,
+ null);
+ }
+ }
+
// Filter unassigned DataPartitionSlots
Map<String, Map<TSeriesPartitionSlot, TTimeSlotList>>
unassignedDataPartitionSlotsMap =
partitionInfo.filterUnassignedDataPartitionSlots(req.getPartitionSlotsMap());