Skip to content

Commit

Permalink
direct dispatch to SPI
Browse files Browse the repository at this point in the history
  • Loading branch information
RekGRpth committed Oct 29, 2024
1 parent ea9f6aa commit 8f9205c
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/quotamodel.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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);
}

/*
Expand Down

0 comments on commit 8f9205c

Please sign in to comment.