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 560 #579

Merged
merged 1 commit into from
Dec 19, 2024
Merged

Fix 560 #579

merged 1 commit into from
Dec 19, 2024

Conversation

MonkeyCanCode
Copy link
Contributor

The issue arises because the second curl command does not return the correct status code due to the behavior of getOrCreateSessionSupplier. When a realm is not found, the method triggers realm initialization. However, realm initialization only partially bootstraps the setup (it creates the sequence object with default and populated tables but no data). As a result, when the second curl command is executed, it attempts credential validation instead of the expected check, since the schema for the required tables is created during the realm initialization.

To ensure consistent error handling and avoid premature credential validation, this PR adds an additional check to verify that the realm is fully bootstrapped before proceeding with credential validation.

@snazy
Copy link
Member

snazy commented Dec 18, 2024

Thanks @MonkeyCanCode. However, after applying this fix (and tentative ones for #561 + #562), I'm not sure whether it's worth to fix it now. I think it makes more sense to wait until #469 has landed, because it will clean up a bunch of things. Not sure about this particular one, but let's wait and see what @adutra thinks.

Comment on lines 138 to 144
initializeForRealm(realmContext);
checkPolarisServiceBootstrappedForRealm(
realmContext, metaStoreManagerMap.get(realmContext.getRealmIdentifier()));
} else {
checkPolarisServiceBootstrappedForRealm(
realmContext, metaStoreManagerMap.get(realmContext.getRealmIdentifier()));
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
initializeForRealm(realmContext);
checkPolarisServiceBootstrappedForRealm(
realmContext, metaStoreManagerMap.get(realmContext.getRealmIdentifier()));
} else {
checkPolarisServiceBootstrappedForRealm(
realmContext, metaStoreManagerMap.get(realmContext.getRealmIdentifier()));
}
initializeForRealm(realmContext);
}
checkPolarisServiceBootstrappedForRealm(
realmContext, metaStoreManagerMap.get(realmContext.getRealmIdentifier()));

@adutra
Copy link
Contributor

adutra commented Dec 19, 2024

Thanks @MonkeyCanCode. However, after applying this fix (and tentative ones for #561 + #562), I'm not sure whether it's worth to fix it now. I think it makes more sense to wait until #469 has landed, because it will clean up a bunch of things. Not sure about this particular one, but let's wait and see what @adutra thinks.

I'd say let's get this in, as I think the race condition would be possible even after the switch to Quarkus (the switch doesn't change the logic in LocalPolarisMetaStoreManagerFactory.

@adutra adutra merged commit b069591 into apache:main Dec 19, 2024
5 checks passed
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.

3 participants