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

feat: return info on create slot of replication #1335

Merged
merged 1 commit into from Nov 22, 2018

Conversation

Projects
None yet
4 participants
@jorsol
Copy link
Contributor

commented Nov 7, 2018

The CREATE_REPLICATION_SLOT replication command returns the following info: slot_name, consistent_point, snapshot_name, output_plugin.

This info can be valuable, in particular, snapshot_name is exported on the logical slot creation to allow a consistent snapshot in some uses cases that require it.

A new class ReplicationSlotInfo is being returned now to have easy access to the values.

All Submissions:

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

New Feature Submissions:

  1. Does your submission pass tests?
  2. Does mvn checkstyle:check pass ?
@pbillen

This comment has been minimized.

Copy link
Contributor

commented Nov 7, 2018

+1 for this feature. It is very useful for this flow:

  1. create replication slot
  2. get corresponding snapshot id
  3. start repeatable read/serializable transaction
  4. call SET TRANSACTION SNAPSHOT <snapshot id>

Now you can query the database to get a consistent view in your application, and consume the replication slow to update that view accordingly.

@pbillen

This comment has been minimized.

Copy link
Contributor

commented Nov 7, 2018

Regarding the code, (imho) I believe it's cleaner to return a dedicated class with getters such as getSlotName(), getConsistentPoint(), ... instead of a rather typeless Map<String, String>.

@jorsol

This comment has been minimized.

Copy link
Contributor Author

commented Nov 7, 2018

@pbillen it might be a good idea to return a dedicated class... I will try that.

@pbillen

This comment has been minimized.

Copy link
Contributor

commented Nov 7, 2018

@jorsol You could use org.postgresql.replication.LogSequenceNumber as type of consistent point field.

@jorsol

This comment has been minimized.

Copy link
Contributor Author

commented Nov 7, 2018

Do you have some sugestion on the class name?

@pbillen

This comment has been minimized.

Copy link
Contributor

commented Nov 7, 2018

Maybe ReplicationSlotInfo?

Please note I am not a maintainer of this project, so you might want to wait for feedback from other reviewers. I just got excited :).

@davecramer

This comment has been minimized.

Copy link
Member

commented Nov 7, 2018

ReplicationSlotInfo works for me

feat: return info on create slot of replication
The CREATE_REPLICATION_SLOT replication command return the following
info: slot_name, consistent_point, snapshot_name, output_plugin.

This info can be valuable, in particular snapshot_name is exported
to allow a consistent snapshot in some uses cases that requires it.

A new class ReplicationSlotInfo is being returned now to have easy
access to the values.

@jorsol jorsol force-pushed the jorsol:return-create-replication-info branch from 09a9531 to 3c6af90 Nov 7, 2018

@codecov-io

This comment has been minimized.

Copy link

commented Nov 7, 2018

Codecov Report

Merging #1335 into master will increase coverage by 0.02%.
The diff coverage is 88.88%.

@@             Coverage Diff              @@
##             master    #1335      +/-   ##
============================================
+ Coverage     68.58%   68.61%   +0.02%     
- Complexity     3883     3888       +5     
============================================
  Files           178      179       +1     
  Lines         16205    16239      +34     
  Branches       2646     2650       +4     
============================================
+ Hits          11114    11142      +28     
- Misses         3860     3861       +1     
- Partials       1231     1236       +5
@jorsol

This comment has been minimized.

Copy link
Contributor Author

commented Nov 7, 2018

Done, changed to ReplicationSlotInfo.

@davecramer

This comment has been minimized.

Copy link
Member

commented Nov 8, 2018

LGTM

@davecramer davecramer merged commit 84e8d90 into pgjdbc:master Nov 22, 2018

2 checks passed

codecov/project 68.61% (+0.02%) compared to f3ade07
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@jorsol jorsol deleted the jorsol:return-create-replication-info branch Nov 22, 2018

@jorsol jorsol referenced this pull request Jun 18, 2019

Merged

Release notes for 42.2.6 #1511

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.