Skip to content

Commit fc3eeb5

Browse files
mergify[bot]Youngwbclaude
authored
[Refactor] Remove IVM FULL refresh mode (backport #72288) (#72321)
Signed-off-by: Youngwb <yangwenbo_mailbox@163.com> Co-authored-by: Youngwb <yangwenbo_mailbox@163.com> Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 768887b commit fc3eeb5

11 files changed

Lines changed: 4 additions & 541 deletions

File tree

docs/en/sql-reference/sql-statements/materialized_view/CREATE_MATERIALIZED_VIEW.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,6 @@ Properties of the asynchronous materialized view. You can modify the properties
407407

408408
- `PCT`: (Default) For partitioned materialized views, only the affected partition is refreshed when there is a data change, ensuring result consistency for that partition. For non-partitioned materialized views, any data change in the base table triggers a full refresh of the materialized view.
409409
- `INCREMENTAL`: Ensures that only incremental refreshes are performed. If the materialized view does not support incremental refresh based on its definition or encounters non-incremental data, creation or refresh will fail.
410-
- `FULL`: Forces a full refresh of all data every time, regardless of whether the materialized view supports incremental or partition-level refresh.
411410

412411
<MVWarehouse />
413412

docs/ja/sql-reference/sql-statements/materialized_view/CREATE_MATERIALIZED_VIEW.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,6 @@ ALTER MATERIALIZED VIEW <mv_name> SET ("bloom_filter_columns" = "");
410410

411411
- `PCT`: (デフォルト)パーティション化されたマテリアライズドビューの場合、ベーステーブルにデータの変更があると影響を受けたパーティションのみリフレッシュされ、そのパーティションの結果の一貫性が保証されます。パーティション化されていないマテリアライズドビューの場合、ベーステーブルのいずれかが変更されるとマテリアライズドビュー全体がフルリフレッシュされます。
412412
- `INCREMENTAL`: 増分リフレッシュのみを行うことを保証します。マテリアライズドビューの定義で増分リフレッシュがサポートされていない場合や、非増分データに遭遇した場合、作成やリフレッシュが失敗します。
413-
- `FULL`: マテリアライズドビューが増分やパーティション単位のリフレッシュをサポートしているかどうかに関係なく、毎回全データのフルリフレッシュを強制します。
414413

415414
<MVWarehouse />
416415

docs/zh/sql-reference/sql-statements/materialized_view/CREATE_MATERIALIZED_VIEW.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,6 @@ ALTER MATERIALIZED VIEW <mv_name> SET ("bloom_filter_columns" = "");
404404

405405
- `PCT`:(默认)对于分区物化视图,当基表数据发生变化时,仅刷新受影响的分区,保证该分区的数据一致性。对于非分区物化视图,基表任何数据变化都会触发全量刷新。
406406
- `INCREMENTAL`:仅允许进行增量刷新。如果根据定义物化视图不支持增量刷新,或遇到无法增量处理的数据,则创建或刷新的操作会失败。
407-
- `FULL`:每次都强制进行全量刷新,无论物化视图是否支持增量刷新或分区级刷新。
408407

409408
<MVWarehouse />
410409

fe/fe-core/src/main/java/com/starrocks/catalog/MaterializedView.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -197,10 +197,6 @@ public enum RefreshMode {
197197
* the last refresh.
198198
*/
199199
PCT,
200-
/**
201-
* FULL: Full refresh mode, refresh all partitions of the materialized view.
202-
*/
203-
FULL,
204200
/**
205201
* INCREMENTAL: Incremental refresh mode, only refresh the incremental changed rows since the last refresh.
206202
*/
@@ -218,10 +214,6 @@ public boolean isIncremental() {
218214
return this == INCREMENTAL;
219215
}
220216

221-
public boolean isFull() {
222-
return this == FULL;
223-
}
224-
225217
public boolean isIncrementalOrAuto() {
226218
return this == INCREMENTAL || this == AUTO;
227219
}

fe/fe-core/src/main/java/com/starrocks/scheduler/mv/MVRefreshProcessor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,7 @@ protected void refreshExternalTable(Map<BaseTableSnapshotInfo, PCellSortedSet> b
708708
if (currentRefreshMode.isIncremental()) {
709709
throw new SemanticException("Materialized view %s.%s refresh failed: base table %s schema " +
710710
"or identity changed, cannot do incremental refresh in %s mode. " +
711-
"Please trigger a full refresh.",
711+
"Please drop and re-create the materialized view.",
712712
db.getFullName(), mv.getName(), baseTableInfo.getTableInfoStr(), currentRefreshMode);
713713
}
714714
toRepairTables.add(Pair.create(newTable, baseTableInfo));

fe/fe-core/src/main/java/com/starrocks/scheduler/mv/MVRefreshProcessorFactory.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,10 @@
1818
import com.starrocks.catalog.MaterializedView;
1919
import com.starrocks.metric.IMaterializedViewMetricsEntity;
2020
import com.starrocks.scheduler.MvTaskRunContext;
21-
import com.starrocks.scheduler.TaskRun;
2221
import com.starrocks.scheduler.mv.hybrid.MVHybridRefreshProcessor;
2322
import com.starrocks.scheduler.mv.ivm.MVIVMRefreshProcessor;
2423
import com.starrocks.scheduler.mv.pct.MVPCTRefreshProcessor;
2524

26-
import java.util.Map;
27-
2825
public class MVRefreshProcessorFactory {
2926
public static final MVRefreshProcessorFactory INSTANCE = new MVRefreshProcessorFactory();
3027

@@ -37,12 +34,6 @@ public MVRefreshProcessor newProcessor(Database db, MaterializedView mv,
3734
return new MVIVMRefreshProcessor(db, mv, mvContext, mvEntity, refreshMode);
3835
case AUTO:
3936
return new MVHybridRefreshProcessor(db, mv, mvContext, mvEntity, refreshMode);
40-
case FULL: {
41-
// full refresh
42-
Map<String, String> props = mvContext.getProperties();
43-
props.put(TaskRun.FORCE, "true");
44-
return new MVPCTRefreshProcessor(db, mv, mvContext, mvEntity, refreshMode);
45-
}
4637
default:
4738
return new MVPCTRefreshProcessor(db, mv, mvContext, mvEntity, refreshMode);
4839
}

fe/fe-core/src/test/java/com/starrocks/alter/AlterMVJobExecutorEditLogTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -447,9 +447,9 @@ public void testVisitModifyTablePropertiesClausePartitionRefreshStrategyNormalCa
447447

448448
@Test
449449
public void testVisitModifyTablePropertiesClauseMvRefreshModeNormalCase() throws Exception {
450-
// Test PROPERTIES_MV_REFRESH_MODE - valid values: AUTO, PCT, FULL, INCREMENTAL
451-
// Use FULL as it doesn't have additional constraints like AUTO/INCREMENTAL
452-
testPropertyNormalCase(PropertyAnalyzer.PROPERTIES_MV_REFRESH_MODE, "FULL");
450+
// Test PROPERTIES_MV_REFRESH_MODE - valid values: AUTO, PCT, INCREMENTAL
451+
// Use PCT as it doesn't have additional constraints like AUTO/INCREMENTAL
452+
testPropertyNormalCase(PropertyAnalyzer.PROPERTIES_MV_REFRESH_MODE, "PCT");
453453
}
454454

455455
@Test

fe/fe-core/src/test/java/com/starrocks/alter/AlterMaterializedViewTest.java

Lines changed: 0 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,6 @@ public void testChangeMVRefreshMode1() throws Exception {
6464
alterMaterializedView(alterStmt, false);
6565
Assertions.assertEquals(MaterializedView.RefreshMode.AUTO, mv.getCurrentRefreshMode());
6666
}
67-
// change refresh mode from auto to full
68-
{
69-
String alterStmt = "alter materialized view test_mv1 set (\"refresh_mode\" = \"full\")";
70-
alterMaterializedView(alterStmt, false);
71-
Assertions.assertEquals(MaterializedView.RefreshMode.FULL, mv.getCurrentRefreshMode());
72-
}
7367
}
7468

7569
@Test
@@ -90,12 +84,6 @@ public void testChangeMVRefreshMode2() throws Exception {
9084
alterMaterializedView(alterStmt, true);
9185
Assertions.assertEquals(MaterializedView.RefreshMode.PCT, mv.getCurrentRefreshMode());
9286
}
93-
// change refresh mode to full
94-
{
95-
String alterStmt = "alter materialized view test_mv1 set (\"refresh_mode\" = \"full\")";
96-
alterMaterializedView(alterStmt, false);
97-
Assertions.assertEquals(MaterializedView.RefreshMode.FULL, mv.getCurrentRefreshMode());
98-
}
9987
}
10088

10189
@Test
@@ -116,64 +104,6 @@ public void testChangeMVRefreshMode3() throws Exception {
116104
alterMaterializedView(alterStmt, false);
117105
Assertions.assertEquals(MaterializedView.RefreshMode.AUTO, mv.getCurrentRefreshMode());
118106
}
119-
// change refresh mode from auto to full
120-
{
121-
String alterStmt = "alter materialized view test_mv1 set (\"refresh_mode\" = \"full\")";
122-
alterMaterializedView(alterStmt, false);
123-
Assertions.assertEquals(MaterializedView.RefreshMode.FULL, mv.getCurrentRefreshMode());
124-
}
125-
}
126-
127-
@Test
128-
public void testChangeMVRefreshMode4() throws Exception {
129-
String query = "SELECT id, data, date FROM `iceberg0`.`unpartitioned_db`.`t0` as a;";
130-
MaterializedView mv = createMaterializedViewWithRefreshMode(query, "full");
131-
Assertions.assertEquals(MaterializedView.RefreshMode.FULL, mv.getCurrentRefreshMode());
132-
133-
// change refresh mode from auto to incremental
134-
{
135-
String alterStmt = "alter materialized view test_mv1 set (\"refresh_mode\" = \"incremental\")";
136-
alterMaterializedView(alterStmt, true);
137-
Assertions.assertEquals(MaterializedView.RefreshMode.FULL, mv.getCurrentRefreshMode());
138-
}
139-
// change refresh mode from incremental to auto
140-
{
141-
String alterStmt = "alter materialized view test_mv1 set (\"refresh_mode\" = \"auto\")";
142-
alterMaterializedView(alterStmt, true);
143-
Assertions.assertEquals(MaterializedView.RefreshMode.FULL, mv.getCurrentRefreshMode());
144-
}
145-
// change refresh mode from auto to full
146-
{
147-
String alterStmt = "alter materialized view test_mv1 set (\"refresh_mode\" = \"full\")";
148-
alterMaterializedView(alterStmt, false);
149-
Assertions.assertEquals(MaterializedView.RefreshMode.FULL, mv.getCurrentRefreshMode());
150-
}
151-
}
152-
153-
@Test
154-
public void testChangeMVRefreshMode5() throws Exception {
155-
String query = "SELECT id, count(data) over (partition by date) FROM `iceberg0`.`unpartitioned_db`.`t0` as a;";
156-
MaterializedView mv = createMaterializedViewWithRefreshMode(query, "full");
157-
Assertions.assertEquals(MaterializedView.RefreshMode.FULL, mv.getCurrentRefreshMode());
158-
159-
// change refresh mode from auto to incremental
160-
{
161-
String alterStmt = "alter materialized view test_mv1 set (\"refresh_mode\" = \"incremental\")";
162-
alterMaterializedView(alterStmt, true);
163-
Assertions.assertEquals(MaterializedView.RefreshMode.FULL, mv.getCurrentRefreshMode());
164-
}
165-
// change refresh mode to auto
166-
{
167-
String alterStmt = "alter materialized view test_mv1 set (\"refresh_mode\" = \"auto\")";
168-
alterMaterializedView(alterStmt, true);
169-
Assertions.assertEquals(MaterializedView.RefreshMode.FULL, mv.getCurrentRefreshMode());
170-
}
171-
// change refresh mode to full
172-
{
173-
String alterStmt = "alter materialized view test_mv1 set (\"refresh_mode\" = \"full\")";
174-
alterMaterializedView(alterStmt, false);
175-
Assertions.assertEquals(MaterializedView.RefreshMode.FULL, mv.getCurrentRefreshMode());
176-
}
177107
}
178108

179109
@Test
@@ -194,12 +124,6 @@ public void testChangeMVRefreshMode6() throws Exception {
194124
alterMaterializedView(alterStmt, true);
195125
Assertions.assertEquals(MaterializedView.RefreshMode.PCT, mv.getCurrentRefreshMode());
196126
}
197-
// change refresh mode from auto to full
198-
{
199-
String alterStmt = "alter materialized view test_mv1 set (\"refresh_mode\" = \"full\")";
200-
alterMaterializedView(alterStmt, false);
201-
Assertions.assertEquals(MaterializedView.RefreshMode.FULL, mv.getCurrentRefreshMode());
202-
}
203127
}
204128

