You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2019/11/08 11:04:47 UTC
[GitHub] [incubator-doris] imay commented on a change in pull request #2167:
Fix DB meta lost bug
imay commented on a change in pull request #2167: Fix DB meta lost bug
URL: https://github.com/apache/incubator-doris/pull/2167#discussion_r344123995
##########
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:
I'm not sure why this change can fix database lost, could you please add some comment to explain 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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org