wangbo commented on a change in pull request #5391:
URL: https://github.com/apache/incubator-doris/pull/5391#discussion_r590957598
##########
File path: fe/fe-core/src/main/java/org/apache/doris/catalog/Catalog.java
##########
@@ -3769,22 +3769,35 @@ private void createOlapTable(Database db,
CreateTableStmt stmt) throws DdlExcept
throw new DdlException("Unsupported partition method: " +
partitionInfo.getType().name());
}
- if (!db.createTableWithLock(olapTable, false,
stmt.isSetIfNotExists())) {
+ Pair<Boolean, Boolean> result = db.createTableWithLock(olapTable,
false, stmt.isSetIfNotExists());
+ if (!result.first) {
ErrorReport.reportDdlException(ErrorCode.ERR_CANT_CREATE_TABLE, tableName,
"table already exists");
}
- // we have added these index to memory, only need to persist here
- if (getColocateTableIndex().isColocateTable(tableId)) {
- GroupId groupId = getColocateTableIndex().getGroup(tableId);
- List<List<Long>> backendsPerBucketSeq =
getColocateTableIndex().getBackendsPerBucketSeq(groupId);
- ColocatePersistInfo info =
ColocatePersistInfo.createForAddTable(groupId, tableId, backendsPerBucketSeq);
- editLog.logColocateAddTable(info);
- }
- LOG.info("successfully create table[{};{}]", tableName, tableId);
- // register or remove table from DynamicPartition after table
created
-
DynamicPartitionUtil.registerOrRemoveDynamicPartitionTable(db.getId(),
olapTable, false);
- dynamicPartitionScheduler.createOrUpdateRuntimeInfo(
- tableName, DynamicPartitionScheduler.LAST_UPDATE_TIME,
TimeUtils.getCurrentFormatTime());
+ if (result.second) {
+ if (getColocateTableIndex().isColocateTable(tableId)) {
+ // if this is a colocate join table, its table id is
already added to colocate group
+ // so we should remove the tableId here
+ getColocateTableIndex().removeTable(tableId);
+ }
+ for (Long tabletId : tabletIdSet) {
Review comment:
👌
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]