Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Fix and rollback
  • Loading branch information
Caideyipi committed Mar 31, 2025
commit 6c46ef6553dac368535634547d3f6009d8f92e6b
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,6 @@
public class IoTDBPipePermissionIT extends AbstractPipeSingleIT {
@Test
public void testSinkPermission() {
// Prepare partial data
TableModelUtils.createDataBaseAndTable(env, "test", "test1");
TableModelUtils.createDataBaseAndTable(env, "test1", "test1");
TableModelUtils.createDataBaseAndTable(env, "test", "test");
TableModelUtils.createDataBaseAndTable(env, "test1", "test");

if (!TableModelUtils.insertData("test1", "test1", 0, 50, env)) {
return;
}

if (!TestUtils.tryExecuteNonQueryWithRetry(env, "create user `thulab` 'passwd'")) {
return;
}
Expand Down Expand Up @@ -104,6 +94,11 @@ public void testSinkPermission() {
fail("Alter pipe shall not fail if user and password are specified");
}

TableModelUtils.createDataBaseAndTable(env, "test", "test1");
TableModelUtils.createDataBaseAndTable(env, "test1", "test1");
TableModelUtils.createDataBaseAndTable(env, "test", "test");
TableModelUtils.createDataBaseAndTable(env, "test1", "test");

// Write some data
if (!TableModelUtils.insertData("test1", "test", 0, 100, env)) {
return;
Expand All @@ -122,7 +117,7 @@ public void testSinkPermission() {
"test1", BaseEnv.TABLE_SQL_DIALECT, env, "grant INSERT on test.test1 to user thulab")) {
return;
}
if (!TableModelUtils.insertData("test1", "test1", 50, 100, env)) {
if (!TableModelUtils.insertData("test1", "test1", 0, 100, env)) {
return;
}
TableModelUtils.assertCountData("test", "test1", 100, env);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -374,9 +374,16 @@ private void autoCreateDatabaseIfNecessary(final String database) {
return;
}

Coordinator.getInstance()
.getAccessControl()
.checkCanCreateDatabase(session.getUsername(), database);
try {
Coordinator.getInstance()
.getAccessControl()
.checkCanCreateDatabase(session.getUsername(), database);
} catch (final AccessDeniedException e) {
// Auto create failed, we still check if there are existing databases
// If there are not, this will be removed by catching database not exists exception
ALREADY_CREATED_DATABASES.add(database);
return;
}
final TDatabaseSchema schema = new TDatabaseSchema(new TDatabaseSchema(database));
schema.setIsTableModel(true);

Expand Down