On 7/19/23 12:53, Tomas Vondra wrote:
> ...
>
> I did however look at the proposed alternative to the "created" flag.
> The attached 0006 part ditches the flag with XLOG_SMGR_CREATE decoding.
> The smgr_decode code needs a review (I'm not sure the
> skipping/fast-forwarding part is correct), but it seems to be working
> fine overall, although we need to ensure the WAL record has the correct XID.
>
cfbot reported two issues in the patch - compilation warning, due to
unused variable in sequence_decode, and a failing test in test_decoding.
The second thing happens because when creating the relfilenode, it may
happen before we know the XID. The patch already does ensure the WAL
with the sequence data has XID, but that's later. And when the CREATE
record did not have the correct XID, that broke the logic deciding which
increments should be "transactional".
This forces us to assign XID a bit earlier (it'd happen anyway, when
logging the increment). There's a bit of a drawback, because we don't
have the relation yet, so we can't do RelationNeedsWAL ...
regards
--
Tomas Vondra
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company