205129
@Test
@@ -220,12 +144,6 @@ public void testChangeMVRefreshMode7() throws Exception {
220144
alterMaterializedView(alterStmt, true);
221145
Assertions.assertEquals(MaterializedView.RefreshMode.PCT, mv.getCurrentRefreshMode());
222146
}
223-
// change refresh mode to full
224-
{
225-
String alterStmt = "alter materialized view test_mv1 set (\"refresh_mode\" = \"full\")";
226-
alterMaterializedView(alterStmt, false);
227-
Assertions.assertEquals(MaterializedView.RefreshMode.FULL, mv.getCurrentRefreshMode());
228-
}
229147
}
230148

231149
@Test

fe/fe-core/src/test/java/com/starrocks/scheduler/mv/ivm/IVMBasedMvRefreshProcessorIcebergTest.java

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -419,20 +419,6 @@ public void testIncrementalRefreshWithScanOperator() throws Exception {
419419
Assertions.assertEquals(MaterializedView.RefreshMode.INCREMENTAL, mv.getCurrentRefreshMode());
420420
}
421421

422-
@Test
423-
public void testFullRefreshWithScanOperator() throws Exception {
424-
String query = "SELECT id, data, date FROM `iceberg0`.`unpartitioned_db`.`t0` as a;";
425-
MaterializedView mv = createMaterializedViewWithRefreshMode(query, "full");
426-
Assertions.assertEquals(MaterializedView.RefreshMode.FULL, mv.getCurrentRefreshMode());
427-
}
428-
429-
@Test
430-
public void testFullRefreshWithTableFunctionOperator() throws Exception {
431-
String query = "SELECT id, unnest FROM `iceberg0`.`unpartitioned_db`.`t0` as a, unnest(split(data, ','));";
432-
MaterializedView mv = createMaterializedViewWithRefreshMode(query, "full");
433-
Assertions.assertEquals(MaterializedView.RefreshMode.FULL, mv.getCurrentRefreshMode());
434-
}
435-
436422
@Test
437423
public void testAutoRefreshWithScanOperator() throws Exception {
438424
String query = "SELECT id, data, date FROM `iceberg0`.`unpartitioned_db`.`t0` as a;";
@@ -448,13 +434,6 @@ public void testIncrementalRefreshWithOlapScanOperator() throws Exception {
448434
});
449435
}
450436

451-
@Test
452-
public void testFullRefreshWithOlapScanOperator() throws Exception {
453-
String query = "SELECT * from emps;";
454-
MaterializedView mv = createMaterializedViewWithRefreshMode(query, "full");
455-
Assertions.assertEquals(MaterializedView.RefreshMode.FULL, mv.getCurrentRefreshMode());
456-
}
457-
458437
@Test
459438
public void testAutoRefreshWithOlapScanOperator() throws Exception {
460439
String query = "SELECT * from emps;";

0 commit comments

Comments
 (0)