From 8f9205c192f2b120b31d0db228543c2454d5847c Mon Sep 17 00:00:00 2001 From: Georgy Shelkovy Date: Tue, 29 Oct 2024 16:36:54 +0500 Subject: [PATCH] direct dispatch to SPI --- src/quotamodel.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/quotamodel.c b/src/quotamodel.c index 5a58a6a3..13d31c96 100644 --- a/src/quotamodel.c +++ b/src/quotamodel.c @@ -1343,10 +1343,10 @@ flush_local_reject_map(void) static void dispatch_rejectmap(char *active_oids) { + SPI_state state; HASH_SEQ_STATUS hash_seq; GlobalRejectMapEntry *rejectmap_entry; int num_entries, count = 0; - CdbPgResults cdb_pgresults = {NULL, 0}; StringInfoData rows; StringInfoData sql; @@ -1369,13 +1369,18 @@ dispatch_rejectmap(char *active_oids) appendStringInfo(&sql, "select diskquota.refresh_rejectmap(" "ARRAY[%s]::diskquota.rejectmap_entry[], " - "ARRAY[%s]::oid[])", + "ARRAY[%s]::oid[]) from gp_dist_random('gp_id')", rows.data, active_oids); - CdbDispatchCommand(sql.data, DF_NONE, &cdb_pgresults); + + SPI_connect_wrapper(&state); + int ret = SPI_execute(sql.data, false, 0); + if (ret != SPI_OK_SELECT) + ereport(ERROR, (errcode(ERRCODE_INTERNAL_ERROR), + errmsg("[diskquota] diskquota.refresh_rejectmap SPI_execute failed: error code %d", ret))); + SPI_finish_wrapper(&state); pfree(rows.data); pfree(sql.data); - cdbdisp_clearCdbPgResults(&cdb_pgresults); } /*