|
7 | 7 | * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
|
8 | 8 | * Portions Copyright (c) 1994, Regents of the University of California
|
9 | 9 | *
|
10 |
| - * $Header: /cvsroot/pgsql/src/backend/access/transam/xlog.c,v 1.82 2001/11/05 17:46:24 momjian Exp $ |
| 10 | + * $Header: /cvsroot/pgsql/src/backend/access/transam/xlog.c,v 1.83 2001/12/19 19:42:51 tgl Exp $ |
11 | 11 | *
|
12 | 12 | *-------------------------------------------------------------------------
|
13 | 13 | */
|
@@ -744,9 +744,13 @@ begin:;
|
744 | 744 | /* If first XLOG record of transaction, save it in PROC array */
|
745 | 745 | if (MyLastRecPtr.xrecoff==0&& !no_tran)
|
746 | 746 | {
|
747 |
| -LWLockAcquire(SInvalLock,LW_EXCLUSIVE); |
| 747 | +/* |
| 748 | + * We do not acquire SInvalLock here because of possible deadlock. |
| 749 | + * Anyone who wants to inspect other procs' logRec must acquire |
| 750 | + * WALInsertLock, instead. A better solution would be a per-PROC |
| 751 | + * spinlock, but no time for that before 7.2 --- tgl 12/19/01. |
| 752 | + */ |
748 | 753 | MyProc->logRec=RecPtr;
|
749 |
| -LWLockRelease(SInvalLock); |
750 | 754 | }
|
751 | 755 |
|
752 | 756 | if (XLOG_DEBUG)
|
@@ -2928,11 +2932,22 @@ CreateCheckPoint(bool shutdown)
|
2928 | 2932 | * this while holding insert lock to ensure that we won't miss any
|
2929 | 2933 | * about-to-commit transactions (UNDO must include all xacts that have
|
2930 | 2934 | * commits after REDO point).
|
| 2935 | + * |
| 2936 | + * XXX temporarily ifdef'd out to avoid three-way deadlock condition: |
| 2937 | + * GetUndoRecPtr needs to grab SInvalLock to ensure that it is looking |
| 2938 | + * at a stable set of proc records, but grabbing SInvalLock while holding |
| 2939 | + * WALInsertLock is no good. GetNewTransactionId may cause a WAL record |
| 2940 | + * to be written while holding XidGenLock, and GetSnapshotData needs to |
| 2941 | + * get XidGenLock while holding SInvalLock, so there's a risk of deadlock. |
| 2942 | + * Need to find a better solution. See pgsql-hackers discussion of |
| 2943 | + * 17-Dec-01. |
2931 | 2944 | */
|
| 2945 | +#ifdefNOT_USED |
2932 | 2946 | checkPoint.undo=GetUndoRecPtr();
|
2933 | 2947 |
|
2934 | 2948 | if (shutdown&&checkPoint.undo.xrecoff!=0)
|
2935 | 2949 | elog(STOP,"active transaction while database system is shutting down");
|
| 2950 | +#endif |
2936 | 2951 |
|
2937 | 2952 | /*
|
2938 | 2953 | * Now we can release insert lock, allowing other xacts to proceed
|
|