pgoutput-client 0.2.1 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 697aed85b1c507b7c0e6707bdff020075f31c35c1be6f74a3dff9a060987d69e
4
- data.tar.gz: ae49847c1b076c79754149cf3b7db0f32ee14f487a1c1ab03531b4a37fc42ab8
3
+ metadata.gz: a375cce8bbb2d330974bfd22bdc0a7542c1c1ed5fe73f448e41bba717532aac2
4
+ data.tar.gz: 3c20c8e182548d5556d4a8a503a92d2d8c89d5c926a59eaaf537812d4bb5cdca
5
5
  SHA512:
6
- metadata.gz: 326686eeecf787c33b5ed9daa8d0491fa441a17ac9936666b7e130fba67a1fdaa6b136a86ed903398fd6d2c48e4037199763e03d8390bd5671184e28311eb5f6
7
- data.tar.gz: 68290690628bef4393ef04867fdfd63337159e85505943062960173a9e5c0eaffb2b00b18eec03372f8d4cba4f02cb2601166eb2d25d98fd0cf6e0ebac387ff9
6
+ metadata.gz: 78fc7ede75ae5fcd4b27adddef61d1f6b59ba8a26943bb44bf93d0dc5f2d97a477f36d12ec935fdf083792cbc8d37418e0b2a9f84fb7d14d15aa7e5847f8d2fd
7
+ data.tar.gz: 58ea9e8475789846b3caad462fcfef693df07ad8ef9cf724e877f38ba2ca53a73b3e1476971a7b5b1c9ad47bb0b8c20fae2e31f47674a377bf03c7d09cb1533c
data/CHANGELOG.md CHANGED
@@ -2,6 +2,71 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.2.3 - 2026-06-17
6
+
7
+ ### Fixed
8
+
9
+ * Fixed automatic replication slot creation when `auto_create_slot` is enabled.
10
+ * Fixed startup failure when the configured replication slot already exists.
11
+ * Improved logical replication restart behavior for persistent replication slots.
12
+ * Improved lifecycle management of existing replication slots across process and container restarts.
13
+
14
+ ### Changed
15
+
16
+ * `auto_create_slot` now follows **ensure slot exists** semantics.
17
+ * Existing replication slots are treated as valid and reusable when automatic slot creation is enabled.
18
+ * Slot creation remains automatic for missing slots and idempotent for existing slots.
19
+
20
+ ### Internal
21
+
22
+ * Hardened replication slot lifecycle handling.
23
+ * Expanded coverage around automatic slot creation scenarios.
24
+ * Updated signatures and tests for slot creation behavior.
25
+
26
+
27
+ ## 0.2.2 - 2026-06-17
28
+
29
+ ### Added
30
+
31
+ * Added periodic standby status feedback while replication streams are idle.
32
+ * Added E2E coverage for PostgreSQL restart and replication recovery.
33
+ * Added E2E validation of replication slot resume behavior after reconnect.
34
+ * Added test coverage for idle replication streams.
35
+
36
+ ### Changed
37
+
38
+ * Increased reconnect retry budget to better tolerate PostgreSQL restart windows.
39
+ * Improved replication stream resilience during transient PostgreSQL outages.
40
+ * Improved reconnect behavior when PostgreSQL is starting up and temporarily rejecting connections.
41
+
42
+ ### Fixed
43
+
44
+ * Fixed replication timeout during idle logical replication streams.
45
+
46
+ * Fixed walsender termination caused by missing standby feedback during periods without WAL activity.
47
+
48
+ * Fixed reconnect handling after PostgreSQL restart.
49
+
50
+ * Fixed connection recovery when PostgreSQL reports:
51
+
52
+ ```
53
+ FATAL: the database system is starting up
54
+ ```
55
+
56
+ * Fixed E2E PostgreSQL test infrastructure and restart recovery validation.
57
+
58
+ * Fixed test isolation between unit and E2E PostgreSQL connection paths.
59
+
60
+ ### Internal
61
+
62
+ * Expanded transport lifecycle validation.
63
+ * Improved operational reliability of long-running replication sessions.
64
+
65
+
66
+ ## [0.2.1] - 2026-06-16
67
+
68
+ - Gemspec summary and description improvement release only
69
+
5
70
  ## [0.2.0] - 2026-06-16
