7
7
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
8
8
* Portions Copyright (c) 1994, Regents of the University of California
9
9
*
10
- * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.144 2004/05/28 05:12:42 tgl Exp $
10
+ * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.145 2004/05/29 22:48:18 tgl Exp $
11
11
*
12
12
*-------------------------------------------------------------------------
13
13
*/
27
27
#include "access/xlogutils.h"
28
28
#include "catalog/catversion.h"
29
29
#include "catalog/pg_control.h"
30
+ #include "postmaster/bgwriter.h"
30
31
#include "storage/bufpage.h"
31
32
#include "storage/fd.h"
32
33
#include "storage/lwlock.h"
33
- #include "storage/pmsignal.h"
34
34
#include "storage/proc.h"
35
35
#include "storage/sinval.h"
36
36
#include "storage/spin.h"
@@ -1206,9 +1206,9 @@ XLogWrite(XLogwrtRqst WriteRqst)
1206
1206
{
1207
1207
#ifdef WAL_DEBUG
1208
1208
if (XLOG_DEBUG )
1209
- elog (LOG , "time for a checkpoint, signaling postmaster " );
1209
+ elog (LOG , "time for a checkpoint, signaling bgwriter " );
1210
1210
#endif
1211
- SendPostmasterSignal ( PMSIGNAL_DO_CHECKPOINT );
1211
+ RequestCheckpoint (false );
1212
1212
}
1213
1213
}
1214
1214
LWLockRelease (ControlFileLock );
@@ -3087,11 +3087,6 @@ StartupXLOG(void)
3087
3087
RmgrTable [rmid ].rm_cleanup ();
3088
3088
}
3089
3089
3090
- /* suppress in-transaction check in CreateCheckPoint */
3091
- MyLastRecPtr .xrecoff = 0 ;
3092
- MyXactMadeXLogEntry = false;
3093
- MyXactMadeTempRelUpdate = false;
3094
-
3095
3090
/*
3096
3091
* At this point, ThisStartUpID is the largest SUI that we could
3097
3092
* find evidence for in the WAL entries. But check it against
@@ -3293,11 +3288,6 @@ ShutdownXLOG(int code, Datum arg)
3293
3288
ereport (LOG ,
3294
3289
(errmsg ("shutting down" )));
3295
3290
3296
- /* suppress in-transaction check in CreateCheckPoint */
3297
- MyLastRecPtr .xrecoff = 0 ;
3298
- MyXactMadeXLogEntry = false;
3299
- MyXactMadeTempRelUpdate = false;
3300
-
3301
3291
CritSectionCount ++ ;
3302
3292
CreateCheckPoint (true, true);
3303
3293
ShutdownCLOG ();
@@ -3324,27 +3314,13 @@ CreateCheckPoint(bool shutdown, bool force)
3324
3314
uint32 _logId ;
3325
3315
uint32 _logSeg ;
3326
3316
3327
- if (MyXactMadeXLogEntry )
3328
- ereport (ERROR ,
3329
- (errcode (ERRCODE_ACTIVE_SQL_TRANSACTION ),
3330
- errmsg ("checkpoint cannot be made inside transaction block" )));
3331
-
3332
3317
/*
3333
3318
* Acquire CheckpointLock to ensure only one checkpoint happens at a
3334
- * time.
3335
- *
3336
- * The CheckpointLock can be held for quite a while, which is not good
3337
- * because we won't respond to a cancel/die request while waiting for
3338
- * an LWLock. (But the alternative of using a regular lock won't work
3339
- * for background checkpoint processes, which are not regular
3340
- * backends.) So, rather than use a plain LWLockAcquire, use this
3341
- * kluge to allow an interrupt to be accepted while we are waiting:
3319
+ * time. (This is just pro forma, since in the present system
3320
+ * structure there is only one process that is allowed to issue
3321
+ * checkpoints at any given time.)
3342
3322
*/
3343
- while (!LWLockConditionalAcquire (CheckpointLock , LW_EXCLUSIVE ))
3344
- {
3345
- CHECK_FOR_INTERRUPTS ();
3346
- pg_usleep (1000000L );
3347
- }
3323
+ LWLockAcquire (CheckpointLock , LW_EXCLUSIVE );
3348
3324
3349
3325
/*
3350
3326
* Use a critical section to force system panic if we have trouble.
0 commit comments