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

Commit1d468b9

Browse files
committed
Add query cancellation capabilities in pgbench init phase
This can be useful to stop data generation happening on the server forlong-running queries caused by large scale factors. This cannot happenby default as data is generated on the client, but it is possible tocontrol the initialization steps of pgbench to do that.Reported-by: Fujii MasaoAuthor: Fabien CoelhoDiscussion:https://postgr.es/m/alpine.DEB.2.21.1910311939430.27369@lancreDiscussion:https://postgr.es/m/CAHGQGwHWEyTXxZh46qgFY8a2bDF_EYeUdp3+_Hy=qLZSzwVPKg@mail.gmail.com
1 parenta4fd3aa commit1d468b9

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

‎src/bin/pgbench/pgbench.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959

6060
#include"common/int.h"
6161
#include"common/logging.h"
62+
#include"fe_utils/cancel.h"
6263
#include"fe_utils/conditional.h"
6364
#include"getopt_long.h"
6465
#include"libpq-fe.h"
@@ -3894,6 +3895,9 @@ initGenerateDataClientSide(PGconn *con)
38943895
exit(1);
38953896
}
38963897

3898+
if (CancelRequested)
3899+
break;
3900+
38973901
/*
38983902
* If we want to stick with the original logging, print a message each
38993903
* 100k inserted rows.
@@ -4109,6 +4113,9 @@ runInitSteps(const char *initialize_steps)
41094113
if ((con=doConnect())==NULL)
41104114
exit(1);
41114115

4116+
setup_cancel_handler(NULL);
4117+
SetCancelConn(con);
4118+
41124119
for (step=initialize_steps;*step!='\0';step++)
41134120
{
41144121
instr_timestart;
@@ -4176,6 +4183,7 @@ runInitSteps(const char *initialize_steps)
41764183
}
41774184

41784185
fprintf(stderr,"done in %.2f s (%s).\n",run_time,stats.data);
4186+
ResetCancelConn();
41794187
PQfinish(con);
41804188
termPQExpBuffer(&stats);
41814189
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp