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

Commit7804c9b

Browse files
committed
do not perform finish_delayed_invalidation() & load_config() on transaction-related utility statements
1 parent4a97264 commit7804c9b

File tree

3 files changed

+49
-0
lines changed

3 files changed

+49
-0
lines changed

‎src/hooks.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include"runtimeappend.h"
1515
#include"runtime_merge_append.h"
1616
#include"utils.h"
17+
#include"xact_handling.h"
1718

1819
#include"miscadmin.h"
1920
#include"optimizer/cost.h"
@@ -451,6 +452,14 @@ pathman_post_parse_analysis_hook(ParseState *pstate, Query *query)
451452
if (post_parse_analyze_hook_next)
452453
post_parse_analyze_hook_next(pstate,query);
453454

455+
/* We shouldn't do anything on BEGIN or SET ISOLATION LEVEL stmts */
456+
if (query->commandType==CMD_UTILITY&&
457+
(xact_is_transaction_stmt(query->utilityStmt)||
458+
xact_is_set_transaction_stmt(query->utilityStmt)))
459+
{
460+
return;
461+
}
462+
454463
/* Finish delayed invalidation jobs */
455464
if (IsPathmanReady())
456465
finish_delayed_invalidation();

‎src/xact_handling.c

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,42 @@ xact_is_level_read_committed(void)
109109
return false;
110110
}
111111

112+
/*
113+
* Check if 'stmt' is BEGIN\ROLLBACK etc transaction statement.
114+
*/
115+
bool
116+
xact_is_transaction_stmt(Node*stmt)
117+
{
118+
if (!stmt)
119+
return false;
120+
121+
if (IsA(stmt,TransactionStmt))
122+
return true;
123+
124+
return false;
125+
}
126+
127+
/*
128+
* Check if 'stmt' is SET TRANSACTION statement.
129+
*/
130+
bool
131+
xact_is_set_transaction_stmt(Node*stmt)
132+
{
133+
if (!stmt)
134+
return false;
135+
136+
if (IsA(stmt,VariableSetStmt))
137+
{
138+
VariableSetStmt*var_set_stmt= (VariableSetStmt*)stmt;
139+
140+
/* special case for SET TRANSACTION ... */
141+
if (var_set_stmt->kind==VAR_SET_MULTI)
142+
return true;
143+
}
144+
145+
return false;
146+
}
147+
112148
/*
113149
* Do we hold the specified lock?
114150
*/

‎src/xact_handling.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313

1414
#include"pathman.h"
1515

16+
#include"postgres.h"
17+
1618

1719
/*
1820
* Transaction locks.
@@ -28,5 +30,7 @@ void xact_unlock_rel_exclusive(Oid relid);
2830
*/
2931
boolxact_bgw_conflicting_lock_exists(Oidrelid);
3032
boolxact_is_level_read_committed(void);
33+
boolxact_is_transaction_stmt(Node*stmt);
34+
boolxact_is_set_transaction_stmt(Node*stmt);
3135

3236
#endif

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp