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: Extend ReplicationCreateSlotBuilder DSL to support temporary replications slots #1306

Merged

Conversation

Projects
None yet
3 participants
@PSanetra
Copy link
Contributor

commented Oct 3, 2018

With Postgres 10 it is possible to create temporary replication slots.
The Postgres JDBC Driver provides a DSL to create replication slots, but there was no option to declare the slot as temporary.
This PR extends the DSL by a withTemporaryOption method.

BREAKING CHANGE: AbstractCreateSlotBuilder has no parameterless constructor anymore
Closes #1305

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 ?

Changes to Existing Features:

  • Does this break existing behaviour? If so please explain.
    The AbstractCreateSlotBuilder constructor now has a BaseConnection parameter which is required to check the server version in the new withTemporaryOption method.

  • Have you added an explanation of what your changes do and why you'd like us to include them?

  • Have you written new tests for your core changes, as applicable?

  • Have you successfully run tests with your changes locally?

@@ -17,4 +28,15 @@ public T withSlotName(String slotName) {
this.slotName = slotName;
return self();
}

@Override
public T withTemporaryOption(boolean temporaryOption) throws SQLFeatureNotSupportedException {

This comment has been minimized.

Copy link
@davecramer

davecramer Oct 4, 2018

Member

I don't think there is any need to pass a boolean in to this. Set the default to false and set it to true in the function

public T withTemporaryOption(boolean temporaryOption) throws SQLFeatureNotSupportedException {

if (temporaryOption && !connection.haveMinimumServerVersion(ServerVersion.v10)) {
throw new SQLFeatureNotSupportedException("Server does not support temporary replication slots");

This comment has been minimized.

Copy link
@davecramer

davecramer Oct 4, 2018

Member

Should probably make the message language translatable using GT.tr

@PSanetra PSanetra force-pushed the PSanetra:feat/support-temporary-replication-slots branch from 8bcc181 to e25bda1 Oct 4, 2018

@codecov-io

This comment has been minimized.

Copy link

commented Oct 4, 2018

Codecov Report

Merging #1306 into master will decrease coverage by <.01%.
The diff coverage is 92.3%.

@@             Coverage Diff              @@
##             master    #1306      +/-   ##
============================================
- Coverage     68.54%   68.53%   -0.01%     
- Complexity     3876     3878       +2     
============================================
  Files           178      178              
  Lines         16192    16198       +6     
  Branches       2642     2644       +2     
============================================
+ Hits          11098    11101       +3     
  Misses         3864     3864              
- Partials       1230     1233       +3

@Test
public void testCreateTemporaryPhysicalSlot() throws Exception {
BaseConnection baseConnection = (BaseConnection) replConnection;

This comment has been minimized.

Copy link
@davecramer

davecramer Oct 5, 2018

Member

The more idiomatic way of dealing with checking the version in the test is:
assumeTrue(TestUtil.haveMinimumServerVersion(con, ServerVersion.v10_0));
as the first line

@PSanetra PSanetra force-pushed the PSanetra:feat/support-temporary-replication-slots branch from e25bda1 to 46a2cda Oct 5, 2018

feat: Extend ReplicationCreateSlotBuilder DSL to support temporary re…
…plications slots

With Postgres 10 it is possible to create temporary replication slots.
The Postgres JDBC Driver provides a DSL to create replication slots, but there was no option to declare the slot as temporary.
This commit extends the DSL by a withTemporaryOption method.

BREAKING CHANGE: AbstractCreateSlotBuilder has no parameterless constructor anymore
Closes #1305

@PSanetra PSanetra force-pushed the PSanetra:feat/support-temporary-replication-slots branch from 46a2cda to 076c242 Oct 5, 2018

@davecramer davecramer merged commit d514ceb into pgjdbc:master Oct 6, 2018

2 checks passed

codecov/project Absolute coverage decreased by -<.01% but relative coverage increased by +23.76% compared to 265f22b
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
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.