Skip to content

Commit

Permalink
spi-stats:fix sync load plan_cache_mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
ljl committed Dec 19, 2024
1 parent 1a8e979 commit 014dd0f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions backend/spi/spi-stats/src/serv/pg/stats_pg_record_serv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ pub(crate) async fn fact_record_load(
) -> TardisResult<()> {
let bs_inst = inst.inst::<TardisRelDBClient>();
let (mut conn, _) = common_pg::init_conn(bs_inst).await?;
conn.execute_one("SET plan_cache_mode = 'force_generic_plan'", vec![]).await?;
conn.begin().await?;
if !stats_pg_conf_fact_serv::online(fact_conf_key, &conn, ctx).await? {
return Err(funs.err().conflict("fact_record", "load", "The fact config not online.", "409-spi-stats-fact-conf-not-online"));
Expand Down
2 changes: 2 additions & 0 deletions backend/spi/spi-stats/src/serv/pg/stats_pg_sync_serv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ pub(crate) async fn fact_record_sync(fact_conf_key: &str, funs: &TardisFunsInst,
let funs = stats_initializer::get_tardis_inst();
let inst = funs.init(None, &task_ctx, true, stats_initializer::init_fun).await?;
let db_source_conn = get_db_conn_by_cert_id(&cert_id, &funs, &task_ctx, inst.as_ref()).await?;
db_source_conn.execute_one("SET plan_cache_mode = 'force_generic_plan'", vec![]).await?;
let db_source_list = db_source_conn.query_all(&sync_sql, vec![]).await?;
let mut success = 0;
let mut error = 0;
Expand Down Expand Up @@ -342,6 +343,7 @@ pub(crate) async fn fact_col_record_result(
return Ok(None);
}
let data_source_conn = get_db_conn_by_cert_id(&cert_id, funs, ctx, inst).await?;
data_source_conn.execute_one("SET plan_cache_mode = 'force_generic_plan'", vec![]).await?;
let (sql, params) = process_sql(&sql, &fact_record)?;
if let Some(rel_record) = data_source_conn.query_one(&sql, params).await? {
if let Some(first_column) = rel_record.column_names().get(0) {
Expand Down

0 comments on commit 014dd0f

Please sign in to comment.