Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Cluster meta write error #1802

Merged
merged 2 commits into from Sep 13, 2019
Merged

Fix Cluster meta write error #1802

merged 2 commits into from Sep 13, 2019

Conversation

kangkaisen
Copy link
Contributor

For #1801

@@ -128,6 +129,7 @@ public void addDb(String name, long id) {
try {
dbNames.add(name);
dbIds.add(id);
dbNameToIDs.put(name, id);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need to rebuild the dbNameToIDs in readFields() function when replaying meta log?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we needn't.

After Cluster readFields, we will construct a new InfoSchemaDb and add it to Cluster immediately.

    public long loadCluster(DataInputStream dis, long checksum) throws IOException, DdlException {
        if (Catalog.getCurrentCatalogJournalVersion() >= FeMetaVersion.VERSION_30) {
            int clusterCount = dis.readInt();
            checksum ^= clusterCount;
            for (long i = 0; i < clusterCount; ++i) {
                final Cluster cluster = Cluster.read(dis);
                ...
                final InfoSchemaDb db = new InfoSchemaDb(cluster.getName());
                ...
                cluster.addDb(db.getFullName(), db.getId());

Copy link
Contributor

@imay imay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@imay imay merged commit dcea6da into apache:master Sep 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants