I run long DBT-2 with 8.3beta2 and saw checkpoint spikes periodically.
The progress against WAL segments consumption *jumped up* in such cases.

It seems to be a miscalculation in IsCheckpointOnSchedule().
xrecoff is uint32, therefore the difference of two xrecoffs could
be between -4G and +4G. We should not cast it to int32, that domain
is [-2G, +2G).

Here is a patch to fix it, casting xrecoff to double directly.

Index: src/backend/postmaster/bgwriter.c
--- src/backend/postmaster/bgwriter.c   (HEAD)
+++ src/backend/postmaster/bgwriter.c   (working copy)
@@ -718,7 +718,7 @@
        recptr = GetInsertRecPtr();
        elapsed_xlogs =
                (((double) (int32) (recptr.xlogid - ckpt_start_recptr.xlogid)) 
* XLogSegsPerFile +
-                ((double) (int32) (recptr.xrecoff - 
ckpt_start_recptr.xrecoff)) / XLogSegSize) /
+                ((double) recptr.xrecoff - (double) ckpt_start_recptr.xrecoff) 
/ XLogSegSize) /
        if (progress < elapsed_xlogs)

ITAGAKI Takahiro
NTT Open Source Software Center

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?


Reply via email to