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

Commitde1dfc1

Browse files
committed
Rearrange code in ExecInitBitmapHeapScan so that we don't initialize the
child plan nodes until we have acquired lock on the relation to scan.The relative order of initialization of plan nodes isn't real important inother cases, but it's critical here because one is supposed to lock arelation before its indexes, not vice versa. The original coding was atleast vulnerable to deadlock against DROP INDEX, and perhaps worse things.
1 parent113ece8 commitde1dfc1

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

‎src/backend/executor/nodeBitmapHeapscan.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
*
2222
*
2323
* IDENTIFICATION
24-
* $PostgreSQL: pgsql/src/backend/executor/nodeBitmapHeapscan.c,v 1.6 2005/11/26 03:03:07 tgl Exp $
24+
* $PostgreSQL: pgsql/src/backend/executor/nodeBitmapHeapscan.c,v 1.7 2005/12/02 01:29:55 tgl Exp $
2525
*
2626
*-------------------------------------------------------------------------
2727
*/
@@ -508,11 +508,6 @@ ExecInitBitmapHeapScan(BitmapHeapScan *node, EState *estate)
508508
ExecInitExpr((Expr*)node->bitmapqualorig,
509509
(PlanState*)scanstate);
510510

511-
/*
512-
* initialize child nodes
513-
*/
514-
outerPlanState(scanstate)=ExecInitNode(outerPlan(node),estate);
515-
516511
#defineBITMAPHEAPSCAN_NSLOTS 2
517512

518513
/*
@@ -562,6 +557,15 @@ ExecInitBitmapHeapScan(BitmapHeapScan *node, EState *estate)
562557
ExecAssignResultTypeFromTL(&scanstate->ss.ps);
563558
ExecAssignScanProjectionInfo(&scanstate->ss);
564559

560+
/*
561+
* initialize child nodes
562+
*
563+
* We do this last because the child nodes will open indexscans on our
564+
* relation's indexes, and we want to be sure we have acquired a lock
565+
* on the relation first.
566+
*/
567+
outerPlanState(scanstate)=ExecInitNode(outerPlan(node),estate);
568+
565569
/*
566570
* all done.
567571
*/

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp