morningman commented on a change in pull request #2167: Fix DB meta lost bug URL: https://github.com/apache/incubator-doris/pull/2167#discussion_r344531330
########## File path: fe/src/main/java/org/apache/doris/catalog/Catalog.java ########## @@ -5738,11 +5739,17 @@ public long loadCluster(DataInputStream dis, long checksum) throws IOException, // for adding BE to some Cluster, but loadCluster is after loadBackend. cluster.setBackendIdList(latestBackendIds); - final InfoSchemaDb db = new InfoSchemaDb(cluster.getName()); - db.setClusterName(cluster.getName()); - idToDb.put(db.getId(), db); - fullNameToDb.put(db.getFullName(), db); - cluster.addDb(db.getFullName(), db.getId()); + String dbName = ClusterNamespace.getFullName(cluster.getName(), InfoSchemaDb.DATABASE_NAME); + if (!fullNameToDb.containsKey(dbName)) { + final InfoSchemaDb db = new InfoSchemaDb(cluster.getName()); + db.setClusterName(cluster.getName()); + String errMsg = "InfoSchemaDb id shouldn't larger than 10000, please restart your FE server"; + // ensure InfoSchemaDb meta don't overwrite the normal db meta + Preconditions.checkState(db.getId() < NEXT_ID_INIT_VALUE, errMsg); + idToDb.put(db.getId(), db); + fullNameToDb.put(db.getFullName(), db); + } + cluster.addDb(dbName, fullNameToDb.get(dbName).getId()); Review comment: How do you guarantee that the InfoSchemaDb you created here has id less than NEXT_ID_INIT_VALUE? And I think since you've already changed the `saveDb()` method, which will skip InfoSchemaDb by name, not by ID. Here we do not need to check the ID anymore. ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org