Commit 53ebb228 authored by Hiroshi Inoue's avatar Hiroshi Inoue

Change LockClassinfoForUpdate() to retry mark4update() in case

the tuple is already uodated. (If LockClassinfoForUpdate() is
thought to be useful).
parent 5322bf46
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.133 2000/12/22 23:12:03 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.134 2001/01/18 04:01:42 inoue Exp $
* *
* *
* INTERFACE ROUTINES * INTERFACE ROUTINES
...@@ -1348,16 +1348,27 @@ LockClassinfoForUpdate(Oid relid, HeapTuple rtup, ...@@ -1348,16 +1348,27 @@ LockClassinfoForUpdate(Oid relid, HeapTuple rtup,
rtup->t_self = classTuple->t_self; rtup->t_self = classTuple->t_self;
ReleaseSysCache(classTuple); ReleaseSysCache(classTuple);
while (1)
{
ItemPointerData tidsave;
ItemPointerCopy(&(rtup->t_self), &tidsave);
test = heap_mark4update(relationRelation, rtup, buffer); test = heap_mark4update(relationRelation, rtup, buffer);
switch (test) switch (test)
{ {
case HeapTupleSelfUpdated: case HeapTupleSelfUpdated:
case HeapTupleMayBeUpdated: case HeapTupleMayBeUpdated:
break; break;
case HeapTupleUpdated:
ReleaseBuffer(*buffer);
if (!ItemPointerEquals(&(rtup->t_self), &tidsave))
continue;
default: default:
elog(ERROR, "LockStatsForUpdate couldn't lock relid %u", relid); elog(ERROR, "LockClassinfoForUpdate couldn't lock relid %u", relid);
return false; return false;
} }
break;
}
RelationInvalidateHeapTuple(relationRelation, rtup); RelationInvalidateHeapTuple(relationRelation, rtup);
if (confirmCommitted) if (confirmCommitted)
{ {
...@@ -1634,8 +1645,7 @@ UpdateStats(Oid relid, long reltuples) ...@@ -1634,8 +1645,7 @@ UpdateStats(Oid relid, long reltuples)
#ifdef OLD_FILE_NAMING #ifdef OLD_FILE_NAMING
in_place_upd = (IsReindexProcessing() || IsBootstrapProcessingMode()); in_place_upd = (IsReindexProcessing() || IsBootstrapProcessingMode());
#else #else
in_place_upd = (IsIgnoringSystemIndexes() || (IsReindexProcessing() && in_place_upd = (IsIgnoringSystemIndexes() || IsReindexProcessing());
relid == RelOid_pg_class));
#endif /* OLD_FILE_NAMING */ #endif /* OLD_FILE_NAMING */
if (!in_place_upd) if (!in_place_upd)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment