Skip to content

Commit

Permalink
Added the missed separate mTree logic for tree/table database plans (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Caideyipi authored Dec 21, 2024
1 parent 97046f9 commit fa4f6da
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,15 @@ public void testMixedDatabase() throws SQLException {
assertEquals(0, resultSet.getInt(7));
assertFalse(resultSet.next());
}

// Test adjustMaxRegionGroupNum
statement.execute("use test");
statement.execute(
"create table table2(region_id STRING ID, plant_id STRING ID, color STRING ATTRIBUTE, temperature FLOAT MEASUREMENT, speed DOUBLE MEASUREMENT)");
statement.execute(
"insert into table2(region_id, plant_id, color, temperature, speed) values(1, 1, 1, 1, 1)");

statement.execute("create database test1");
}

try (final Connection connection = EnvFactory.getEnv().getConnection();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,9 +375,11 @@ public TSStatus setSchemaReplicationFactor(final SetSchemaReplicationFactorPlan
final TSStatus result = new TSStatus();
databaseReadWriteLock.writeLock().lock();
try {
final ConfigMTree mTree =
PathUtils.isTableModelDatabase(plan.getDatabase()) ? tableModelMTree : treeModelMTree;
final PartialPath path = getQualifiedDatabasePartialPath(plan.getDatabase());
if (treeModelMTree.isDatabaseAlreadySet(path)) {
treeModelMTree
if (mTree.isDatabaseAlreadySet(path)) {
mTree
.getDatabaseNodeByDatabasePath(path)
.getAsMNode()
.getDatabaseSchema()
Expand All @@ -399,9 +401,11 @@ public TSStatus setDataReplicationFactor(final SetDataReplicationFactorPlan plan
final TSStatus result = new TSStatus();
databaseReadWriteLock.writeLock().lock();
try {
final ConfigMTree mTree =
PathUtils.isTableModelDatabase(plan.getDatabase()) ? tableModelMTree : treeModelMTree;
final PartialPath path = getQualifiedDatabasePartialPath(plan.getDatabase());
if (treeModelMTree.isDatabaseAlreadySet(path)) {
treeModelMTree
if (mTree.isDatabaseAlreadySet(path)) {
mTree
.getDatabaseNodeByDatabasePath(path)
.getAsMNode()
.getDatabaseSchema()
Expand All @@ -423,9 +427,11 @@ public TSStatus setTimePartitionInterval(final SetTimePartitionIntervalPlan plan
final TSStatus result = new TSStatus();
databaseReadWriteLock.writeLock().lock();
try {
final ConfigMTree mTree =
PathUtils.isTableModelDatabase(plan.getDatabase()) ? tableModelMTree : treeModelMTree;
final PartialPath path = getQualifiedDatabasePartialPath(plan.getDatabase());
if (treeModelMTree.isDatabaseAlreadySet(path)) {
treeModelMTree
if (mTree.isDatabaseAlreadySet(path)) {
mTree
.getDatabaseNodeByDatabasePath(path)
.getAsMNode()
.getDatabaseSchema()
Expand Down Expand Up @@ -456,7 +462,7 @@ public TSStatus adjustMaxRegionGroupCount(final AdjustMaxRegionGroupNumPlan plan
for (final Map.Entry<String, Pair<Integer, Integer>> entry :
plan.getMaxRegionGroupNumMap().entrySet()) {
final TDatabaseSchema databaseSchema =
treeModelMTree
(PathUtils.isTableModelDatabase(entry.getKey()) ? tableModelMTree : treeModelMTree)
.getDatabaseNodeByDatabasePath(getQualifiedDatabasePartialPath(entry.getKey()))
.getAsMNode()
.getDatabaseSchema();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,6 @@ private SchemaPartition getOrCreateSchemaPartition(
schemaPartitionTableResp.getStatus().getCode()));
}
}
System.out.println(schemaPartition.getSchemaPartitionMap());
return schemaPartition;
} catch (final ClientManagerException | TException e) {
throw new StatementAnalyzeException(
Expand Down

0 comments on commit fa4f6da

Please sign in to comment.