Fix mview fetch mview refresh stats params
This commit is contained in:
@ -358,26 +358,29 @@ int ObMViewRefreshStatsParams::fetch_mview_refresh_stats_params(ObISQLClient &sq
|
||||
"select collection_level, retention_period from"
|
||||
"("
|
||||
" with defvals as"
|
||||
" (select collection_level, retention_period from %s where tenant_id = 0)"
|
||||
" select ifnull(e.collection_level, d.collection_level) collection_level,"
|
||||
" ("
|
||||
" select"
|
||||
" ifnull(max(collection_level), 1) as collection_level,"
|
||||
" ifnull(max(retention_period), 31) as retention_period"
|
||||
" from %s"
|
||||
" where tenant_id = 0"
|
||||
" )"
|
||||
" select"
|
||||
" ifnull(e.collection_level, d.collection_level) collection_level,"
|
||||
" ifnull(e.retention_period, d.retention_period) retention_period"
|
||||
" from"
|
||||
" (select tenant_id, mview_id, collection_level, retention_period from %s"
|
||||
" right outer join"
|
||||
" (select tenant_id, mview_id from %s where tenant_id = 0 and mview_id = %ld)"
|
||||
" using (tenant_id, mview_id)"
|
||||
" ) e, defvals d"
|
||||
" ) e,"
|
||||
" defvals d"
|
||||
")",
|
||||
OB_ALL_MVIEW_REFRESH_STATS_SYS_DEFAULTS_TNAME, OB_ALL_MVIEW_REFRESH_STATS_PARAMS_TNAME,
|
||||
OB_ALL_MVIEW_TNAME, mview_id))) {
|
||||
LOG_WARN("fail to assign sql with sys defaults", KR(ret));
|
||||
} else if (OB_FAIL(read_stats_params(sql_client, exec_tenant_id, sql, params))) {
|
||||
if (OB_UNLIKELY(OB_ENTRY_NOT_EXIST != ret)) {
|
||||
LOG_WARN("fail to read stats params", KR(ret), K(exec_tenant_id), K(sql));
|
||||
} else {
|
||||
ret = OB_SUCCESS;
|
||||
params = get_default();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (OB_FAIL(sql.assign_fmt("select collection_level, retention_period from %s"
|
||||
|
@ -86,7 +86,12 @@ int ObMViewStatsPurgeRefreshStatsExecutor::execute(ObExecContext &ctx,
|
||||
ObMViewRefreshStatsParams stats_params;
|
||||
if (OB_FAIL(ObMViewRefreshStatsParams::fetch_mview_refresh_stats_params(
|
||||
*ctx.get_sql_proxy(), tenant_id_, mview_id, stats_params, true))) {
|
||||
LOG_WARN("fail to fetch sys defaults", KR(ret), K(tenant_id_), K(mview_id));
|
||||
if (OB_UNLIKELY(OB_ENTRY_NOT_EXIST != ret)) {
|
||||
LOG_WARN("fail to fetch mview refresh stats params", KR(ret), K_(tenant_id), K(mview_id));
|
||||
} else {
|
||||
ret = OB_ERR_MVIEW_NOT_EXIST;
|
||||
LOG_WARN("mview not exist", KR(ret), K_(tenant_id), K(mview_id));
|
||||
}
|
||||
} else {
|
||||
filter_param.set_retention_period(stats_params.get_retention_period());
|
||||
}
|
||||
|
Reference in New Issue
Block a user