mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-12-27 08:39:28 +08:00
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 happen if the tuple was inserted/deleted by our own transaction. Per report from Justin Clift 9/23.
This commit is contained in:
parent
1481b3b28b
commit
d435592f33
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.163 2001/08/26 16:55:59 tgl Exp $
|
* $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.164 2001/09/26 21:09:27 tgl Exp $
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* INTERFACE ROUTINES
|
* INTERFACE ROUTINES
|
||||||
@ -1789,19 +1789,27 @@ IndexBuildHeapScan(Relation heapRelation,
|
|||||||
break;
|
break;
|
||||||
case HEAPTUPLE_INSERT_IN_PROGRESS:
|
case HEAPTUPLE_INSERT_IN_PROGRESS:
|
||||||
/*
|
/*
|
||||||
* This should not happen, if caller holds ShareLock on
|
* Since caller should hold ShareLock or better, we should
|
||||||
* the parent relation.
|
* not see any tuples inserted by open transactions ---
|
||||||
|
* unless it's our own transaction. (Consider INSERT
|
||||||
|
* followed by CREATE INDEX within a transaction.)
|
||||||
*/
|
*/
|
||||||
elog(ERROR, "IndexBuildHeapScan: concurrent insert in progress");
|
if (! TransactionIdIsCurrentTransactionId(heapTuple->t_data->t_xmin))
|
||||||
indexIt = tupleIsAlive = false; /* keep compiler quiet */
|
elog(ERROR, "IndexBuildHeapScan: concurrent insert in progress");
|
||||||
|
indexIt = true;
|
||||||
|
tupleIsAlive = true;
|
||||||
break;
|
break;
|
||||||
case HEAPTUPLE_DELETE_IN_PROGRESS:
|
case HEAPTUPLE_DELETE_IN_PROGRESS:
|
||||||
/*
|
/*
|
||||||
* This should not happen, if caller holds ShareLock on
|
* Since caller should hold ShareLock or better, we should
|
||||||
* the parent relation.
|
* not see any tuples deleted by open transactions ---
|
||||||
|
* unless it's our own transaction. (Consider DELETE
|
||||||
|
* followed by CREATE INDEX within a transaction.)
|
||||||
*/
|
*/
|
||||||
elog(ERROR, "IndexBuildHeapScan: concurrent delete in progress");
|
if (! TransactionIdIsCurrentTransactionId(heapTuple->t_data->t_xmax))
|
||||||
indexIt = tupleIsAlive = false; /* keep compiler quiet */
|
elog(ERROR, "IndexBuildHeapScan: concurrent delete in progress");
|
||||||
|
indexIt = true;
|
||||||
|
tupleIsAlive = false;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
elog(ERROR, "Unexpected HeapTupleSatisfiesVacuum result");
|
elog(ERROR, "Unexpected HeapTupleSatisfiesVacuum result");
|
||||||
|
Loading…
Reference in New Issue
Block a user