[improvement](diagnose) add tablet in recycle bin hint #39547 (#39622)

cherry pick from #39547
This commit is contained in:
yujun
2024-08-21 09:16:01 +08:00
committed by GitHub
parent 57262a3d5c
commit 2fe6d580be
4 changed files with 26 additions and 7 deletions

View File

@ -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) {

View File

@ -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();

View File

@ -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;
}
}

View File

@ -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(), ""));