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

Commit24503fa

Browse files
committed
reindexdb: move PQfinish() calls to the right place
get_parallel_object_list() has no business closing a connection it didnot create. Make things more sensible by closing the connection at thelevel where it is created, in reindex_one_database().Extracted from a larger patch by the same author. However, the patch assubmitted not only was not described as containing this change, but inaddition it contained a fatal flaw whereby reindexdb would crash andfail across all of its TAP test, which is why I list myself asco-author.Author: Ranier Vilela <ranier.vf@gmail.com>Author: Álvaro Herrera <alvherre@alvh.no-ip.org>Discussion:https://postgr.es/m/CAEudQArfqr0-s0VVPSEh=0kgOgBJvFNdGW=xSL5rBcr0WDMQYQ@mail.gmail.com
1 parent0f21db3 commit24503fa

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

‎src/bin/scripts/reindexdb.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,10 @@ reindex_one_database(ConnParams *cparams, ReindexType type,
339339

340340
/* Bail out if nothing to process */
341341
if (process_list==NULL)
342+
{
343+
PQfinish(conn);
342344
return;
345+
}
343346
break;
344347

345348
caseREINDEX_SCHEMA:
@@ -352,7 +355,10 @@ reindex_one_database(ConnParams *cparams, ReindexType type,
352355

353356
/* Bail out if nothing to process */
354357
if (process_list==NULL)
358+
{
359+
PQfinish(conn);
355360
return;
361+
}
356362
break;
357363

358364
caseREINDEX_INDEX:
@@ -370,7 +376,10 @@ reindex_one_database(ConnParams *cparams, ReindexType type,
370376
* in-place, so check if it has at least one cell.
371377
*/
372378
if (user_list->head==NULL)
379+
{
380+
PQfinish(conn);
373381
return;
382+
}
374383

375384
/*
376385
* Assuming 'user_list' is not empty, 'indices_tables_list'
@@ -416,6 +425,7 @@ reindex_one_database(ConnParams *cparams, ReindexType type,
416425

417426
sa=ParallelSlotsSetup(concurrentCons,cparams,progname,echo,NULL);
418427
ParallelSlotsAdoptConn(sa,conn);
428+
conn=NULL;
419429

420430
cell=process_list->head;
421431
do
@@ -765,7 +775,6 @@ get_parallel_object_list(PGconn *conn, ReindexType type,
765775
if (ntups==0)
766776
{
767777
PQclear(res);
768-
PQfinish(conn);
769778
returnNULL;
770779
}
771780

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp