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

[BugFix]: Upgrade Not getting applied to System Tenant #14990

Merged
merged 1 commit into from
Mar 15, 2024

Conversation

arjunsk
Copy link
Contributor

@arjunsk arjunsk commented Mar 15, 2024

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

issue ##14846

What this PR does / why we need it:

Previously system tenant had access to all the column names of "mo_catalog.mo_indexes" via "INFORMATION_SCHEMA.COLUMNS".

mysql> SELECT COLUMN_NAME, COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA ="mo_catalog" AND TABLE_NAME ="mo_indexes" GROUP BY COLUMN_NAME;
+------------------+----------+
| column_name      | count(*) |
+------------------+----------+
| __mo_cpkey_col   |       35 |
| column_name      |       35 |
| comment          |       35 |
| database_id      |       35 |
| hidden           |       35 |
| id               |       35 |
| index_table_name |       35 |
| is_visible       |       35 |
| name             |       35 |
| options          |       35 |
| ordinal_position |       35 |
| table_id         |       35 |
| type             |       35 |
| algo             |       34 |<-------
| algo_params      |       34 |<-------
| algo_table_type  |       34 |<-------
+------------------+----------+

Due to this, algo column though not present in mo_catalog.mo_indexes of the system tenant, was shown as present. Hence upgrade logic for system tenant was skipped.

To prevent this from happening, we are using mo_catalog.mo_columns, which has account_id field showing the tenant information. We make sure that, the even system tenant sees the columns of its own tenant id. This ensures the column's absence and will trigger the Upgrade Logic.

@arjunsk arjunsk self-assigned this Mar 15, 2024
@mergify mergify bot requested a review from sukki37 March 15, 2024 07:39
@mergify mergify bot added the kind/bug Something isn't working label Mar 15, 2024
@matrix-meow matrix-meow added the size/S Denotes a PR that changes [10,99] lines label Mar 15, 2024
@mergify mergify bot merged commit 50a4657 into matrixorigin:1.1-dev Mar 15, 2024
22 of 23 checks passed
@arjunsk arjunsk deleted the bug/1.1-dev_upgrade_failure branch March 15, 2024 09:29
mergify bot pushed a commit that referenced this pull request Mar 20, 2024
…nant (#15021)

- Cherry Pick PR #14990 to Master.
- Added Extra logic to skip calling `Foreign Key` Logic during Upgrade operation.

Approved by: @reusee, @daviszhen, @aunjgr, @nnsgmsone
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working size/S Denotes a PR that changes [10,99] lines
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants