wal 0.0.30 → 0.0.32

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: 629931aa6280e9b0f00fbc62ae9cc588771be9631fe2ee4ab5b346f884d52b27
4
- data.tar.gz: 9144033bc75fceec8b94f33bfb67b3577bc0a1c9731353c56b6c499afd213b33
3
+ metadata.gz: e8f18e327f41668911967dbb73d0f6c51ab43f2b5d1d25b7c39b5f5130a04081
4
+ data.tar.gz: d0ffc96073a5faa4fd3949a02348b029bd206196fdd61c71883e5115ee53d6fa
5
5
  SHA512:
6
- metadata.gz: 3eb7fcf6d3ceea6f5d72cbcc75ffd67c99fcd688a06cfb8a8e412a428e4c6c5ef7dc44178ab4219d94e4a6e15ea8b4d3c45f00bbf96c33dec6103f688295ca50
7
- data.tar.gz: f5b8260db91d66be7cf77a391d9a98285bb5773638778afffb2aa02b9b89a306937310104fffed49d8a658f33f0ae818ea35adb138461a3e0634ce341e63af2c
6
+ metadata.gz: effddb80b5b8093e572e65a587f5b7975cb20750aa39e7c329cb7358bd099d3bd12110648ee5b11c4dd45d791c1d050e6b0e7e82c7585c1678f9b1c532d54395
7
+ data.tar.gz: 35e21330e4da4297adcf4cbfa67ce939b5894981b352acfbc7fe8c02b1083436d037e9f7be45445445ef621ec783c84ce866f8636379609d7ff8c62e7c9fd392
@@ -118,8 +118,8 @@ module Wal
118
118
  in XLogData(lsn:, data: PG::Replication::PGOutput::Update(oid:, new:, old:))
119
119
  table = tables[oid]
120
120
  next unless watcher.should_watch_table? table.full_table_name
121
- old_data = table.decode_row(old)
122
121
  new_data = table.decode_row(new)
122
+ old_data = table.decode_row(old, new_data)
123
123
  record_id = table.primary_key(new_data)
124
124
  next unless record_id
125
125
 
@@ -412,10 +412,10 @@ module Wal
412
412
  values.size == 1 ? values.first : values
413
413
  end
414
414
 
415
- def decode_row(values)
415
+ def decode_row(values, existing_data = {})
416
416
  values
417
417
  .zip(columns)
418
- .map { |tuple, col| [col.name, col.decode(tuple.data)] }
418
+ .map { |tuple, col| [col.name, tuple.toast? ? existing_data[col.name] : col.decode(tuple.data)] }
419
419
  .to_h
420
420
  end
421
421
  end
data/lib/wal/runner.rb CHANGED
@@ -23,6 +23,7 @@ module Wal
23
23
  temporary = config["temporary"] || false
24
24
  publications = config["publications"] || []
25
25
  replicator_class = config["replicator"].presence&.constantize || Wal::Replicator
26
+ replicator_params = config["replicator_params"]&.transform_keys(&:to_sym) || {}
26
27
  auto_restart = config["auto_restart"].nil? || config["auto_restart"]
27
28
  max_retries = config["retries"]&.to_i || (2**32 - 1)
28
29
  backoff = config["retry_backoff"]&.to_f || 1
@@ -35,7 +36,7 @@ module Wal
35
36
 
36
37
  begin
37
38
  replicator_class
38
- .new(replication_slot:, use_temporary_slot:, db_config:)
39
+ .new(db_config:, **replicator_params, replication_slot:, use_temporary_slot:)
39
40
  .replicate_forever(Wal::LoggingWatcher.new(replication_slot, watcher), publications:)
40
41
  if auto_restart
41
42
  backoff_time = backoff_exponent ? (backoff * retries) ** backoff_exponent : backoff
@@ -44,6 +45,8 @@ module Wal
44
45
  puts "Restarting #{replication_slot}"
45
46
  redo
46
47
  end
48
+ rescue ArgumentError
49
+ raise
47
50
  rescue StandardError => err
48
51
  if retries < max_retries
49
52
  Wal.logger&.error("[#{replication_slot}] Error #{err}")
data/lib/wal/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Wal
4
- VERSION = "0.0.30"
4
+ VERSION = "0.0.32"
5
5
  end
data/rbi/wal.rbi CHANGED
@@ -7,7 +7,7 @@ module Wal
7
7
  UpdateEvent,
8
8
  DeleteEvent,
9
9
  ) }
10
- VERSION = "0.0.30"
10
+ VERSION = "0.0.32"
11
11
 
12
12
  class << self
13
13
  sig { returns(T.class_of(Logger)) }
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wal
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.30
4
+ version: 0.0.32
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rodrigo Navarro
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2026-01-21 00:00:00.000000000 Z
10
+ date: 2026-01-28 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: pg