Skip to content

Commit 0b74d2b

Browse files
authored
Pipe: Checked the enable_auto_create_schema in database auto creation (apache#16354)
1 parent 7466e2c commit 0b74d2b

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/receiver/protocol/thrift/IoTDBDataNodeReceiver.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -986,7 +986,8 @@ private TSStatus executeStatementForTableModel(
986986
}
987987

988988
private void autoCreateDatabaseIfNecessary(final String database) {
989-
if (ALREADY_CREATED_TABLE_MODEL_DATABASES.contains(database)) {
989+
if (ALREADY_CREATED_TABLE_MODEL_DATABASES.contains(database)
990+
|| !IoTDBDescriptor.getInstance().getConfig().isAutoCreateSchemaEnabled()) {
990991
return;
991992
}
992993

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/writeback/WriteBackSink.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,8 @@ private TSStatus executeStatementForTableModel(
428428
}
429429

430430
private void autoCreateDatabaseIfNecessary(final String database) {
431-
if (ALREADY_CREATED_DATABASES.contains(database)) {
431+
if (ALREADY_CREATED_DATABASES.contains(database)
432+
|| !IoTDBDescriptor.getInstance().getConfig().isAutoCreateSchemaEnabled()) {
432433
return;
433434
}
434435

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/load/LoadTsFileTableSchemaCache.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,13 @@ private void autoCreateTableDatabaseIfAbsent(final String database) throws LoadA
302302
return;
303303
}
304304

305+
if (!IoTDBDescriptor.getInstance().getConfig().isAutoCreateSchemaEnabled()) {
306+
throw new LoadAnalyzeException(
307+
"The database "
308+
+ database
309+
+ " does not exist, please enable 'enable_auto_create_schema' to enable auto creation.");
310+
}
311+
305312
Coordinator.getInstance()
306313
.getAccessControl()
307314
.checkCanCreateDatabase(context.getSession().getUserName(), database);

0 commit comments

Comments
 (0)