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

Support Coordinator table schema migration for the group commit in ConsensusCommitAdmin.upgrade() #2060

Merged
merged 12 commits into from
Jul 17, 2024

Conversation

komamitsu
Copy link
Contributor

@komamitsu komamitsu commented Jul 9, 2024

Description

We added the group commit feature for the Coordinator table, which adds a new column tx_child_ids to coordinator.state table. The column is supposed to be added by default in ScalarDB 4. But, there is no way for users to address the table schema migration at the moment. This PR adds the Coordinator table schema migration in ConsensusCommitAdmin.upgrade() so that users can execute the migration via Schema Loader.

Related issues and/or PRs

For ScalarDB 3.13 users, https://github.com/scalar-labs/docs-internal-scalardb/pull/130

Changes made

  • Call Admin.addNewColumnToTable(tx_child_ids) if the column doesn't exist in the current Coordinator table metadata (without checking the underlying table)
  • Add test cases

Checklist

The following is a best-effort checklist. If any items in this checklist are not applicable to this PR or are dependent on other, unmerged PRs, please still mark the checkboxes after you have read and understood each item.

  • I have commented my code, particularly in hard-to-understand areas.
  • I have updated the documentation to reflect the changes.
  • Any remaining open issues linked to this PR are documented and up-to-date (Jira, GitHub, etc.).
  • Tests (unit, integration, etc.) have been added for the changes.
  • My changes generate no new warnings.
  • Any dependent changes in other PRs have been merged and published.

Additional notes (optional)

What if any PREPARED state records created by ScalarDB 3 remain in tables when the upgrade command is executed?

The transaction ID of the PREPARE record doesn't have any prefix (e.g., a97Zb8Mxg...). The current ScalarDB 4 version Coordinator determines that the transaction ID is created with the group commit feature disabled, and treats it as a normal transaction.

Release notes

Support Coordinator table schema migration for the group commit feature in Schema Loader's upgrade command.

@komamitsu komamitsu marked this pull request as ready for review July 11, 2024 02:45
@@ -314,6 +325,7 @@ private void dropTablesIfExist() throws ExecutionException {
transactionAdmin.dropTable(namespace1, TABLE_1, true);
transactionAdmin.dropNamespace(namespace1, true);
transactionAdmin.dropCoordinatorTables(true);
waitForCreationIfNecessary();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a few waits since I noticed some tests could fail with some underlying storages

Copy link
Contributor

@feeblefakie feeblefakie left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you!

Copy link
Member

@josh-wong josh-wong left a comment

Choose a reason for hiding this comment

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

I've left some minor suggestions. Other than that, LGTM. Thank you!🙇🏻‍♂️

Copy link
Contributor

@Torch3333 Torch3333 left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

@brfrn169 brfrn169 added the enhancement New feature or request label Jul 16, 2024
Copy link
Collaborator

@brfrn169 brfrn169 left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you!

@komamitsu komamitsu merged commit 0aa7327 into master Jul 17, 2024
47 checks passed
@komamitsu komamitsu deleted the schema-loader-upgrade-coord-table-migration branch July 17, 2024 02:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants