8000 [BugFix] Fix some corner cases when mv meets schema changes (backport #60079) by mergify[bot] · Pull Request #60135 · StarRocks/starrocks · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[BugFix] Fix some corner cases when mv meets schema changes (backport #60079) #60135

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

Merged
merged 4 commits into from
Jun 20, 2025

Conversation

mergify[bot]
Copy link
Contributor
@mergify mergify bot commented Jun 20, 2025

Why I'm doing:

When I tests MV with schema changes, I meets some unexpected bahaivors as below.

What I'm doing:

  • ColumnRename should inactive affected mvs
  • ReorderColumnsClause should inactive affected mvs
  • When MV has been dropped, remove its metrics from MaterializedViewMetricsRegistry
  • Disable MV rewrite when mv is inactive
  • Try catch exception in MaterializedViewTransparentRewriteRule.java when transparent mv is enabled.
  • Use deriveLogicalProperty after MaterializedViewTransparentRewriteRule executes
  • MvUtils.getTable and MvUtils.getTableWithIdentifier should handle NoSuchObjectException exception when hive table has been dropped
            //  msg: NoSuchObjectException: hive_db_8b48cd2f_4bfe_11f0_bc1a_00163e09349d.t1 table not found
            //        at com.starrocks.connector.hive.HiveMetaClient.callRPC(HiveMetaClient.java:178)
            //        at com.starrocks.connector.hive.HiveMetaClient.callRPC(HiveMetaClient.java:163)
            //        at com.starrocks.connector.hive.HiveMetaClient.getTable(HiveMetaClient.java:272)
            //        at com.starrocks.connector.hive.HiveMetastore.getTable(HiveMetastore.java:116)
            //        at com.starrocks.connector.hive.CachingHiveMetastore.loadTable(CachingHiveMetastore.java:311)
            //        at com.google.common.cache.CacheLoader$FunctionToCacheLoader.load(CacheLoader.java:169)
            //        at com.google.common.cache.CacheLoader$1.load(CacheLoader.java:192)
            //        at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3570)
            //        at com.starrocks.connector.hive.HiveMetaClient.callRPC(HiveMetaClient.java:163)
            //        at com.starrocks.connector.hive.HiveMetaClient.getTable(HiveMetaClient.java:272)
            //        at com.starrocks.connector.hive.HiveMetastore.getTable(HiveMetastore.java:116)
            //        at com.starrocks.connector.hive.CachingHiveMetastore.loadTable(CachingHiveMetastore.java:311)
            //        at com.google.common.cache.CacheLoader$FunctionToCacheLoader.load(CacheLoader.java:169)
            //        at com.google.common.cache.CacheLoader$1.load(CacheLoader.java:192)
            //        at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3570)
            //        at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2312)
            //        at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2189)
            //        at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2079)
            //        at com.google.common.cache.LocalCache.get(LocalCache.java:4011)
            //        at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:4034)
            //        at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:5010)
            //        at com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:5017)
            //        at com.starrocks.connector.metastore.CachingMetastore.get(CachingMetastore.java:88)
            //        at com.starrocks.connector.hive.CachingHiveMetastore.getTable(CachingHiveMetastore.java:303)
            //        at com.starrocks.connector.hive.CachingHiveMetastore.loadTable(CachingHiveMetastore.java:311)
            //        at com.google.common.cache.CacheLoader$FunctionToCacheLoader.load(CacheLoader.java:169)
            //        at com.google.common.cache.CacheLoader$1.load(CacheLoader.java:192)
            //        at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3570)
            //        at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2312)
            //        at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2189)
            //        at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2079)
            //        at com.google.common.cache.LocalCache.get(LocalCache.java:4011)
            //        at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:4034)
            //        at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:5010)
            //        at com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:5017)
            //        at com.starrocks.connector.metastore.CachingMetastore.get(CachingMetastore.java:88)
            //        at com.starrocks.connector.hive.CachingHiveMetastore.getTable(CachingHiveMetastore.java:303)
            //        at com.starrocks.connector.hive.HiveMetastoreOperations.getTable(HiveMetastoreOperations.java:250)
            //        at com.starrocks.connector.hive.HiveMetadata.getTable(HiveMetadata.java:206)
            //        at com.starrocks.connector.CatalogConnectorMetadata.getTable(CatalogConnectorMetadata.java:148)
            //        at com.starrocks.server.MetadataMgr.lambda$getTable$5(MetadataMgr.java:502)
            //        at java.base/java.util.Optional.map(Optional.java:260)
            //        at com.starrocks.server.MetadataMgr.getTable(MetadataMgr.java:502)
            //        at com.starrocks.server.MetadataMgr.getTable(MetadataMgr.java:543)
            //        at com.starrocks.sql.optimizer.rule.transformation.materialization.MvUtils.getTable(MvUtils.java:1380)
            //        at com.starrocks.qe.ShowExecutor$ShowExecutorVisitor.lambda$visitShowMaterializedViewStatement$0(ShowExecutor.java:371)
            //        at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625)
            //        at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762)
            //        at com.starrocks.qe.ShowExecutor$ShowExecutorVisitor.visitShowMaterializedViewStatement(ShowExecutor.java:369)
            //        at com.starrocks.qe.ShowExecutor$ShowExecutorVisitor.visitShowMaterializedViewStatement(ShowExecutor.java:319)
            //        at com.starrocks.sql.ast.ShowMaterializedViewsStmt.accept(ShowMaterializedViewsStmt.java:178)

Fixes https://github.com/StarRocks/StarRocksTest/pull/9829

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

Bugfix cherry-pick branch check:

  • I have checked the version labels which the pr will be auto-backported to the target branch
    • 3.5
    • 3.4
    • 3.3

This is an automatic backport of pull request #60079 done by [Mergify](https://mergify.com).

Signed-off-by: shuming.li <ming.moriarty@gmail.com>
(cherry picked from commit 0e8a2cd)

# Conflicts:
#	fe/fe-core/src/main/java/com/starrocks/common/MaterializedViewExceptions.java
#	fe/fe-core/src/main/java/com/starrocks/sql/optimizer/QueryOptimizer.java
#	fe/fe-core/src/main/java/com/starrocks/sql/optimizer/rule/transformation/materialization/MvUtils.java
@mergify mergify bot added the conflicts label Jun 20, 2025
Copy link
Contributor Author
mergify bot commented Jun 20, 2025

Cherry-pick of 0e8a2cd has failed:

On branch mergify/bp/branch-3.4/pr-60079
Your branch is up to date with 'origin/branch-3.4'.

You are currently cherry-picking commit 0e8a2cd13f.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	modified:   fe/fe-core/src/main/java/com/starrocks/alter/AlterJobExecutor.java
	modified:   fe/fe-core/src/main/java/com/starrocks/alter/SchemaChangeHandler.java
	modified:   fe/fe-core/src/main/java/com/starrocks/catalog/MaterializedView.java
	modified:   fe/fe-core/src/main/java/com/starrocks/metric/MaterializedViewMetricsRegistry.java
	modified:   fe/fe-core/src/main/java/com/starrocks/scheduler/mv/MVPCTMetaRepairer.java
	modified:   fe/fe-core/src/main/java/com/starrocks/sql/optimizer/rule/transformation/MaterializedViewTransparentRewriteRule.java
	modified:   fe/fe-core/src/test/java/com/starrocks/sql/optimizer/rule/transformation/materialization/MvRewriteMetricsTest.java

Unmerged paths:
  (use "git add/rm <file>..." as appropriate to mark resolution)
	both modified:   fe/fe-core/src/main/java/com/starrocks/common/MaterializedViewExceptions.java
	deleted by us:   fe/fe-core/src/main/java/com/starrocks/sql/optimizer/QueryOptimizer.java
	both modified:   fe/fe-core/src/main/java/com/starrocks/sql/optimizer/rule/transformation/materialization/MvUtils.java

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

@wanpengfei-git wanpengfei-git enabled auto-merge (squash) June 20, 2025 08:20
@mergify mergify bot closed this Jun 20, 2025
auto-merge was automatically disabled June 20, 2025 08:20

Pull request was closed

Copy link
Contributor Author
mergify bot commented Jun 20, 2025

@mergify[bot]: Backport conflict, please reslove the conflict and resubmit the pr

Signed-off-by: shuming.li <ming.moriarty@gmail.com>
@LiShuMing LiShuMing reopened this Jun 20, 2025
@wanpengfei-git wanpengfei-git enabled auto-merge (squash) June 20, 2025 09:58
Signed-off-by: shuming.li <ming.moriarty@gmail.com>
Signed-off-by: shuming.li <ming.moriarty@gmail.com>
@wanpengfei-git wanpengfei-git merged commit 01661dc into branch-3.4 Jun 20, 2025
27 of 28 checks passed
@wanpengfei-git wanpengfei-git deleted the mergify/bp/branch-3.4/pr-60079 branch June 20, 2025 11:15
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.

2 participants
0