cherry pick from #39547
This commit is contained in:
@ -207,9 +207,16 @@ public class CatalogRecycleBin extends MasterDaemon implements Writable {
|
||||
idToRecycleTime.put(id, recycleTime);
|
||||
}
|
||||
|
||||
public synchronized boolean isRecycleDatabase(long dbId) {
|
||||
return idToDatabase.containsKey(dbId);
|
||||
}
|
||||
|
||||
public synchronized boolean isRecycleTable(long dbId, long tableId) {
|
||||
return isRecycleDatabase(dbId) || idToTable.containsKey(tableId);
|
||||
}
|
||||
|
||||
public synchronized boolean isRecyclePartition(long dbId, long tableId, long partitionId) {
|
||||
return idToDatabase.containsKey(dbId) || idToTable.containsKey(tableId)
|
||||
|| idToPartition.containsKey(partitionId);
|
||||
return isRecycleTable(dbId, tableId) || idToPartition.containsKey(partitionId);
|
||||
}
|
||||
|
||||
public synchronized void getRecycleIds(Set<Long> dbIds, Set<Long> tableIds, Set<Long> partitionIds) {
|
||||
|
||||
@ -469,7 +469,10 @@ public class TabletInvertedIndex {
|
||||
table.readUnlock();
|
||||
}
|
||||
} catch (RuntimeException e) {
|
||||
LOG.warn("failed to get tablet. tabletId={}", beTabletInfo.tablet_id);
|
||||
if (!Env.getCurrentRecycleBin().isRecyclePartition(tabletMeta.getDbId(),
|
||||
tabletMeta.getTableId(), tabletMeta.getPartitionId())) {
|
||||
LOG.warn("failed to get tablet. tabletId={}", beTabletInfo.tablet_id);
|
||||
}
|
||||
return;
|
||||
}
|
||||
Pair<Long, Long> cooldownConf = tablet.getCooldownConf();
|
||||
|
||||
@ -124,7 +124,11 @@ public class CooldownConfHandler extends MasterDaemon {
|
||||
table.readUnlock();
|
||||
}
|
||||
} catch (RuntimeException e) {
|
||||
LOG.warn("failed to get tablet. tabletId={}", conf.tabletId);
|
||||
if (Env.getCurrentRecycleBin().isRecyclePartition(conf.dbId, conf.tableId, conf.partitionId)) {
|
||||
LOG.debug("failed to get tablet, it's in catalog recycle bin. tabletId={}", conf.tabletId);
|
||||
} else {
|
||||
LOG.warn("failed to get tablet. tabletId={}", conf.tabletId);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -61,21 +61,26 @@ public class Diagnoser {
|
||||
// database
|
||||
Database db = Env.getCurrentInternalCatalog().getDbNullable(tabletMeta.getDbId());
|
||||
if (db == null) {
|
||||
results.add(Lists.newArrayList("Database", "Not exist", ""));
|
||||
boolean inRecycleBin = Env.getCurrentRecycleBin().isRecycleDatabase(tabletMeta.getDbId());
|
||||
results.add(Lists.newArrayList("Database", inRecycleBin ? "In catalog recycle bin" : "Not exist", ""));
|
||||
return results;
|
||||
}
|
||||
results.add(Lists.newArrayList("Database", db.getFullName() + ": " + db.getId(), ""));
|
||||
// table
|
||||
OlapTable tbl = (OlapTable) db.getTableNullable(tabletMeta.getTableId());
|
||||
if (tbl == null) {
|
||||
results.add(Lists.newArrayList("Table", "Not exist", ""));
|
||||
boolean inRecycleBin = Env.getCurrentRecycleBin().isRecycleTable(tabletMeta.getDbId(),
|
||||
tabletMeta.getTableId());
|
||||
results.add(Lists.newArrayList("Table", inRecycleBin ? "In catalog recycle bin" : "Not exist", ""));
|
||||
return results;
|
||||
}
|
||||
results.add(Lists.newArrayList("Table", tbl.getName() + ": " + tbl.getId(), ""));
|
||||
// partition
|
||||
Partition partition = tbl.getPartition(tabletMeta.getPartitionId());
|
||||
if (partition == null) {
|
||||
results.add(Lists.newArrayList("Partition", "Not exist", ""));
|
||||
boolean inRecycleBin = Env.getCurrentRecycleBin().isRecyclePartition(tabletMeta.getDbId(),
|
||||
tabletMeta.getTableId(), tabletMeta.getPartitionId());
|
||||
results.add(Lists.newArrayList("Partition", inRecycleBin ? "In catalog recycle bin" : "Not exist", ""));
|
||||
return results;
|
||||
}
|
||||
results.add(Lists.newArrayList("Partition", partition.getName() + ": " + partition.getId(), ""));
|
||||
|
||||
Reference in New Issue
Block a user