Skip to content

Commit

Permalink
Revert "[BugFix] Set ColocateGroupSchema bucketNum to the calculated …
Browse files Browse the repository at this point in the history
  • Loading branch information
wanpengfei-git authored Jul 19, 2023
1 parent 15cd500 commit 1e5e391
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -240,13 +240,6 @@ public GroupId addTableToGroup(long dbId, OlapTable tbl, String groupName, Group
groupAlreadyExist = false;
}
HashDistributionInfo distributionInfo = (HashDistributionInfo) tbl.getDefaultDistributionInfo();
if (!(tbl instanceof ExternalOlapTable)) {
// Colocate table should keep the same bucket number across the partitions
if (distributionInfo.getBucketNum() == 0) {
int bucketNum = CatalogUtils.calBucketNumAccordingToBackends();
distributionInfo.setBucketNum(bucketNum);
}
}
ColocateGroupSchema groupSchema = new ColocateGroupSchema(groupId,
distributionInfo.getDistributionColumns(), distributionInfo.getBucketNum(),
tbl.getDefaultReplicationNum());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,11 @@ public Table createTable(LocalMetastore metastore, Database db, CreateTableStmt

boolean addedToColocateGroup = colocateTableIndex.addTableToGroup(db, table,
colocateGroup, false /* expectLakeTable */);
if (!(table instanceof ExternalOlapTable) && addedToColocateGroup) {
// Colocate table should keep the same bucket number across the partitions
DistributionInfo defaultDistributionInfo = table.getDefaultDistributionInfo();
table.inferDistribution(defaultDistributionInfo);
}
}

// get base index storage type. default is COLUMN
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@

package com.starrocks.analysis;

import com.starrocks.catalog.ColocateGroupSchema;
import com.starrocks.catalog.ColocateTableIndex;
import com.starrocks.catalog.Database;
import com.starrocks.catalog.OlapTable;
import com.starrocks.catalog.Partition;
Expand Down Expand Up @@ -254,12 +252,6 @@ public void test1AutoTabletWithColocate() throws Exception {
db.readUnlock();
}
Assert.assertEquals(bucketNum, 10);

Long dbId = db.getId();
String fullGroupName = dbId + "_g1";
ColocateTableIndex index = GlobalStateMgr.getCurrentColocateIndex();
ColocateGroupSchema groupSchema = index.getGroupSchema(fullGroupName);
Assert.assertEquals(groupSchema.getBucketsNum(), 10);
}


Expand Down

0 comments on commit 1e5e391

Please sign in to comment.