koyo-postgres-replication 0.1.0.pre → 0.1.1.pre
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 +4 -4
- data/Gemfile +1 -1
- data/Gemfile.lock +1 -1
- data/README.md +13 -0
- data/changelog.md +4 -0
- data/koyo-postgres-replication.gemspec +1 -3
- data/lib/koyo/repl/configuration.rb +6 -6
- data/lib/koyo/repl/diagnostics.rb +1 -1
- data/lib/koyo/repl/postgres_server.rb +20 -21
- data/lib/koyo/repl/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 52f66b5b4c592753e8cb81e6291a035289cce3f58bc610e4d78de5a1c0bb6fa9
|
4
|
+
data.tar.gz: bbb086947453e1937f052ed86e6dd68efd4797b5a2d2ecaaccb77de92185832a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd86fc705158b786bb847522d25bcccd881c55758a5f0857d8696fa6cee60972c1ca8ff0bf2bced4ad6444c5891a32acc19ed586d738eaea0b8c3cd34dac2218
|
7
|
+
data.tar.gz: 7c48ed00f79b044873fafbef2e9ced4828caa50d0804d2720d220c49052fe3db67a22230312db1de91cc4ddaad2d21f5cdda04dfaf6efcf13bcbca176184c737
|
data/Gemfile
CHANGED
@@ -6,9 +6,9 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
|
6
6
|
# Specify your gem's dependencies in koyo_repl.gemspec
|
7
7
|
gemspec
|
8
8
|
|
9
|
+
gem 'pg', '~> 1.1'
|
9
10
|
gem 'rails', '~> 7.0'
|
10
11
|
gem 'rake', '~> 13.0'
|
11
|
-
gem 'pg', '~> 1.1'
|
12
12
|
|
13
13
|
group :development, :test do
|
14
14
|
gem 'debug', platforms: %i[mri mingw x64_mingw]
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
# Koyo::Postgres::Replication
|
2
2
|
|
3
|
+
例 rei - Japanese for example
|
4
|
+
効用 koyo - Japanese for utility
|
5
|
+
|
3
6
|
## Replcation slots
|
4
7
|
|
5
8
|
This gem tries to simplify dealing with a `replication slot` in Postgres.
|
@@ -185,6 +188,16 @@ TODO: update
|
|
185
188
|
* run rubocop
|
186
189
|
* add/run yard
|
187
190
|
|
191
|
+
# Working with gem
|
192
|
+
|
193
|
+
## Gem Build
|
194
|
+
|
195
|
+
```
|
196
|
+
rm koyo-postgres-replication-{current version}.gem
|
197
|
+
git add .
|
198
|
+
gem build
|
199
|
+
```
|
200
|
+
|
188
201
|
# TODO
|
189
202
|
|
190
203
|
* add monitoring helpers
|
data/changelog.md
CHANGED
@@ -12,3 +12,7 @@
|
|
12
12
|
- utility class for working with replication slots
|
13
13
|
- functional - but not tested in real life yet
|
14
14
|
|
15
|
+
## 0.1.1.pre
|
16
|
+
|
17
|
+
- remove deprecated has_rdoc from gem spec
|
18
|
+
- fix [Issue 1](https://github.com/wiseleyb/koyo-postgres-replication/issues/1) - remove recursive run, replace with simple loop
|
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
# spec.metadata["allowed_push_host"] = ''
|
21
21
|
spec.metadata['changelog_uri'] = "#{url}/changelog.md"
|
22
22
|
spec.metadata['homepage_uri'] = spec.homepage
|
23
|
-
spec.metadata['source_code_uri'] =
|
23
|
+
spec.metadata['source_code_uri'] = burl
|
24
24
|
|
25
25
|
spec.files = Dir.chdir(__dir__) do
|
26
26
|
`git ls-files -z`.split("\x0").reject do |f|
|
@@ -38,6 +38,4 @@ Gem::Specification.new do |spec|
|
|
38
38
|
spec.add_dependency 'rake', '~> 13.0'
|
39
39
|
spec.add_development_dependency 'rspec-rails', '~> 3.1'
|
40
40
|
spec.add_development_dependency 'yard', '~> 0.9'
|
41
|
-
|
42
|
-
spec.has_rdoc = 'yard'
|
43
41
|
end
|
@@ -92,12 +92,12 @@ module Koyo
|
|
92
92
|
# Helper method that converts config settings into a hash
|
93
93
|
def to_h
|
94
94
|
{
|
95
|
-
auto_create_replication_slot
|
96
|
-
config_prefix
|
97
|
-
database_name
|
98
|
-
slot
|
99
|
-
sql_delay
|
100
|
-
test_mode:
|
95
|
+
auto_create_replication_slot:,
|
96
|
+
config_prefix:,
|
97
|
+
database_name:,
|
98
|
+
slot:,
|
99
|
+
sql_delay:,
|
100
|
+
test_mode:
|
101
101
|
}
|
102
102
|
end
|
103
103
|
|
@@ -45,27 +45,27 @@ module Koyo
|
|
45
45
|
# Runs the server. You should only be running ONE of these
|
46
46
|
# servers at a time.
|
47
47
|
def run!
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
48
|
+
loop do
|
49
|
+
begin
|
50
|
+
check
|
51
|
+
tick_tock
|
52
|
+
# Possibly fatal errors
|
53
|
+
rescue ActiveRecord::StatementInvalid => e
|
54
|
+
if e.cause.exception.is_a?(PG::ConnectionBad)
|
55
|
+
Koyo::Repl::EventHandlerService.koyo_error(e)
|
56
|
+
msg = "SHUTTING DOWN. Fatal Error in ReplPostgresServer: #{e.message}"
|
57
|
+
log_repl_fatal(msg, err: e)
|
58
|
+
break
|
59
|
+
else
|
60
|
+
log_recoverable_error(e)
|
61
|
+
end
|
62
|
+
# recoverable error
|
63
|
+
rescue StandardError => e
|
63
64
|
log_recoverable_error(e)
|
64
|
-
run!
|
65
65
|
end
|
66
|
-
|
67
|
-
|
68
|
-
|
66
|
+
|
67
|
+
success = system("sleep #{Koyo::Repl.config.sql_delay}")
|
68
|
+
break unless success
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
@@ -75,8 +75,7 @@ module Koyo
|
|
75
75
|
def log_recoverable_error(err)
|
76
76
|
Koyo::Repl::EventHandlerService.koyo_error(err)
|
77
77
|
msg = "Error in ReplPostgresServer: #{err.message}"
|
78
|
-
log_repl_error(msg, err:
|
79
|
-
sleep Koyo::Repl.config.sql_delay
|
78
|
+
log_repl_error(msg, err:)
|
80
79
|
end
|
81
80
|
|
82
81
|
# Basic heart beat ping to allow you to see the server is still
|
data/lib/koyo/repl/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: koyo-postgres-replication
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1.pre
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Wiseley
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-08-
|
11
|
+
date: 2023-08-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pg
|
@@ -145,7 +145,7 @@ licenses:
|
|
145
145
|
metadata:
|
146
146
|
changelog_uri: https://github.com/wiseleyb/koyo-postgres-replication/changelog.md
|
147
147
|
homepage_uri: https://github.com/wiseleyb
|
148
|
-
source_code_uri: https://github.com/wiseleyb
|
148
|
+
source_code_uri: https://github.com/wiseleyb
|
149
149
|
post_install_message:
|
150
150
|
rdoc_options: []
|
151
151
|
require_paths:
|