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

Commita535629

Browse files
committed
[PGPRO-5614] Reset cache at start and at finish ATX transaction
1 parenta9a64e2 commita535629

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

‎src/pg_pathman.c

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*This module sets planner hooks, handles SELECT queries and produces
55
*paths for partitioned tables
66
*
7-
* Copyright (c) 2015-2016, Postgres Professional
7+
* Copyright (c) 2015-2021, Postgres Professional
88
*
99
* ------------------------------------------------------------------------
1010
*/
@@ -281,6 +281,32 @@ estimate_paramsel_using_prel(const PartRelationInfo *prel, int strategy)
281281
elsereturn1.0;
282282
}
283283

284+
#if defined(PGPRO_EE)&&PG_VERSION_NUM >=130000
285+
/*
286+
* Reset cache at start and at finish ATX transaction
287+
*/
288+
staticvoid
289+
pathman_xact_cb(XactEventevent,void*arg)
290+
{
291+
if (getNestLevelATX()>0)
292+
{
293+
/*
294+
* For each ATX transaction start/finish: need to reset pg_pathman
295+
* cache because we shouldn't see uncommitted data in autonomous
296+
* transaction and data of autonomous transaction in main transaction
297+
*/
298+
if ((event==XACT_EVENT_START/* start */)||
299+
(event==XACT_EVENT_ABORT||
300+
event==XACT_EVENT_PARALLEL_ABORT||
301+
event==XACT_EVENT_COMMIT||
302+
event==XACT_EVENT_PARALLEL_COMMIT||
303+
event==XACT_EVENT_PREPARE/* finish */))
304+
{
305+
pathman_relcache_hook(PointerGetDatum(NULL),InvalidOid);
306+
}
307+
}
308+
}
309+
#endif
284310

285311
/*
286312
* -------------------
@@ -330,6 +356,11 @@ _PG_init(void)
330356
init_partition_filter_static_data();
331357
init_partition_router_static_data();
332358
init_partition_overseer_static_data();
359+
360+
#if defined(PGPRO_EE)&&PG_VERSION_NUM >=130000
361+
/* Callbacks for reload relcache for ATX transactions */
362+
RegisterXactCallback(pathman_xact_cb,NULL);
363+
#endif
333364
}
334365

335366
/* Get cached PATHMAN_CONFIG relation Oid */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp