Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,7 @@ private void replaceTableInternal(Database db, OlapTable origTable, OlapTable ne
// not swap, the origin table is not used anymore, need to drop all its tablets.
// put original table to recycle bin.
if (isForce) {
Env.getCurrentEnv().onEraseOlapTable(origTable, isReplay);
Env.getCurrentEnv().onEraseOlapTable(db.getId(), origTable, isReplay);
} else {
Env.getCurrentRecycleBin().recycleTable(db.getId(), origTable, isReplay, isForce, 0);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ protected void onCancel() {
while (true) {
try {
((CloudInternalCatalog) Env.getCurrentInternalCatalog())
.dropMaterializedIndex(tableId, rollupIndexList, false);
.dropMaterializedIndex(dbId, tableId, rollupIndexList, false);
for (Map.Entry<Long, Map<Long, Long>> partitionEntry : partitionIdToBaseRollupTabletIdMap.entrySet()) {
Long partitionId = partitionEntry.getKey();
Map<Long, Long> rollupTabletIdToBaseTabletId = partitionEntry.getValue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ private void dropIndex(List<Long> idxList) {
while (true) {
try {
((CloudInternalCatalog) Env.getCurrentInternalCatalog())
.dropMaterializedIndex(tableId, idxList, false);
.dropMaterializedIndex(dbId, tableId, idxList, false);
break;
} catch (Exception e) {
LOG.warn("drop index failed, retry times {}, dbId: {}, tableId: {}, jobId: {}, idxList: {}:",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -985,7 +985,7 @@ public void processBatchDropRollup(List<AlterClause> dropRollupClauses, Database
} finally {
olapTable.writeUnlock();
}
Env.getCurrentInternalCatalog().eraseDroppedIndex(olapTable.getId(), deleteIndexList);
Env.getCurrentInternalCatalog().eraseDroppedIndex(db.getId(), olapTable.getId(), deleteIndexList);
}

public void processDropMaterializedView(DropMaterializedViewCommand dropMaterializedViewCommand, Database db,
Expand Down Expand Up @@ -1014,7 +1014,7 @@ public void processDropMaterializedView(DropMaterializedViewCommand dropMaterial
} finally {
olapTable.writeUnlock();
}
Env.getCurrentInternalCatalog().eraseDroppedIndex(olapTable.getId(), deleteIndexList);
Env.getCurrentInternalCatalog().eraseDroppedIndex(db.getId(), olapTable.getId(), deleteIndexList);
}

/**
Expand Down Expand Up @@ -1105,7 +1105,7 @@ public void replayDropRollup(DropInfo dropInfo, Env env) throws MetaNotFoundExce

List<Long> deleteIndexList = new ArrayList<Long>();
deleteIndexList.add(rollupIndexId);
Env.getCurrentInternalCatalog().eraseDroppedIndex(olapTable.getId(), deleteIndexList);
Env.getCurrentInternalCatalog().eraseDroppedIndex(db.getId(), olapTable.getId(), deleteIndexList);
LOG.info("replay drop rollup {}", dropInfo.getIndexId());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2606,7 +2606,7 @@ private Status atomicReplaceOlapTables(Database db, boolean isReplay) {
try {
LOG.info("drop the origin olap table {}. table={}" + " isAtomicRestore: {}",
originOlapTbl.getName(), originOlapTbl.getId(), isAtomicRestore);
Env.getCurrentEnv().onEraseOlapTable(originOlapTbl, isReplay);
Env.getCurrentEnv().onEraseOlapTable(db.getId(), originOlapTbl, isReplay);
} finally {
originOlapTbl.writeUnlock();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ private void eraseAllTables(RecycleDatabaseInfo dbInfo) {

Table table = tableInfo.getTable();
if (table.isManagedTable()) {
Env.getCurrentEnv().onEraseOlapTable((OlapTable) table, false);
Env.getCurrentEnv().onEraseOlapTable(dbId, (OlapTable) table, false);
}
iterator.remove();
idToRecycleTime.remove(table.getId());
Expand Down Expand Up @@ -469,7 +469,7 @@ private void eraseTable(long currentTimeMs, int keepNum) {
}
Table table = tableInfo.getTable();
if (table.isManagedTable()) {
Env.getCurrentEnv().onEraseOlapTable((OlapTable) table, false);
Env.getCurrentEnv().onEraseOlapTable(tableInfo.getDbId(), (OlapTable) table, false);
}

idToRecycleTime.remove(tableId);
Expand Down Expand Up @@ -527,7 +527,7 @@ private void eraseTableWithSameName(long dbId, String tableName, long currentTim
}
Table table = tableInfo.getTable();
if (table.isManagedTable()) {
Env.getCurrentEnv().onEraseOlapTable((OlapTable) table, false);
Env.getCurrentEnv().onEraseOlapTable(dbId, (OlapTable) table, false);
}

idToTable.remove(tableId);
Expand Down Expand Up @@ -566,7 +566,7 @@ public void replayEraseTable(long tableId) {

Table table = tableInfo.getTable();
if (table.isManagedTable()) {
Env.getCurrentEnv().onEraseOlapTable((OlapTable) table, true);
Env.getCurrentEnv().onEraseOlapTable(tableInfo.getDbId(), (OlapTable) table, true);
}
LOG.info("replay erase table[{}]", tableId);
} finally {
Expand Down Expand Up @@ -1226,7 +1226,7 @@ public void eraseTableInstantly(long tableId) throws DdlException {
long dbId = tableInfo.getDbId();
Table table = tableInfo.getTable();
if (table.getType() == TableType.OLAP || table.getType() == TableType.MATERIALIZED_VIEW) {
Env.getCurrentEnv().onEraseOlapTable((OlapTable) table, false);
Env.getCurrentEnv().onEraseOlapTable(dbId, (OlapTable) table, false);
}

idToTable.remove(tableId);
Expand Down
4 changes: 2 additions & 2 deletions fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java
Original file line number Diff line number Diff line change
Expand Up @@ -7041,7 +7041,7 @@ public void eraseDatabase(long dbId, boolean needEditLog) {
}
}

public void onEraseOlapTable(OlapTable olapTable, boolean isReplay) {
public void onEraseOlapTable(long dbId, OlapTable olapTable, boolean isReplay) {
// inverted index
TabletInvertedIndex invertedIndex = Env.getCurrentInvertedIndex();
Collection<Partition> allPartitions = olapTable.getAllPartitions();
Expand All @@ -7057,7 +7057,7 @@ public void onEraseOlapTable(OlapTable olapTable, boolean isReplay) {
// colocation
Env.getCurrentColocateIndex().removeTable(olapTable.getId());

getInternalCatalog().eraseTableDropBackendReplicas(olapTable, isReplay);
getInternalCatalog().eraseTableDropBackendReplicas(dbId, olapTable, isReplay);
}

public void onErasePartition(Partition partition) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,7 @@ public void checkMaterializedIndex(long dbId, long tableId, List<Long> indexIds)
// BEGIN DROP TABLE

@Override
public void eraseTableDropBackendReplicas(OlapTable olapTable, boolean isReplay) {
public void eraseTableDropBackendReplicas(long dbId, OlapTable olapTable, boolean isReplay) {
if (!Env.getCurrentEnv().isMaster()) {
return;
}
Expand All @@ -837,7 +837,7 @@ public void eraseTableDropBackendReplicas(OlapTable olapTable, boolean isReplay)
if (indexs.isEmpty()) {
break;
}
dropMaterializedIndex(olapTable.getId(), indexs, true);
dropMaterializedIndex(dbId, olapTable.getId(), indexs, true);
} catch (Exception e) {
LOG.warn("failed to drop index {} of table {}, try cnt {}, execption {}",
indexs, olapTable.getId(), tryCnt, e);
Expand Down Expand Up @@ -1020,7 +1020,8 @@ public void removeSchemaChangeJob(long jobId, long dbId, long tableId, long inde
}
}

public void dropMaterializedIndex(long tableId, List<Long> indexIds, boolean dropTable) throws DdlException {
public void dropMaterializedIndex(long dbId, long tableId, List<Long> indexIds, boolean dropTable)
throws DdlException {
if (Config.enable_check_compatibility_mode) {
LOG.info("skip dropping materialized index in compatibility checking mode");
return;
Expand All @@ -1031,6 +1032,7 @@ public void dropMaterializedIndex(long tableId, List<Long> indexIds, boolean dro
indexRequestBuilder.setCloudUniqueId(Config.cloud_unique_id);
indexRequestBuilder.addAllIndexIds(indexIds);
indexRequestBuilder.setTableId(tableId);
indexRequestBuilder.setDbId(dbId);
final Cloud.IndexRequest indexRequest = indexRequestBuilder.build();

Cloud.IndexResponse response = null;
Expand Down Expand Up @@ -1061,7 +1063,7 @@ public void dropMaterializedIndex(long tableId, List<Long> indexIds, boolean dro
* @param tableId
* @param indexIdList
*/
public void eraseDroppedIndex(long tableId, List<Long> indexIdList) {
public void eraseDroppedIndex(long dbId, long tableId, List<Long> indexIdList) {
if (indexIdList == null || indexIdList.size() == 0) {
LOG.warn("indexIdList is empty");
return;
Expand All @@ -1075,7 +1077,7 @@ public void eraseDroppedIndex(long tableId, List<Long> indexIdList) {
}

try {
dropMaterializedIndex(tableId, indexIdList, false);
dropMaterializedIndex(dbId, tableId, indexIdList, false);
break;
} catch (Exception e) {
LOG.warn("tryCnt:{}, eraseDroppedIndex exception:", tryCnt, e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1069,7 +1069,7 @@ public void replayRecoverTable(RecoverInfo info) throws MetaNotFoundException, D
}
}

public void eraseTableDropBackendReplicas(OlapTable olapTable, boolean isReplay) {
public void eraseTableDropBackendReplicas(long dbId, OlapTable olapTable, boolean isReplay) {
if (isReplay || Env.isCheckpointThread()) {
return;
}
Expand Down Expand Up @@ -1101,7 +1101,7 @@ public void erasePartitionDropBackendReplicas(List<Partition> partitions) {
// no need send be delete task, when be report its tablets, fe will send delete task then.
}

public void eraseDroppedIndex(long tableId, List<Long> indexIdList) {
public void eraseDroppedIndex(long dbId, long tableId, List<Long> indexIdList) {
// nothing to do in non cloud mode
}

Expand Down
Loading