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

Feature 1665 k8s db auto update #1691

Merged
merged 4 commits into from
Sep 18, 2023
Merged

Conversation

artntek
Copy link
Contributor

@artntek artntek commented Sep 16, 2023

  1. Pulled out Member Node initialization from metacat servlet into its own class (K8sAdminInitializer) and did same for unit tests
  2. In this new class, also added automatic database initialization when running under k8s (and added tests for this)
  3. Removed hacky curl method of logging into admin and running DB updates from docker-entrypoint.sh

mcVerStr = metacatVersion.getVersionString();
dbVersion = DBAdmin.getInstance().getDBVersion();
dbVerStr = dbVersion.getVersionString();
if (metacatVersion.compareTo(dbVersion) == 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to consider the scenario that the metacat version is less than the db version?

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 adopted the same logic as that used in the DB admin page, since the DBAdmin::upgradeDatabase() method calls DBAdmin.getUpdateScripts(), which iterates through the DB versions and figures out which updates need to be applied (and so it takes care of the cases where DB < metacat, and DB > Metacat).

I think that's a good approach, because the logic is in one place (DBAdmin.getUpdateScripts()) instead of three places, and if we ever decide to support downgrades, we can do that simply by changing DBAdmin, without changing the calling code.

What do you think?

@taojing2002
Copy link
Contributor

taojing2002 commented Sep 18, 2023 via email

@artntek artntek merged commit b3ff5a6 into develop Sep 18, 2023
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

2 participants