Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more options for xmins and nextxids #63

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

addisonj
Copy link

This adds two more options for additional metadata into the slot:

  • include-xmins This data includes the catalog_xmin and xmin fields
    from the replication slot. The reasons for wanting this generally occurs when
    using logical replication with a secondary. Since replication slots don't
    get replicated to secondaries, in the event of the failover you need
    some mechanism for seeing what records you may have missed. The
    xmin/catalog_xmin is useful as you can use it for a lower bound and any
    records with a higher xmin could have been missed
  • include-next-xids This includes sending both the epoch and
    nextxid 32-bit ints. The epoch is a number that increments when xid
    rollover happens. This allows you to reconstruct the same txid you get
    from the txid_current function which accounts for rollover. This can
    be really useful to see at a point's time how far behind the slot you
    currently are.

This adds two more options for additional metadata into the slot:

- `include-xmins` This data includes the `catalog_xmin` and `xmin` fields
from the replication slot. The reasons for wanting this generally occurs when
using logical replication with a secondary. Since replication slots don't
get replicated to secondaries, in the event of the failover you need
some mechanism for seeing what records you may have missed. The
xmin/catalog_xmin is useful as you can use it for a lower bound and any
records with a higher xmin could have been missed
- `include-next-xids` This includes sending both the `epoch` and
`nextxid` 32-bit ints. The epoch is a number that increments when xid
rollover happens. This allows you to reconstruct the same txid you get
from the `txid_current` function which accounts for rollover. This can
be really useful to see at a point's time how far behind the slot you
currently are.
@eulerto
Copy link
Owner

eulerto commented May 20, 2018

@addisonj You submitted two features and it should be two pull requests or at least two commits. I saw that you change some unrelated lines, fix them.
I can see the usefulness of xmin and catalog_xmin while postgres does not support failover slots (replication slots on replica). Tests aren't useful.
I'm not sure someone will use include-next-xids to track replication lag. It is simple to query pg_stat_replication or even pg_replication_slots.

@jmealo
Copy link

jmealo commented Apr 6, 2019

@addisonj: seems fair to pull apart the PR but I can definitely see the value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants