after a checkpoint. Otherwise you might get a torn page.
sequence_save_tuple() should force the tuple to be WAL-logged after a
checkpoint, even if !do_wal.
page = BufferGetPage(seqh->buf);
+ /*
+ * Force the change to be WAL-logged, if we the tuple hasn't been logged
+ * since the last checkpoint.
+ */
+ if (RelationNeedsWAL(seqh->rel) && sequence_needs_wal(seqh))
+ do_wal = true;
+
/*
* If something needs to be WAL logged, acquire an xid, so this
* transaction's commit will trigger a WAL flush and wait for