6
71
 
7
72
  ### Fixed
@@ -37,7 +37,7 @@ module Pgoutput
37
37
  # @see Stream
38
38
  # @api public
39
39
  class Runner
40
- DEFAULT_RECONNECT_ATTEMPTS = 3
40
+ DEFAULT_RECONNECT_ATTEMPTS = 30
41
41
  DEFAULT_RECONNECT_BACKOFF = 0.5
42
42
 
43
43
  # Configuration used by this runner.
@@ -70,6 +70,7 @@ module Pgoutput
70
70
  @resume_lsn = configuration.start_lsn
71
71
  @acked_lsn = configuration.start_lsn
72
72
  @slot_created = false
73
+ @connected_once = false
73
74
  @last_error = nil
74
75
  @reconnect_attempts = 0
75
76
  end
@@ -193,26 +194,38 @@ module Pgoutput
193
194
  private
194
195
 
195
196
  def setup_connection(connection)
196
- if configuration.auto_create_slot && !@slot_created
197
- connection.create_replication_slot
198
- @slot_created = true
199
- end
197
+ ensure_replication_slot(connection) if configuration.auto_create_slot && !@slot_created
200
198
 
201
199
  connection.start_replication
202
200
  end
203
201
 
202
+ def ensure_replication_slot(connection)
203
+ connection.create_replication_slot
204
+ @slot_created = true
205
+ rescue ConnectionError => e
206
+ raise unless replication_slot_already_exists?(e)
207
+
208
+ @slot_created = true
209
+ end
210
+
211
+ def replication_slot_already_exists?(error)
212
+ error.message.match?(/replication slot .* already exists/i)
213
+ end
214
+
204
215
  def run_stream_cycle(configuration, &block)
205
216
  connection = Connection.open(configuration)
206
217
  setup_connection(connection)
218
+ @connected_once = true
207
219
  @stream = Stream.new(connection:, configuration:, acked_lsn: @acked_lsn)
208
220
  @stream.start(&block)
209
221
  :done
210
222
  rescue ConnectionError => e
211
223
  @last_error = e
212
- raise if @stopped || @stream.nil?
224
+ raise if @stopped
225
+ raise if @stream.nil? && !@connected_once
213
226
 
214
- @resume_lsn = @stream.latest_lsn || @resume_lsn
215
- @acked_lsn = @stream.acked_lsn || @acked_lsn
227
+ @resume_lsn = @stream&.latest_lsn || @resume_lsn
228
+ @acked_lsn = @stream&.acked_lsn || @acked_lsn
216
229
  :retry
217
230
  ensure
218
231
  @stream = nil
@@ -78,6 +78,7 @@ module Pgoutput
78
78
  while @running
79
79
  copy_data = @connection.get_copy_data
80
80
  if copy_data.nil?
81
+ send_periodic_feedback
81
82
  sleep 0.01
82
83
  next
83
84
  end
@@ -5,6 +5,6 @@ module Pgoutput
5
5
  # Current pgoutput-client gem version.
6
6
  #
7
7
  # @return [String]
8
- VERSION = "0.2.1"
8
+ VERSION = "0.2.3"
9
9
  end
10
10
  end
@@ -53,7 +53,7 @@ module Pgoutput
53
53
 
54
54
  @reconnect_attempts: untyped
55
55
 
56
- DEFAULT_RECONNECT_ATTEMPTS: 3
56
+ DEFAULT_RECONNECT_ATTEMPTS: 30
57
57
 
58
58
  DEFAULT_RECONNECT_BACKOFF: ::Float
59
59
 
@@ -83,6 +83,10 @@ module Pgoutput
83
83
 
84
84
  def setup_connection: (untyped connection) -> untyped
85
85
 
86
+ def ensure_replication_slot: (untyped connection) -> untyped
87
+
88
+ def replication_slot_already_exists?: (untyped error) -> bool
89
+
86
90
  def run_stream_cycle: (untyped configuration) { (?) -> untyped } -> untyped
87
91
 
88
92
  def configuration_for_resume: () -> untyped
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pgoutput-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ken C. Demanawa