pg-logical_replication 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.codeclimate.yml +7 -3
- data/.rubocop.yml +3 -2
- data/.rubocop_cc.yml +3 -3
- data/.travis.yml +3 -3
- data/CHANGELOG.md +13 -1
- data/CODEOWNERS +2 -0
- data/lib/pg/logical_replication/client.rb +42 -4
- data/lib/pg/logical_replication/version.rb +1 -1
- data/pg-logical_replication.gemspec +3 -3
- metadata +19 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: e75500586b542cd04f68c0dbb33f8196ac3eb142eed9c4ce91a4629634620d8c
|
4
|
+
data.tar.gz: 29f7f99ce968ffb4365a1a062d4d976c23f0291a374cd0e9ac80531150951c64
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 678bc7a4e39cf77600e04571a32a36c0f252da079dc68bcaae928b0cb589387da049d22b31384f110e6a713e90e53a91ba034224959aeabdcc1c1eff45db6eab
|
7
|
+
data.tar.gz: 67065974b3328afd258ca3cd82415470a91f1320e92f2e18657f8ac77ab56e095c2f63d8e1f9b81570f43f2170e0b403820f7ddad1fc742bf41487f00104c452
|
data/.codeclimate.yml
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
---
|
2
1
|
version: '2'
|
3
2
|
checks:
|
4
3
|
argument-count:
|
@@ -20,11 +19,16 @@ checks:
|
|
20
19
|
enabled: false
|
21
20
|
prepare:
|
22
21
|
fetch:
|
23
|
-
- url: https://raw.githubusercontent.com/ManageIQ/
|
22
|
+
- url: https://raw.githubusercontent.com/ManageIQ/manageiq-style/master/.rubocop_base.yml
|
24
23
|
path: ".rubocop_base.yml"
|
25
|
-
- url: https://raw.githubusercontent.com/ManageIQ/
|
24
|
+
- url: https://raw.githubusercontent.com/ManageIQ/manageiq-style/master/.rubocop_cc_base.yml
|
26
25
|
path: ".rubocop_cc_base.yml"
|
26
|
+
- url: https://raw.githubusercontent.com/ManageIQ/manageiq-style/master/styles/base.yml
|
27
|
+
path: styles/base.yml
|
28
|
+
- url: https://raw.githubusercontent.com/ManageIQ/manageiq-style/master/styles/cc_base.yml
|
29
|
+
path: styles/cc_base.yml
|
27
30
|
plugins:
|
28
31
|
rubocop:
|
29
32
|
enabled: true
|
30
33
|
config: ".rubocop_cc.yml"
|
34
|
+
channel: rubocop-0-82
|
data/.rubocop.yml
CHANGED
data/.rubocop_cc.yml
CHANGED
@@ -1,4 +1,4 @@
|
|
1
1
|
inherit_from:
|
2
|
-
- .rubocop_base.yml
|
3
|
-
- .rubocop_cc_base.yml
|
4
|
-
- .rubocop_local.yml
|
2
|
+
- ".rubocop_base.yml"
|
3
|
+
- ".rubocop_cc_base.yml"
|
4
|
+
- ".rubocop_local.yml"
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,18 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
This project adheres to [Semantic Versioning](https://semver.org/).
|
5
5
|
|
6
|
+
## [Unreleased]
|
7
|
+
|
8
|
+
## [1.1.0] - 2021-06-29
|
9
|
+
### Added
|
10
|
+
- Support providing the db name to the subscriber? method [[#7](https://github.com/ManageIQ/pg-logical_replication/pull/7)]
|
11
|
+
- Add create replication slot [[#8](https://github.com/ManageIQ/pg-logical_replication/pull/8)]
|
12
|
+
|
13
|
+
### Changed
|
14
|
+
- Cache type maps for queries/results [[#6](https://github.com/ManageIQ/pg-logical_replication/pull/6)]
|
15
|
+
|
6
16
|
## [1.0.0] - 2019-05-08
|
7
17
|
|
8
|
-
[Unreleased]: https://github.com/ManageIQ/pg-logical_replication/compare/v1.
|
18
|
+
[Unreleased]: https://github.com/ManageIQ/pg-logical_replication/compare/v1.1.0...master
|
19
|
+
[1.1.0]: https://github.com/ManageIQ/pg-logical_replication/compare/v1.0.0...v1.1.0
|
20
|
+
[1.0.0]: https://github.com/ManageIQ/pg-logical_replication/tree/v1.0.0
|
data/CODEOWNERS
ADDED
@@ -6,6 +6,14 @@ module PG
|
|
6
6
|
attr_reader :connection
|
7
7
|
attr_reader :command_builder
|
8
8
|
|
9
|
+
def self.type_map_for_queries(connection)
|
10
|
+
@type_map_for_queries ||= PG::BasicTypeMapForQueries.new(connection)
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.type_map_for_results(connection)
|
14
|
+
@type_map_for_results ||= PG::BasicTypeMapForResults.new(connection)
|
15
|
+
end
|
16
|
+
|
9
17
|
# @param connection [PG::Connection] Database Connection
|
10
18
|
def initialize(connection)
|
11
19
|
@connection = connection
|
@@ -68,6 +76,20 @@ module PG
|
|
68
76
|
typed_exec("DROP SUBSCRIPTION#{" IF EXISTS" if ifexists} #{connection.quote_ident(name)}")
|
69
77
|
end
|
70
78
|
|
79
|
+
# Creates a logical replication slot
|
80
|
+
#
|
81
|
+
# @param name [String] logical replication slot name
|
82
|
+
def create_logical_replication_slot(name)
|
83
|
+
typed_exec("SELECT pg_create_logical_replication_slot(#{connection.escape_literal(name)}, 'pgoutput')")
|
84
|
+
end
|
85
|
+
|
86
|
+
# Drops the physical or logical replication slot. Note, you must be on the same database a logical slot was created.
|
87
|
+
#
|
88
|
+
# @param name [String] replication slot name
|
89
|
+
def drop_replication_slot(name)
|
90
|
+
typed_exec("SELECT pg_drop_replication_slot(#{connection.escape_literal(name)})")
|
91
|
+
end
|
92
|
+
|
71
93
|
# Updates a subscription connection string
|
72
94
|
#
|
73
95
|
# @param name [String] subscription name
|
@@ -195,8 +217,24 @@ module PG
|
|
195
217
|
# Returns if this database is subscribing to any publications
|
196
218
|
#
|
197
219
|
# @return [Boolean] true if there are any subscriptions, false otherwise
|
198
|
-
def subscriber?
|
199
|
-
subscriptions.any?
|
220
|
+
def subscriber?(dbname = nil)
|
221
|
+
subscriptions(dbname).any?
|
222
|
+
end
|
223
|
+
|
224
|
+
# Lists the current replication slots
|
225
|
+
#
|
226
|
+
# @return [Array<String>] replication slots
|
227
|
+
def replication_slots
|
228
|
+
typed_exec(<<-SQL)
|
229
|
+
SELECT
|
230
|
+
slot_name::TEXT,
|
231
|
+
plugin::TEXT,
|
232
|
+
slot_type::TEXT,
|
233
|
+
database::TEXT,
|
234
|
+
temporary,
|
235
|
+
active
|
236
|
+
FROM pg_replication_slots
|
237
|
+
SQL
|
200
238
|
end
|
201
239
|
|
202
240
|
# Lists the current publications
|
@@ -313,8 +351,8 @@ module PG
|
|
313
351
|
end
|
314
352
|
|
315
353
|
def typed_exec(sql, *params)
|
316
|
-
result = connection.async_exec(sql, params, nil,
|
317
|
-
result.map_types!(
|
354
|
+
result = connection.async_exec(sql, params, nil, self.class.type_map_for_queries(connection))
|
355
|
+
result.map_types!(self.class.type_map_for_results(connection))
|
318
356
|
end
|
319
357
|
end
|
320
358
|
end
|
@@ -23,8 +23,8 @@ This gem provides a class with methods which map directly to the PostgreSQL DSL
|
|
23
23
|
|
24
24
|
spec.add_dependency "pg"
|
25
25
|
|
26
|
-
spec.add_development_dependency "
|
27
|
-
spec.add_development_dependency "
|
28
|
-
spec.add_development_dependency "
|
26
|
+
spec.add_development_dependency "manageiq-style"
|
27
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
28
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
29
29
|
spec.add_development_dependency "simplecov"
|
30
30
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pg-logical_replication
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Carboni
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-06-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pg
|
@@ -25,47 +25,47 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: manageiq-style
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '10.0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '10.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '0
|
61
|
+
version: '3.0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '0
|
68
|
+
version: '3.0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: simplecov
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -83,7 +83,7 @@ dependencies:
|
|
83
83
|
description: 'This gem provides a class with methods which map directly to the PostgreSQL
|
84
84
|
DSL for logical replication configuration
|
85
85
|
|
86
|
-
'
|
86
|
+
'
|
87
87
|
email:
|
88
88
|
- ncarboni@redhat.com
|
89
89
|
executables: []
|
@@ -98,6 +98,7 @@ files:
|
|
98
98
|
- ".rubocop_local.yml"
|
99
99
|
- ".travis.yml"
|
100
100
|
- CHANGELOG.md
|
101
|
+
- CODEOWNERS
|
101
102
|
- Gemfile
|
102
103
|
- LICENSE.txt
|
103
104
|
- README.md
|
@@ -113,7 +114,7 @@ homepage: https://github.com/ManageIQ/pg-logical_replication
|
|
113
114
|
licenses:
|
114
115
|
- Apache-2.0
|
115
116
|
metadata: {}
|
116
|
-
post_install_message:
|
117
|
+
post_install_message:
|
117
118
|
rdoc_options: []
|
118
119
|
require_paths:
|
119
120
|
- lib
|
@@ -128,9 +129,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
128
129
|
- !ruby/object:Gem::Version
|
129
130
|
version: '0'
|
130
131
|
requirements: []
|
131
|
-
|
132
|
-
|
133
|
-
signing_key:
|
132
|
+
rubygems_version: 3.1.4
|
133
|
+
signing_key:
|
134
134
|
specification_version: 4
|
135
135
|
summary: A ruby gem for configuring and using postgresql logical replication
|
136
136
|
test_files: []
|