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

[Enhancement] Display inactive reason for materialized view #21591

Merged
merged 12 commits into from
May 22, 2023

Conversation

murphyatwork
Copy link
Contributor

What type of PR is this:

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

Which issues of this PR fixes :

Fixes #21501

Problem Summary(Required) :

***************************[ 2. row ]***************************
MATERIALIZED_VIEW_ID                 | 90079
TABLE_SCHEMA                         | hehe
TABLE_NAME                           | mv_foo
REFRESH_TYPE                         | INCREMENTAL
IS_ACTIVE                            | false
INACTIVE_REASON                      | base table dropped: 10087
PARTITION_TYPE                       | UNPARTITIONED
TASK_ID                              |
TASK_NAME                            |
LAST_REFRESH_START_TIME              |
LAST_REFRESH_FINISHED_TIME           |
LAST_REFRESH_DURATION                |
LAST_REFRESH_STATE                   |
LAST_REFRESH_FORCE_REFRESH           |
LAST_REFRESH_START_PARTITION         |
LAST_REFRESH_END_PARTITION           |
LAST_REFRESH_BASE_REFRESH_PARTITIONS |
LAST_REFRESH_MV_REFRESH_PARTITIONS   |
LAST_REFRESH_ERROR_CODE              |
LAST_REFRESH_ERROR_MESSAGE           |
TABLE_ROWS                           | CREATE MATERIALIZED VIEW `mv_foo`
COMMENT "MATERIALIZED_VIEW"
DISTRIBUTED BY HASH(`id`) BUCKETS 2
REFRESH INCREMENTAL
PROPERTIES (
"replication_num" = "1",
"storage_medium" = "HDD"
)
AS SELECT `hehe`.`id`
FROM `hehe`.`hehe`;

Checklist:

  • I have added test cases for my bug fix or my new feature
  • This pr will affect users' behaviors
  • This pr needs user documentation (for new or modified features or behaviors)
    • I have added documentation for my new feature or new function

Bugfix cherry-pick branch check:

  • I have checked the version labels which the pr will be auto backported to target branch
    • 3.0
    • 2.5
    • 2.4
    • 2.3

@murphyatwork murphyatwork enabled auto-merge (squash) April 13, 2023 23:37
@github-actions github-actions bot added the 3.0 label Apr 13, 2023
LiShuMing
LiShuMing previously approved these changes Apr 14, 2023
Copy link
Contributor

@LiShuMing LiShuMing left a comment

Choose a reason for hiding this comment

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

Good Work~

LOG.warn("Setting the materialized view {}({}) to invalid because " +
"the table {} was renamed.", mv.getName(), mv.getId(), olapTable.getName());
mv.setActive(false);
mv.setInactiveAndReason("base table renamed: " + olapTable.getName());
Copy link
Contributor

Choose a reason for hiding this comment

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

better to keep the log

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Astralidea
Astralidea previously approved these changes May 17, 2023
@murphyatwork
Copy link
Contributor Author

@Mergifyio rebase

@mergify
Copy link
Contributor

mergify bot commented May 17, 2023

rebase

✅ Branch has been successfully rebased

Astralidea
Astralidea previously approved these changes May 18, 2023
@murphyatwork
Copy link
Contributor Author

@Mergifyio rebase

Signed-off-by: Murphy <[email protected]>
Signed-off-by: Murphy <[email protected]>
Signed-off-by: Murphy <[email protected]>
Signed-off-by: Murphy <[email protected]>
Signed-off-by: Murphy <[email protected]>
Signed-off-by: Murphy <[email protected]>
Signed-off-by: Murphy <[email protected]>
@mergify
Copy link
Contributor

mergify bot commented May 19, 2023

rebase

✅ Branch has been successfully rebased

@sonarcloud
Copy link

sonarcloud bot commented May 19, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 7 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@wanpengfei-git
Copy link
Collaborator

[FE PR Coverage Check]

😞 fail : 16 / 37 (43.24%)

file detail

path covered_line new_line coverage not_covered_line_detail
🔵 com/starrocks/service/FrontendServiceImpl.java 0 16 00.00% [506, 507, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 521, 522, 524]
🔵 com/starrocks/server/GlobalStateMgr.java 0 2 00.00% [1567, 1575]
🔵 com/starrocks/qe/ShowExecutor.java 1 2 50.00% [567]
🔵 com/starrocks/catalog/MaterializedView.java 5 7 71.43% [675, 1071]
🔵 com/starrocks/catalog/OlapTable.java 1 1 100.00% []
🔵 com/starrocks/catalog/system/information/MaterializedViewsSystemTable.java 1 1 100.00% []
🔵 com/starrocks/server/LocalMetastore.java 1 1 100.00% []
🔵 com/starrocks/alter/LakeTableSchemaChangeJob.java 3 3 100.00% []
🔵 com/starrocks/sql/ast/ShowMaterializedViewsStmt.java 1 1 100.00% []
🔵 com/starrocks/alter/SchemaChangeJobV2.java 3 3 100.00% []

Comment on lines +136 to +143
// inactive_reason
ColumnPtr column = (*chunk)->get_column_by_slot_id(slot_id);
const std::string* str = &tbl_status.inactive_reason;
Slice value(str->c_str(), str->length());
fill_column_with_slot<TYPE_VARCHAR>(column.get(), (void*)&value);
break;
}
case 7: {
Copy link
Contributor

@Seaven Seaven May 22, 2023

Choose a reason for hiding this comment

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

Will be compatibility questions with the BE upgrade?

@murphyatwork murphyatwork merged commit 7949502 into StarRocks:main May 22, 2023
@wanpengfei-git
Copy link
Collaborator

@Mergifyio backport branch-3.0

@github-actions github-actions bot removed the 3.0 label May 22, 2023
@mergify
Copy link
Contributor

mergify bot commented May 22, 2023

backport branch-3.0

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request May 22, 2023
(cherry picked from commit 7949502)

# Conflicts:
#	be/src/exec/schema_scanner/schema_materialized_views_scanner.cpp
#	fe/fe-core/src/main/java/com/starrocks/catalog/system/information/MaterializedViewsSystemTable.java
#	fe/fe-core/src/main/java/com/starrocks/server/LocalMetastore.java
#	fe/fe-core/src/main/java/com/starrocks/service/FrontendServiceImpl.java
Moonm3n pushed a commit to Moonm3n/starrocks that referenced this pull request May 23, 2023
wxl24life pushed a commit to wxl24life/starrocks that referenced this pull request May 25, 2023
abc982627271 pushed a commit to abc982627271/starrocks that referenced this pull request Jun 5, 2023
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.

Display inactive reason of materialized view
7 participants