Skip to content

Commit

Permalink
[Enhancement] add a switch to control default refresh immediate (#37093)
Browse files Browse the repository at this point in the history
Signed-off-by: Murphy <[email protected]>
(cherry picked from commit 2bd50b9)

# Conflicts:
#	fe/fe-core/src/main/java/com/starrocks/common/Config.java
#	fe/fe-core/src/main/java/com/starrocks/sql/ast/RefreshSchemeDesc.java
#	fe/fe-core/src/main/java/com/starrocks/sql/parser/AstBuilder.java
  • Loading branch information
murphyatwork authored and mergify[bot] committed Dec 15, 2023
1 parent da291d5 commit a5f702b
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 0 deletions.
37 changes: 37 additions & 0 deletions fe/fe-core/src/main/java/com/starrocks/common/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -2356,6 +2356,43 @@ public class Config extends ConfigBase {
@ConfField(mutable = true)
public static int external_table_commit_timeout_ms = 10000; // 10s

<<<<<<< HEAD
=======
@ConfField(mutable = true)
public static boolean enable_fast_schema_evolution = true;

@ConfField(mutable = false)
public static int pipe_listener_interval_millis = 1000;
@ConfField(mutable = false)
public static int pipe_scheduler_interval_millis = 1000;

@ConfField(mutable = true)
public static long mv_active_checker_interval_seconds = 60;

/**
* Whether enable to active inactive materialized views automatically by the daemon thread or not.
*/
@ConfField(mutable = true)
public static boolean enable_mv_automatic_active_check = true;

/**
* The refresh partition number when refreshing materialized view at once by default.
*/
@ConfField(mutable = true)
public static int default_mv_partition_refresh_number = 1;

@ConfField(mutable = true,
comment = "The default behavior of whether REFRESH IMMEDIATE or not, " +
"which would refresh the materialized view after creating")
public static boolean default_mv_refresh_immediate = true;

/**
* Whether analyze the mv after refresh in async mode.
*/
@ConfField(mutable = true)
public static boolean mv_auto_analyze_async = true;

>>>>>>> 2bd50b99c1 ([Enhancement] add a switch to control default refresh immediate (#37093))
/**
* To prevent the external catalog from displaying too many entries in the grantsTo system table,
* you can use this variable to ignore the entries in the external catalog
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,17 @@ public class RefreshSchemeDesc implements ParseNode {
protected MaterializedView.RefreshType type;
protected MaterializedView.RefreshMoment moment;

<<<<<<< HEAD:fe/fe-core/src/main/java/com/starrocks/sql/ast/RefreshSchemeDesc.java
public RefreshSchemeDesc(MaterializedView.RefreshType type) {
this.type = type;
this.moment = MaterializedView.RefreshMoment.IMMEDIATE;
}

public RefreshSchemeDesc(MaterializedView.RefreshType type, MaterializedView.RefreshMoment moment) {
=======
public RefreshSchemeClause(MaterializedView.RefreshType type, NodePosition pos, MaterializedView.RefreshMoment moment) {
super(AlterOpType.REFRESH_SCHEMA, pos);
>>>>>>> 2bd50b99c1 ([Enhancement] add a switch to control default refresh immediate (#37093)):fe/fe-core/src/main/java/com/starrocks/sql/ast/RefreshSchemeClause.java
this.type = type;
this.moment = moment;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5951,9 +5951,18 @@ public ParseNode visitDistributionDesc(StarRocksParser.DistributionDescContext c
public ParseNode visitRefreshSchemeDesc(StarRocksParser.RefreshSchemeDescContext context) {
LocalDateTime startTime = LocalDateTime.now();
IntervalLiteral intervalLiteral = null;
<<<<<<< HEAD
MaterializedView.RefreshMoment refreshMoment = MaterializedView.RefreshMoment.IMMEDIATE;
=======
NodePosition pos = createPos(context);
MaterializedView.RefreshMoment refreshMoment =
Config.default_mv_refresh_immediate ?
MaterializedView.RefreshMoment.IMMEDIATE : MaterializedView.RefreshMoment.DEFERRED;
>>>>>>> 2bd50b99c1 ([Enhancement] add a switch to control default refresh immediate (#37093))
if (context.DEFERRED() != null) {
refreshMoment = MaterializedView.RefreshMoment.DEFERRED;
} else if (context.IMMEDIATE() != null) {
refreshMoment = MaterializedView.RefreshMoment.IMMEDIATE;
}
if (context.ASYNC() != null) {
if (context.START() != null && context.interval() == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ public static void beforeClass() throws Exception {
Config.tablet_sched_repair_delay_factor_second = 1;
Config.enable_new_publish_mechanism = true;

// Default REFRESH DEFERRED
Config.default_mv_refresh_immediate = false;

PseudoCluster.getOrCreateWithRandomPort(true, 3);
GlobalStateMgr.getCurrentState().getTabletChecker().setInterval(1000);
cluster = PseudoCluster.getInstance();
Expand Down

0 comments on commit a5f702b

Please sign in to comment.