Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite5af4d3

Browse files
committed
Fix for68edd02: We need the hook anyway if we use long transactions
1 parent68edd02 commite5af4d3

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

‎pg_variables.c

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ static void makePackHTAB(Package *package, bool is_trans);
8080
staticinlineChangedObject*makeChangedObject(TransObject*object,
8181
MemoryContextctx);
8282

83+
/* Hook functions */
84+
staticvoidvariable_ExecutorEnd(QueryDesc*queryDesc);
85+
8386
#defineCHECK_ARGS_FOR_NULL() \
8487
do { \
8588
if (fcinfo->argnull[0]) \
@@ -110,6 +113,9 @@ static Oid LastTypeId = InvalidOid;
110113
*/
111114
staticHASH_SEQ_STATUS*LastHSeqStatus=NULL;
112115

116+
/* Saved hook values for recall */
117+
staticExecutorEnd_hook_typeprev_ExecutorEnd=NULL;
118+
113119
/* This stack contains lists of changed variables and packages per each subxact level */
114120
staticdlist_head*changesStack=NULL;
115121
staticMemoryContextchangesStackContext=NULL;
@@ -2125,6 +2131,23 @@ pgvTransCallback(XactEvent event, void *arg)
21252131
}
21262132
}
21272133

2134+
/*
2135+
* ExecutorEnd hook: clean up hash table sequential scan status
2136+
*/
2137+
staticvoid
2138+
variable_ExecutorEnd(QueryDesc*queryDesc)
2139+
{
2140+
if (LastHSeqStatus)
2141+
{
2142+
hash_seq_term(LastHSeqStatus);
2143+
LastHSeqStatus=NULL;
2144+
}
2145+
if (prev_ExecutorEnd)
2146+
prev_ExecutorEnd(queryDesc);
2147+
else
2148+
standard_ExecutorEnd(queryDesc);
2149+
}
2150+
21282151
/*
21292152
* Register callback function when module starts
21302153
*/
@@ -2133,6 +2156,10 @@ _PG_init(void)
21332156
{
21342157
RegisterXactCallback(pgvTransCallback,NULL);
21352158
RegisterSubXactCallback(pgvSubTransCallback,NULL);
2159+
2160+
/* Install hooks. */
2161+
prev_ExecutorEnd=ExecutorEnd_hook;
2162+
ExecutorEnd_hook=variable_ExecutorEnd;
21362163
}
21372164

21382165
/*
@@ -2143,4 +2170,5 @@ _PG_fini(void)
21432170
{
21442171
UnregisterXactCallback(pgvTransCallback,NULL);
21452172
UnregisterSubXactCallback(pgvSubTransCallback,NULL);
2173+
ExecutorEnd_hook=prev_ExecutorEnd;
21462174
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp