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

Commit24f5205

Browse files
committed
Add some sanity checks in executor for query ID reporting
This commit adds three sanity checks in code paths of the executor whereit is possible to use hooks, checking that a query ID is reported inpg_stat_activity if compute_query_id is enabled:- ExecutorRun()- ExecutorFinish()- ExecutorEnd()This causes the test in pg_stat_statements added in933848d tocomplain immediately in ExecutorRun(). The idea behind this commit isto help extensions to detect if they are missing query ID reports when aquery goes through the executor. Perhaps this will prove to be a badidea, but let's see where this experience goes in v18 and newerversions.Reviewed-by: Sami ImseihDiscussion:https://postgr.es/m/ZuJb5xCKHH0A9tMN@paquier.xyz
1 parent4f08ab5 commit24f5205

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

‎src/backend/executor/execMain.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
#include"foreign/fdwapi.h"
5151
#include"mb/pg_wchar.h"
5252
#include"miscadmin.h"
53+
#include"nodes/queryjumble.h"
5354
#include"parser/parse_relation.h"
5455
#include"rewrite/rewriteHandler.h"
5556
#include"tcop/utility.h"
@@ -295,6 +296,9 @@ ExecutorRun(QueryDesc *queryDesc,
295296
ScanDirectiondirection,uint64count,
296297
boolexecute_once)
297298
{
299+
/* If enabled, the query ID should be set. */
300+
Assert(!IsQueryIdEnabled()||pgstat_get_my_query_id()!=0);
301+
298302
if (ExecutorRun_hook)
299303
(*ExecutorRun_hook) (queryDesc,direction,count,execute_once);
300304
else
@@ -403,6 +407,9 @@ standard_ExecutorRun(QueryDesc *queryDesc,
403407
void
404408
ExecutorFinish(QueryDesc*queryDesc)
405409
{
410+
/* If enabled, the query ID should be set. */
411+
Assert(!IsQueryIdEnabled()||pgstat_get_my_query_id()!=0);
412+
406413
if (ExecutorFinish_hook)
407414
(*ExecutorFinish_hook) (queryDesc);
408415
else
@@ -463,6 +470,9 @@ standard_ExecutorFinish(QueryDesc *queryDesc)
463470
void
464471
ExecutorEnd(QueryDesc*queryDesc)
465472
{
473+
/* If enabled, the query ID should be set. */
474+
Assert(!IsQueryIdEnabled()||pgstat_get_my_query_id()!=0);
475+
466476
if (ExecutorEnd_hook)
467477
(*ExecutorEnd_hook) (queryDesc);
468478
else

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp