nextdreamblue commented on code in PR #14457: URL: https://github.com/apache/doris/pull/14457#discussion_r1029338221
########## fe/fe-core/src/main/java/org/apache/doris/catalog/CatalogRecycleBin.java: ########## @@ -824,6 +824,32 @@ public void readFields(DataInput in) throws IOException { long time = in.readLong(); idToRecycleTime.put(id, time); } + updateDbInfoForLowerVersion(); + } + + private void updateDbInfoForLowerVersion() { + if (Env.getCurrentEnvJournalVersion() < FeMetaVersion.VERSION_114) { + Iterator<Map.Entry<Long, RecycleDatabaseInfo>> dbIterator = idToDatabase.entrySet().iterator(); + while (dbIterator.hasNext()) { + Map.Entry<Long, RecycleDatabaseInfo> dbEntry = dbIterator.next(); + RecycleDatabaseInfo dbInfo = dbEntry.getValue(); + Set<String> tableNames = Sets.newHashSet(dbInfo.getTableNames()); + Set<Long> tableIds = Sets.newHashSet(); + Iterator<Map.Entry<Long, RecycleTableInfo>> iterator = idToTable.entrySet().iterator(); + while (iterator.hasNext()) { + Map.Entry<Long, RecycleTableInfo> entry = iterator.next(); + RecycleTableInfo tableInfo = entry.getValue(); + if (tableInfo.getDbId() != dbEntry.getKey() + || !tableNames.contains(tableInfo.getTable().getName())) { + continue; + } + + tableIds.add(entry.getKey()); + } + dbInfo.setTableIds(tableIds); + idToDatabase.put(dbEntry.getKey(), dbInfo); Review Comment: > Why put it back to `idToDatabase`? it already exist in `idToDatabase`. fixed it -- 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. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org