From 014dd0fa6979c72cd31aee1c76318f9eb56b866a Mon Sep 17 00:00:00 2001 From: ljl <17743125563@163.com> Date: Thu, 19 Dec 2024 09:41:54 +0800 Subject: [PATCH] spi-stats:fix sync load plan_cache_mode. --- backend/spi/spi-stats/src/serv/pg/stats_pg_record_serv.rs | 1 + backend/spi/spi-stats/src/serv/pg/stats_pg_sync_serv.rs | 2 ++ 2 files changed, 3 insertions(+) diff --git a/backend/spi/spi-stats/src/serv/pg/stats_pg_record_serv.rs b/backend/spi/spi-stats/src/serv/pg/stats_pg_record_serv.rs index 4c7d6467..7f43f85d 100644 --- a/backend/spi/spi-stats/src/serv/pg/stats_pg_record_serv.rs +++ b/backend/spi/spi-stats/src/serv/pg/stats_pg_record_serv.rs @@ -145,6 +145,7 @@ pub(crate) async fn fact_record_load( ) -> TardisResult<()> { let bs_inst = inst.inst::(); 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")); diff --git a/backend/spi/spi-stats/src/serv/pg/stats_pg_sync_serv.rs b/backend/spi/spi-stats/src/serv/pg/stats_pg_sync_serv.rs index 171d2235..d40e1cbe 100644 --- a/backend/spi/spi-stats/src/serv/pg/stats_pg_sync_serv.rs +++ b/backend/spi/spi-stats/src/serv/pg/stats_pg_sync_serv.rs @@ -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; @@ -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) {