1. Fix for elog(ERROR, "EvalPlanQual: t_xmin is uncommitted ?!")
authorVadim B. Mikheev <vadim4o@yahoo.com>
Thu, 10 Jun 1999 14:17:12 +0000 (14:17 +0000)
committerVadim B. Mikheev <vadim4o@yahoo.com>
Thu, 10 Jun 1999 14:17:12 +0000 (14:17 +0000)
commit5c26c22b2aa37bfe5bc6c54e47cef6937a1903a5
tree8bd768d57d782e00e34997a7da378dc6fa447e00
parente6b5b58ba380cc6f5e7cb665fb8fe05078f81a66
1. Fix for elog(ERROR, "EvalPlanQual: t_xmin is uncommitted ?!")
   and possibly for other cases too:

   DO NOT cache status of transaction in unknown state
   (i.e. non-committed and non-aborted ones)

   Example:
   T1 reads row updated/inserted by running T2 and cache T2 status.
   T2 commits.
   Now T1 reads a row updated by T2 and with HEAP_XMAX_COMMITTED
   in t_infomask (so cached T2 status is not changed).
   Now T1 EvalPlanQual gets updated row version without HEAP_XMIN_COMMITTED
   -> TransactionIdDidCommit(t_xmin) and TransactionIdDidAbort(t_xmin)
   return FALSE and T2 decides that t_xmin is not committed and gets
   ERROR above.

   It's too late to find more smart way to handle such cases and so
   I just changed xact status caching and got rid TransactionIdFlushCache()
   from code.

   Changed: transam.c, xact.c, lmgr.c and transam.h - last three
   just because of TransactionIdFlushCache() is removed.

2. heapam.c:

   T1 marked a row for update. T2 waits for T1 commit/abort.
   T1 commits. T3 updates the row before T2 locks row page.
   Now T2 sees that new row t_xmax is different from xact id (T1)
   T2 was waiting for. Old code did Assert here. New one goes to
   HeapTupleSatisfiesUpdate. Obvious changes too.

3. Added Assert to vacuum.c
4. bufmgr.c: break
   Assert(buf->r_locks == 0 && !buf->ri_lock)
   into two Asserts.
src/backend/access/heap/heapam.c
src/backend/access/transam/transam.c
src/backend/access/transam/xact.c
src/backend/commands/vacuum.c
src/backend/storage/buffer/bufmgr.c
src/backend/storage/lmgr/lmgr.c
src/include/access/transam.h