pg_online_schema_change 0.7.5 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.prettierignore +4 -0
- data/.prettierrc +13 -0
- data/.rubocop.yml +204 -75
- data/.rubocop_todo.yml +11 -30
- data/.ruby-version +1 -1
- data/CHANGELOG.md +35 -21
- data/CODE_OF_CONDUCT.md +11 -11
- data/Gemfile.lock +72 -41
- data/README.md +40 -24
- data/Rakefile +1 -1
- data/docker-compose.yml +1 -1
- data/docs/load-test.md +11 -10
- data/lib/pg_online_schema_change/cli.rb +87 -23
- data/lib/pg_online_schema_change/client.rb +23 -12
- data/lib/pg_online_schema_change/orchestrate.rb +59 -24
- data/lib/pg_online_schema_change/query.rb +128 -98
- data/lib/pg_online_schema_change/replay.rb +10 -20
- data/lib/pg_online_schema_change/version.rb +1 -1
- data/lib/pg_online_schema_change.rb +15 -9
- data/package.json +13 -0
- data/yarn.lock +15 -0
- metadata +96 -36
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7ee83ff61d08a5a75a3a4301fa4e001d3a0d34ac7a83497401106e019a81926a
|
4
|
+
data.tar.gz: 6abf876909fd6ef65cd4dc75e307d9a6f0f17dffcb15eb28784f422bb6084401
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 651f59026eb0c22e6d761a8834ce959e463ad4a6d24989ecc9790cadf8eb6826bf127cdc124f97090f0002b80105a4f451924391f46ad5ef3325ddc89c2a541d
|
7
|
+
data.tar.gz: 877df2ccfdfea4c52ebc9ea9337ee163c88cc56fe4e9c724b34c29d098d6af215034e1f41cbc6ed760e0d9a3a1a952bbf9bd280818c1c7b1ac00a523d61a4ab0
|
data/.prettierignore
ADDED
data/.prettierrc
ADDED
data/.rubocop.yml
CHANGED
@@ -2,131 +2,260 @@ inherit_from: .rubocop_todo.yml
|
|
2
2
|
|
3
3
|
require:
|
4
4
|
- rubocop-rspec
|
5
|
-
- rubocop-packaging
|
6
|
-
- rubocop-performance
|
7
5
|
- rubocop-rake
|
8
6
|
|
7
|
+
inherit_mode:
|
8
|
+
merge:
|
9
|
+
- Include
|
10
|
+
- Exclude
|
11
|
+
- AllowedMethods
|
12
|
+
|
9
13
|
AllCops:
|
10
|
-
DisplayCopNames: true
|
11
|
-
DisplayStyleGuide: true
|
12
14
|
NewCops: enable
|
13
|
-
TargetRubyVersion: 2.6
|
14
15
|
Exclude:
|
15
|
-
- "
|
16
|
-
- "
|
16
|
+
- "**/.git/**/*"
|
17
|
+
- "**/node_modules/**/*"
|
18
|
+
- "**/Brewfile"
|
19
|
+
TargetRubyVersion: 3.1
|
20
|
+
|
21
|
+
Bundler/OrderedGems:
|
22
|
+
Include:
|
23
|
+
- "**/Gemfile"
|
17
24
|
|
18
|
-
|
19
|
-
|
20
|
-
EnforcedHashRocketStyle: key
|
25
|
+
Style/FrozenStringLiteralComment:
|
26
|
+
EnforcedStyle: always
|
21
27
|
|
22
|
-
|
23
|
-
EnforcedStyle:
|
28
|
+
Style/MutableConstant:
|
29
|
+
EnforcedStyle: literals
|
24
30
|
|
25
|
-
|
31
|
+
Style/MethodCallWithArgsParentheses:
|
26
32
|
Enabled: true
|
27
|
-
|
33
|
+
EnforcedStyle: require_parentheses
|
34
|
+
AllowedMethods:
|
35
|
+
- yield
|
36
|
+
- raise
|
37
|
+
- fail
|
38
|
+
- puts
|
39
|
+
- require
|
40
|
+
- require_relative
|
41
|
+
- render
|
42
|
+
- redirect_to
|
43
|
+
- head
|
44
|
+
- throw
|
45
|
+
# RSpec
|
46
|
+
- to
|
47
|
+
- not_to
|
48
|
+
- to_not
|
49
|
+
- and
|
50
|
+
- or
|
28
51
|
Exclude:
|
29
|
-
- "
|
52
|
+
- "**/Gemfile"
|
53
|
+
- "**/db/migrate/*"
|
54
|
+
- "**/db/schema.rb"
|
30
55
|
|
31
|
-
|
32
|
-
|
33
|
-
Exclude:
|
34
|
-
- "*.gemspec"
|
35
|
-
- "Rakefile"
|
36
|
-
- "spec/**/*"
|
56
|
+
Style/RedundantInitialize:
|
57
|
+
Enabled: false
|
37
58
|
|
38
|
-
|
39
|
-
|
40
|
-
- "test/**/*"
|
59
|
+
Layout:
|
60
|
+
Enabled: false
|
41
61
|
|
42
|
-
Metrics
|
43
|
-
|
44
|
-
Exclude:
|
45
|
-
- "test/**/*"
|
62
|
+
Metrics:
|
63
|
+
Enabled: false
|
46
64
|
|
47
|
-
|
48
|
-
|
65
|
+
Naming/AccessorMethodName:
|
66
|
+
Enabled: false
|
49
67
|
|
50
|
-
Naming/
|
51
|
-
Enabled:
|
68
|
+
Naming/MethodParameterName:
|
69
|
+
Enabled: false
|
70
|
+
|
71
|
+
Naming/PredicateName:
|
72
|
+
Enabled: false
|
52
73
|
|
53
74
|
Naming/VariableNumber:
|
54
|
-
Enabled:
|
75
|
+
Enabled: false
|
55
76
|
|
56
|
-
Style/
|
57
|
-
|
77
|
+
Style/AsciiComments:
|
78
|
+
Enabled: false
|
79
|
+
|
80
|
+
Style/BlockDelimiters:
|
81
|
+
Enabled: false
|
82
|
+
|
83
|
+
Style/CaseLikeIf:
|
84
|
+
Enabled: false
|
58
85
|
|
59
86
|
Style/ClassAndModuleChildren:
|
60
|
-
Enabled:
|
87
|
+
Enabled: false
|
88
|
+
|
89
|
+
Style/CommentAnnotation:
|
90
|
+
Enabled: false
|
61
91
|
|
62
92
|
Style/Documentation:
|
63
93
|
Enabled: false
|
64
94
|
|
65
|
-
Style/
|
66
|
-
Enabled:
|
95
|
+
Style/IfUnlessModifier:
|
96
|
+
Enabled: false
|
67
97
|
|
68
|
-
Style/
|
69
|
-
Enabled:
|
98
|
+
Style/Lambda:
|
99
|
+
Enabled: false
|
70
100
|
|
71
|
-
Style/
|
72
|
-
Enabled:
|
101
|
+
Style/ModuleFunction:
|
102
|
+
Enabled: false
|
103
|
+
|
104
|
+
Style/MultilineBlockChain:
|
105
|
+
Enabled: false
|
106
|
+
|
107
|
+
Style/NumericLiterals:
|
108
|
+
Enabled: false
|
73
109
|
|
74
110
|
Style/NumericPredicate:
|
75
|
-
Enabled:
|
111
|
+
Enabled: false
|
112
|
+
|
113
|
+
Style/ParallelAssignment:
|
114
|
+
Enabled: false
|
115
|
+
|
116
|
+
Style/PerlBackrefs:
|
117
|
+
Enabled: false
|
118
|
+
|
119
|
+
Style/QuotedSymbols:
|
120
|
+
EnforcedStyle: double_quotes
|
121
|
+
Enabled: false
|
122
|
+
|
123
|
+
Style/RaiseArgs:
|
124
|
+
Enabled: false
|
125
|
+
|
126
|
+
Style/RescueStandardError:
|
127
|
+
Enabled: false
|
128
|
+
|
129
|
+
Style/SingleArgumentDig:
|
130
|
+
Enabled: false
|
76
131
|
|
77
132
|
Style/StringLiterals:
|
78
133
|
EnforcedStyle: double_quotes
|
134
|
+
Enabled: false
|
79
135
|
|
80
136
|
Style/StringLiteralsInInterpolation:
|
81
|
-
|
137
|
+
Enabled: false
|
82
138
|
|
83
|
-
Style/
|
84
|
-
|
139
|
+
Style/SymbolArray:
|
140
|
+
EnforcedStyle: brackets
|
85
141
|
|
86
142
|
Style/TrailingCommaInArguments:
|
87
|
-
|
143
|
+
Enabled: false
|
88
144
|
|
89
145
|
Style/TrailingCommaInArrayLiteral:
|
90
|
-
|
146
|
+
Enabled: false
|
147
|
+
EnforcedStyleForMultiline: consistent_comma
|
91
148
|
|
92
149
|
Style/TrailingCommaInHashLiteral:
|
93
|
-
|
150
|
+
Enabled: false
|
94
151
|
|
95
|
-
|
96
|
-
Enabled:
|
97
|
-
EnforcedStyle: symmetrical
|
152
|
+
Style/TrailingUnderscoreVariable:
|
153
|
+
Enabled: false
|
98
154
|
|
99
|
-
|
100
|
-
|
101
|
-
EnforcedStyle: symmetrical
|
155
|
+
Style/WordArray:
|
156
|
+
EnforcedStyle: brackets
|
102
157
|
|
103
|
-
|
104
|
-
Enabled:
|
105
|
-
EnforcedStyle: same_line
|
158
|
+
Style/ZeroLengthPredicate:
|
159
|
+
Enabled: false
|
106
160
|
|
107
|
-
|
161
|
+
Style/DateTime:
|
108
162
|
Enabled: true
|
109
|
-
EnforcedStyle: consistent
|
110
163
|
|
111
|
-
|
112
|
-
|
113
|
-
EnforcedStyle: consistent
|
164
|
+
RSpec/ExpectChange:
|
165
|
+
EnforcedStyle: block
|
114
166
|
|
115
|
-
|
116
|
-
|
167
|
+
Gemspec/RequireMFA:
|
168
|
+
# Our Gemspec files are internal, MFA isn't needed
|
169
|
+
Enabled: false
|
117
170
|
|
118
|
-
|
119
|
-
|
120
|
-
|
171
|
+
# Temporary Rubocop exclusions
|
172
|
+
Style/OpenStructUse:
|
173
|
+
Enabled: false
|
121
174
|
|
122
|
-
|
123
|
-
|
124
|
-
|
175
|
+
# Ruby 3 migration exclusions
|
176
|
+
Style/HashSyntax:
|
177
|
+
Enabled: false
|
178
|
+
|
179
|
+
Naming/BlockForwarding:
|
180
|
+
Enabled: false
|
181
|
+
|
182
|
+
Lint/RedundantDirGlobSort:
|
183
|
+
Enabled: false
|
184
|
+
|
185
|
+
RSpec/ExampleLength:
|
186
|
+
Enabled: false
|
187
|
+
|
188
|
+
RSpec/MultipleExpectations:
|
189
|
+
Enabled: false
|
190
|
+
|
191
|
+
RSpec/VerifiedDoubles:
|
192
|
+
Enabled: false
|
193
|
+
|
194
|
+
RSpec/ContextWording:
|
195
|
+
Enabled: false
|
196
|
+
|
197
|
+
RSpec/AnyInstance:
|
198
|
+
Enabled: false
|
125
199
|
|
126
200
|
RSpec/MessageSpies:
|
127
|
-
Enabled:
|
128
|
-
|
201
|
+
Enabled: false
|
202
|
+
|
203
|
+
RSpec/RepeatedDescription:
|
204
|
+
Enabled: false
|
205
|
+
|
206
|
+
RSpec/RepeatedExample:
|
207
|
+
Enabled: false
|
208
|
+
|
209
|
+
RSpec/HookArgument:
|
210
|
+
Enabled: false
|
211
|
+
|
212
|
+
RSpec/DescribeClass:
|
213
|
+
Enabled: false
|
214
|
+
|
215
|
+
RSpec/DescribedClass:
|
216
|
+
Enabled: false
|
129
217
|
|
130
218
|
RSpec/FilePath:
|
131
|
-
Enabled:
|
132
|
-
|
219
|
+
Enabled: false
|
220
|
+
|
221
|
+
RSpec/IdenticalEqualityAssertion:
|
222
|
+
Enabled: false
|
223
|
+
|
224
|
+
RSpec/InstanceVariable:
|
225
|
+
Enabled: false
|
226
|
+
|
227
|
+
RSpec/MissingExampleGroupArgument:
|
228
|
+
Enabled: false
|
229
|
+
|
230
|
+
RSpec/MultipleDescribes:
|
231
|
+
Enabled: false
|
232
|
+
|
233
|
+
RSpec/NestedGroups:
|
234
|
+
Enabled: false
|
235
|
+
|
236
|
+
RSpec/PredicateMatcher:
|
237
|
+
Enabled: false
|
238
|
+
|
239
|
+
RSpec/Rails/HttpStatus:
|
240
|
+
Enabled: false
|
241
|
+
|
242
|
+
RSpec/RepeatedExampleGroupDescription:
|
243
|
+
Enabled: false
|
244
|
+
|
245
|
+
RSpec/StubbedMock:
|
246
|
+
Enabled: false
|
247
|
+
|
248
|
+
Lint/UnusedMethodArgument:
|
249
|
+
Enabled: false
|
250
|
+
|
251
|
+
Lint/MissingSuper:
|
252
|
+
Enabled: false
|
253
|
+
|
254
|
+
RSpec/NoExpectationExample:
|
255
|
+
Enabled: false
|
256
|
+
|
257
|
+
Style/AccessorGrouping:
|
258
|
+
Enabled: false
|
259
|
+
|
260
|
+
Style/FormatStringToken:
|
261
|
+
Enabled: false
|
data/.rubocop_todo.yml
CHANGED
@@ -1,45 +1,26 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on 2023-
|
3
|
+
# on 2023-05-13 12:53:02 UTC using RuboCop version 1.51.0.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
8
8
|
|
9
|
-
# Offense count:
|
10
|
-
# Configuration parameters:
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
Metrics/CyclomaticComplexity:
|
17
|
-
Max: 15
|
18
|
-
|
19
|
-
# Offense count: 1
|
20
|
-
# Configuration parameters: CountComments, CountAsOne.
|
21
|
-
Metrics/ModuleLength:
|
22
|
-
Max: 112
|
23
|
-
|
24
|
-
# Offense count: 2
|
25
|
-
# Configuration parameters: IgnoredMethods.
|
26
|
-
Metrics/PerceivedComplexity:
|
27
|
-
Max: 13
|
9
|
+
# Offense count: 12
|
10
|
+
# Configuration parameters: EnforcedStyle, AllowedGems, Include.
|
11
|
+
# SupportedStyles: Gemfile, gems.rb, gemspec
|
12
|
+
# Include: **/*.gemspec, **/Gemfile, **/gems.rb
|
13
|
+
Gemspec/DevelopmentDependencies:
|
14
|
+
Exclude:
|
15
|
+
- 'pg_online_schema_change.gemspec'
|
28
16
|
|
29
17
|
# Offense count: 1
|
30
|
-
|
18
|
+
# Configuration parameters: Severity, Include.
|
19
|
+
# Include: **/*.gemspec
|
20
|
+
Gemspec/RequiredRubyVersion:
|
31
21
|
Exclude:
|
32
22
|
- 'pg_online_schema_change.gemspec'
|
33
23
|
|
34
|
-
# Offense count: 69
|
35
|
-
# Configuration parameters: CountAsOne.
|
36
|
-
RSpec/ExampleLength:
|
37
|
-
Max: 55
|
38
|
-
|
39
|
-
# Offense count: 25
|
40
|
-
RSpec/MultipleExpectations:
|
41
|
-
Max: 14
|
42
|
-
|
43
24
|
# Offense count: 6
|
44
25
|
# Configuration parameters: AllowedMethods.
|
45
26
|
# AllowedMethods: respond_to_missing?
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.
|
1
|
+
3.1.3
|
data/CHANGELOG.md
CHANGED
@@ -1,44 +1,58 @@
|
|
1
|
+
## [0.7.5] - 2023-03-12
|
1
2
|
|
3
|
+
- Bump google-protobuf from 3.21.6 to 3.21.7 https://github.com/shayonj/pg-osc/pull/76
|
4
|
+
- Supports tablenames containing uppercase letters https://github.com/shayonj/pg-osc/pull/77
|
5
|
+
- Update rubocop todo https://github.com/shayonj/pg-osc/pull/78
|
6
|
+
- Ensure original triggers are carried over from parent table https://github.com/shayonj/pg-osc/pull/79
|
2
7
|
|
3
8
|
## [0.7.4] - 2022-09-24
|
4
|
-
|
9
|
+
|
10
|
+
- off-by-one: Don't skip PK sequence value by one https://github.com/shayonj/pg-osc/pull/74
|
5
11
|
|
6
12
|
## [0.7.3] - 2022-09-24
|
7
|
-
|
13
|
+
|
14
|
+
- Update primary key sequence on shadow table https://github.com/shayonj/pg-osc/pull/72
|
8
15
|
- Thanks to @brycethornton for the report
|
9
|
-
|
16
|
+
- Only refresh primary key when a sequence is attached https://github.com/shayonj/pg-osc/pull/73
|
10
17
|
|
11
18
|
## [0.7.2] - 2022-09-17
|
19
|
+
|
12
20
|
**NOTE: Skip to 0.7.3. 0.7.2 release missed the change.**
|
13
|
-
|
21
|
+
|
22
|
+
- Update primary key sequence on shadow table https://github.com/shayonj/pg-osc/pull/72
|
14
23
|
- Thanks to @brycethornton for the report
|
15
24
|
|
16
25
|
## [0.7.1] - 2022-03-13
|
17
|
-
|
26
|
+
|
27
|
+
- Bump pg to `1.3.4` https://github.com/shayonj/pg-osc/commit/d086c19d4f273dc960491cbedf9e0602d812896b
|
18
28
|
|
19
29
|
## [0.7.0] - 2022-03-13
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
30
|
+
|
31
|
+
- Move CI to Github Actions in https://github.com/shayonj/pg-osc/pull/64
|
32
|
+
- Set --password as optional since it is deprecated in https://github.com/shayonj/pg-osc/pull/66
|
33
|
+
- Smoke tests in https://github.com/shayonj/pg-osc/pull/65
|
34
|
+
- Add foreign keys to parent during swap in https://github.com/shayonj/pg-osc/pull/67
|
24
35
|
|
25
36
|
## [0.6.0] - 2022-02-26
|
26
|
-
|
37
|
+
|
38
|
+
- Delete items by audit table PK when replaying by @shayonj @jfrost in https://github.com/shayonj/pg-osc/pull/60
|
27
39
|
- Fixes a race condition issue: https://github.com/shayonj/pg-osc/issues/58
|
28
40
|
|
29
41
|
## [0.5.0] - 2022-02-26
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
42
|
+
|
43
|
+
- Share some preliminary load test figures in https://github.com/shayonj/pg-osc/pull/54
|
44
|
+
- Reuse existing transaction open for reading table columns in https://github.com/shayonj/pg-osc/pull/53
|
45
|
+
- Start to deprecate --password with PGPASSWORD in https://github.com/shayonj/pg-osc/pull/56
|
46
|
+
- Introduce configurable PULL_BATCH_COUNT and DELTA_COUNT in https://github.com/shayonj/pg-osc/pull/57
|
34
47
|
|
35
48
|
## [0.4.0] - 2022-02-22
|
36
|
-
|
37
|
-
|
38
|
-
|
49
|
+
|
50
|
+
- Lint sourcecode, setup Rubocop proper and Lint in CI by @shayonj in https://github.com/shayonj/pg-osc/pull/46
|
51
|
+
- Uniquely identify operation_type column by @shayonj in https://github.com/shayonj/pg-osc/pull/50
|
52
|
+
- Introduce primary key on audit table for ordered reads by @shayonj in https://github.com/shayonj/pg-osc/pull/49
|
39
53
|
- This addresses an edge case with replay.
|
40
|
-
|
41
|
-
|
54
|
+
- Uniquely identify trigger_time column by @shayonj in https://github.com/shayonj/pg-osc/pull/51
|
55
|
+
- Abstract assertions into a helper function by @shayonj in https://github.com/shayonj/pg-osc/pull/52
|
42
56
|
|
43
57
|
## [0.3.0] - 2022-02-21
|
44
58
|
|
@@ -53,8 +67,8 @@
|
|
53
67
|
|
54
68
|
Initial release
|
55
69
|
|
56
|
-
pg-online-schema-change (`pg-osc`) is a tool for making schema changes (any `ALTER` statements) in Postgres tables with minimal locks, thus helping achieve zero downtime schema changes against production workloads.
|
70
|
+
pg-online-schema-change (`pg-osc`) is a tool for making schema changes (any `ALTER` statements) in Postgres tables with minimal locks, thus helping achieve zero downtime schema changes against production workloads.
|
57
71
|
|
58
72
|
`pg-osc` uses the concept of shadow table to perform schema changes. At a high level, it copies the contents from a primary table to a shadow table, performs the schema change on the shadow table and swaps the table names in the end while preserving all changes to the primary table using triggers (via audit table).
|
59
73
|
|
60
|
-
Checkout [Readme](https://github.com/shayonj/pg-osc#readme) for more details.
|
74
|
+
Checkout [Readme](https://github.com/shayonj/pg-osc#readme) for more details.
|
data/CODE_OF_CONDUCT.md
CHANGED
@@ -10,21 +10,21 @@ We pledge to act and interact in ways that contribute to an open, welcoming, div
|
|
10
10
|
|
11
11
|
Examples of behavior that contributes to a positive environment for our community include:
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
13
|
+
- Demonstrating empathy and kindness toward other people
|
14
|
+
- Being respectful of differing opinions, viewpoints, and experiences
|
15
|
+
- Giving and gracefully accepting constructive feedback
|
16
|
+
- Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
|
17
|
+
- Focusing on what is best not just for us as individuals, but for the overall community
|
18
18
|
|
19
19
|
Examples of unacceptable behavior include:
|
20
20
|
|
21
|
-
|
21
|
+
- The use of sexualized language or imagery, and sexual attention or
|
22
22
|
advances of any kind
|
23
|
-
|
24
|
-
|
25
|
-
|
23
|
+
- Trolling, insulting or derogatory comments, and personal or political attacks
|
24
|
+
- Public or private harassment
|
25
|
+
- Publishing others' private information, such as a physical or email
|
26
26
|
address, without their explicit permission
|
27
|
-
|
27
|
+
- Other conduct which could reasonably be considered inappropriate in a
|
28
28
|
professional setting
|
29
29
|
|
30
30
|
## Enforcement Responsibilities
|
@@ -67,7 +67,7 @@ Community leaders will follow these Community Impact Guidelines in determining t
|
|
67
67
|
|
68
68
|
### 4. Permanent Ban
|
69
69
|
|
70
|
-
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior,
|
70
|
+
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
|
71
71
|
|
72
72
|
**Consequence**: A permanent ban from any sort of public interaction within the community.
|
73
73
|
|