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] Fix fail to do fast schema change on tables with sync mv in shared data (backport #55859) #55897

Merged
merged 1 commit into from
Feb 18, 2025

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Feb 14, 2025

Why I'm doing:

when enable_fast_schema_evolution is set to true in shared data

create database materialized_view_test_db_770f0542_e849_11ef_9e47_00163e0e489a;
use materialized_view_test_db_770f0542_e849_11ef_9e47_00163e0e489a;
CREATE TABLE t1 (
                    k1  int,
                    k2  int,
                    k3  int,
                    k4  int)
                DUPLICATE KEY(k1)
                DISTRIBUTED BY HASH(k1) BUCKETS 3
                PROPERTIES (
                    "replication_num" = "3",
                    "storage_format" = "v2"
                );
INSERT INTO t1 VALUES (1,1,1,1),(2,2,2,2),(3,3,3,3),(4,4,4,4);
CREATE MATERIALIZED VIEW mv1 AS SELECT k1,sum(k2) AS sum_k2 FROM t1 WHERE k3>2 GROUP BY k1;
SHOW ALTER MATERIALIZED VIEW;
SHOW ALTER MATERIALIZED VIEW;
ALTER TABLE t1 DROP COLUMN k4;
SHOW ALTER TABLE COLUMN ORDER BY JobId DESC LIMIT 1;

---alter table always in pending status
mysql> SHOW ALTER TABLE COLUMN ORDER BY JobId DESC;
+--------+-----------+---------------------+------------+-----------+---------+---------------+---------------+---------------+---------+------+----------+---------+-------------------+
| JobId  | TableName | CreateTime          | FinishTime | IndexName | IndexId | OriginIndexId | SchemaVersion | TransactionId | State   | Msg  | Progress | Timeout | Warehouse         |
+--------+-----------+---------------------+------------+-----------+---------+---------------+---------------+---------------+---------+------+----------+---------+-------------------+
| 249836 | t1        | 2025-02-11 16:14:55 | NULL       | t1        | 249819  | 249819        | 1:0           | 14081         | PENDING |      | NULL     | 86400   | default_warehouse |
+--------+-----------+---------------------+------------+-----------+---------+---------------+---------------+---------------+---------+------+----------+---------+-------------------+
1 row in set (0.00 sec)

The reason is that when dropping a column, you may only need to modify the schema of partial indexes, and the task generated for the index which are not needed to modify is null.
image

What I'm doing:

The task will still be generated for the indexes which are not needed to modify to increase the version of tablet meta
Fixes

Fixes https://github.com/StarRocks/StarRocksTest/issues/9226

What type of PR is this:

  • BugFix
  • Feature
  • Enhancement
  • Refactor
  • UT
  • Doc
  • Tool

Does this PR entail a change in behavior?

  • Yes, this PR will result in a change in behavior.
  • No, this PR will not result in a change in behavior.

If yes, please specify the type of change:

  • Interface/UI changes: syntax, type conversion, expression evaluation, display information
  • Parameter changes: default values, similar parameters but with different default values
  • Policy changes: use new policy to replace old one, functionality automatically enabled
  • Feature removed
  • Miscellaneous: upgrade & downgrade compatibility, etc.

Checklist:

  • I have added test cases for my bug fix or my new feature
  • This pr needs user documentation (for new or modified features or behaviors)
    • I have added documentation for my new feature or new function
  • This is a backport pr

…shared data (#55859)

Signed-off-by: smartlxh <[email protected]>
(cherry picked from commit 4334597)
Copy link

@wanpengfei-git wanpengfei-git merged commit 21bd539 into branch-3.4 Feb 18, 2025
37 of 39 checks passed
@wanpengfei-git wanpengfei-git deleted the mergify/bp/branch-3.4/pr-55859 branch February 18, 2025 05:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants