Skip to content

Commit

Permalink
Fix: report a detail message when out of shared memory
Browse files Browse the repository at this point in the history
  • Loading branch information
yjhjstz committed Nov 3, 2023
1 parent 418968f commit 7c345d8
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions src/backend/commands/matview.c
Original file line number Diff line number Diff line change
Expand Up @@ -1512,7 +1512,9 @@ ivm_immediate_before(PG_FUNCTION_ARGS)
}

entry->before_trig_count++;

elogif(Debug_print_ivm, INFO, "trigger ivm_immediate_before ref%d, mvid:%d", entry->before_trig_count, matviewOid);

if (Gp_role == GP_ROLE_DISPATCH && !TRIGGER_FIRED_BY_TRUNCATE(trigdata->tg_event))
{
snprintf(entry->snapname, SNAPSHOT_KEYSIZE, "%08X-%08X-%d-%d",
Expand Down Expand Up @@ -3207,7 +3209,7 @@ mv_TableShmemSize(void)
void
AtAbort_IVM()
{
AtEOXact_IVM(true);
AtEOXact_IVM(false);
}

void
Expand Down Expand Up @@ -3254,7 +3256,6 @@ AtEOXact_IVM(bool isCommit)
MemoryContextDelete(ctx);
}
}

}
}
}
Expand Down Expand Up @@ -3513,7 +3514,6 @@ AddPreassignedMVEntry(Oid matview_id, Oid table_id, const char* snapname)
* Clean up hash entries for a materialized view after its
* maintenance finished.
*/

Datum
ivm_immediate_cleanup(PG_FUNCTION_ARGS)
{
Expand Down Expand Up @@ -3560,7 +3560,6 @@ ivm_immediate_cleanup(PG_FUNCTION_ARGS)
*
* Apply immediate cleanup for a materialized view.
*/

static void
apply_cleanup(Oid matview_id)
{
Expand Down Expand Up @@ -3636,9 +3635,14 @@ pg_export_snapshot_def(PG_FUNCTION_ARGS)

LWLockAcquire(GPIVMResLock, LW_EXCLUSIVE);
pDump = (SnapshotDumpEntry *) hash_search(mv_trigger_snapshot,
(void *) snapname, // key
HASH_ENTER,
(void *) snapname,
HASH_ENTER_NULL,
&found);
if (!pDump)
ereport(ERROR,
(errcode(ERRCODE_OUT_OF_MEMORY),
errmsg("out of shared memory"),
errhint("out of cross-slice trigger snapshot slots.")));

if (!found)
{
Expand Down Expand Up @@ -3808,6 +3812,11 @@ transientenr_init(QueryDesc *queryDesc)
into->enrname);
}

/*
* ivm_set_ts_persitent_name
*
* This function sets the transition table file name for the IVM trigger.
*/
static void
ivm_set_ts_persitent_name(TriggerData *trigdata, Oid relid, Oid mvid)
{
Expand Down

0 comments on commit 7c345d8

Please sign in to comment.