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

Commitd435592

Browse files
committed
Repair oversight in recent changes to index-creation: tuple time qual
check *can* return HEAPTUPLE_INSERT_IN_PROGRESS or HEAPTUPLE_DELETE_IN_PROGRESS,even though we have ShareLock on the relation. To wit, this can happenif the tuple was inserted/deleted by our own transaction. Per report fromJustin Clift 9/23.
1 parent1481b3b commitd435592

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

‎src/backend/catalog/index.c

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.163 2001/08/2616:55:59 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.164 2001/09/2621:09:27 tgl Exp $
1212
*
1313
*
1414
* INTERFACE ROUTINES
@@ -1789,19 +1789,27 @@ IndexBuildHeapScan(Relation heapRelation,
17891789
break;
17901790
caseHEAPTUPLE_INSERT_IN_PROGRESS:
17911791
/*
1792-
* This should not happen, if caller holds ShareLock on
1793-
* the parent relation.
1792+
* Since caller should hold ShareLock or better, we should
1793+
* not see any tuples inserted by open transactions ---
1794+
* unless it's our own transaction. (Consider INSERT
1795+
* followed by CREATE INDEX within a transaction.)
17941796
*/
1795-
elog(ERROR,"IndexBuildHeapScan: concurrent insert in progress");
1796-
indexIt=tupleIsAlive= false;/* keep compiler quiet */
1797+
if (!TransactionIdIsCurrentTransactionId(heapTuple->t_data->t_xmin))
1798+
elog(ERROR,"IndexBuildHeapScan: concurrent insert in progress");
1799+
indexIt= true;
1800+
tupleIsAlive= true;
17971801
break;
17981802
caseHEAPTUPLE_DELETE_IN_PROGRESS:
17991803
/*
1800-
* This should not happen, if caller holds ShareLock on
1801-
* the parent relation.
1804+
* Since caller should hold ShareLock or better, we should
1805+
* not see any tuples deleted by open transactions ---
1806+
* unless it's our own transaction. (Consider DELETE
1807+
* followed by CREATE INDEX within a transaction.)
18021808
*/
1803-
elog(ERROR,"IndexBuildHeapScan: concurrent delete in progress");
1804-
indexIt=tupleIsAlive= false;/* keep compiler quiet */
1809+
if (!TransactionIdIsCurrentTransactionId(heapTuple->t_data->t_xmax))
1810+
elog(ERROR,"IndexBuildHeapScan: concurrent delete in progress");
1811+
indexIt= true;
1812+
tupleIsAlive= false;
18051813
break;
18061814
default:
18071815
elog(ERROR,"Unexpected HeapTupleSatisfiesVacuum result");

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp