-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[fix](catalog) fix refresh logic #52989
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
Conversation
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
|
run buildall |
TPC-H: Total hot run time: 32890 ms |
TPC-DS: Total hot run time: 186385 ms |
ClickBench: Total hot run time: 29.83 s |
abeb0a8 to
5832642
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the refresh logic across multiple layers (DDL executor, Nereids commands, metadata operations, and the log/persistence layer) to use new handleRefresh* APIs and standardized ExternalObjectLog factories.
- Unify refresh calls to
RefreshManager.handleRefresh*with explicit parameters instead of passing statement objects. - Update
ExternalObjectLogandCatalogLogto use static factory methods and remove direct setters. - Adjust metadata operations (
IcebergMetadataOps,HiveMetadataOps,ExternalCatalog, etc.) to match the new refresh signatures and log behavior.
Reviewed Changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| fe/fe-core/src/test/java/org/apache/doris/datasource/iceberg/IcebergExternalTableBranchAndTagTest.java | Updated Mockito stub to match new refreshTableInternal signature. |
| fe/fe-core/src/main/java/org/apache/doris/qe/DdlExecutor.java | Replaced statement-based refresh with parameterized handleRefreshTable/handleRefreshDb calls. |
| fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/refresh/RefreshTableCommand.java | Switched from refreshTable to handleRefreshTable. |
| fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/refresh/RefreshDatabaseCommand.java | Removed inline handleRefreshDb and replaced with manager call. |
| fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/refresh/RefreshCatalogCommand.java | Replaced inline catalog refresh with manager call. |
| fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/insert/BaseExternalTableInsertExecutor.java | Updated to call handleRefreshTable instead of refreshTable. |
| fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/IcebergMetadataOps.java | Streamlined setUnInitialized calls and added logging. |
| fe/fe-core/src/main/java/org/apache/doris/datasource/hive/HiveMetadataOps.java | Streamlined setUnInitialized calls and added logging. |
| fe/fe-core/src/main/java/org/apache/doris/datasource/ExternalObjectLog.java | Added private constructor and factory methods for log creation. |
| fe/fe-core/src/main/java/org/apache/doris/datasource/ExternalDatabase.java | Removed boolean parameter from setUnInitialized and cleared state. |
| fe/fe-core/src/main/java/org/apache/doris/datasource/ExternalCatalog.java | Removed internal invalidCacheInInit flag and adjusted cache initialization. |
| fe/fe-core/src/main/java/org/apache/doris/datasource/CatalogLog.java | Added static factory for refresh catalog logs. |
| fe/fe-core/src/main/java/org/apache/doris/catalog/RefreshManager.java | Refactored all handleRefresh* methods to use parameter lists and factory logs. |
Comments suppressed due to low confidence (2)
fe/fe-core/src/main/java/org/apache/doris/qe/DdlExecutor.java:240
- The literal
falsepassed tohandleRefreshTableignores anyIF EXISTSflag in theRefreshTableStmt. Consider usingrefreshTableStmt.isIgnoreIfNotExists()(or the appropriate method) to propagate the user's intent.
refreshTableStmt.getTblName(), false);
fe/fe-core/src/main/java/org/apache/doris/datasource/ExternalObjectLog.java:61
- Making the no-args constructor private will break GSON deserialization in
read(). You should provide a public or package-private no-args constructor for proper deserialization.
private ExternalObjectLog() {
| } | ||
| db.get().setUnInitialized(); | ||
| } | ||
| LOG.info("after drop table {}.{}.{}, is db exists: {}", |
Copilot
AI
Jul 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The log message reads "is db exists" which is grammatically awkward. Consider rephrasing to something like "db exists: {}" or "does db exist: {}".
| LOG.info("after drop table {}.{}.{}, is db exists: {}", | |
| LOG.info("after drop table {}.{}.{}, db exists: {}", |
|
run buildall |
TPC-H: Total hot run time: 33420 ms |
TPC-DS: Total hot run time: 188190 ms |
ClickBench: Total hot run time: 30.06 s |
|
PR approved by at least one committer and no changes requested. |
|
PR approved by anyone and no changes requested. |
What problem does this PR solve?
Problem Summary:
Refactor Refresh Interface and Logic
Unified the RefreshManager interface so that both the old and new statements can use the same method.
Modified the edit log for
REFRESH TABLEandREFRESH DATABASEto store database/table names instead of IDs, enabling the replayer to correctly retrieve the corresponding objects.Optimize Metadata Refresh After Create/Drop/Truncate Table
Previously, Doris would refresh the entire database and its related cache after creating, dropping, or truncating a table.
This was inefficient and unnecessary—now the logic only refreshes the cache of the affected table.
Fix a Bug in
ExternalDatabaseFixed an issue where the
lowerCaseToTableNamemap in ExternalDatabase was not cleared during refresh operations, potentially leading to stale or incorrect data remaining in the map.Release note
None
Check List (For Author)
Test
Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)