pg_online_schema_change 0.9.1 → 0.9.2
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2900c279c3ecb38f1deb228d82cb9c476f9aac331d669fea97c10ddd6eb41a94
|
|
4
|
+
data.tar.gz: 84f9a35eed1d5cde22924297e83d9539a218a964b76901005cdd6f389ee3c423
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1395602fbea53d0d0d768fefed3d94f5cab39fae007ccd0c008f8a5818bf9de3b9f179a61b6cb91dbae288fec6cbd99e5bb6b494f1b38c0affe8c5c57d351b15
|
|
7
|
+
data.tar.gz: 5c0c2a4b305e147932a4fe8a62c9897238914343c95a39114cb5b8b05154eebee35c1e7fa164b592c7938c253c6b9ca8c3f943063b4b6c4b30618f31fefd3ae4
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
pg_online_schema_change (0.9.
|
|
4
|
+
pg_online_schema_change (0.9.2)
|
|
5
5
|
ougai (~> 2.0.0)
|
|
6
6
|
pg (>= 1.3.2, < 1.6.0)
|
|
7
7
|
pg_query (>= 2.1.3, < 4.3.0)
|
|
@@ -20,8 +20,9 @@ GEM
|
|
|
20
20
|
thor
|
|
21
21
|
tilt
|
|
22
22
|
json (2.6.3)
|
|
23
|
+
language_server-protocol (3.17.0.3)
|
|
23
24
|
method_source (1.0.0)
|
|
24
|
-
oj (3.
|
|
25
|
+
oj (3.15.0)
|
|
25
26
|
ougai (2.0.0)
|
|
26
27
|
oj (~> 3.10)
|
|
27
28
|
parallel (1.23.0)
|
|
@@ -54,8 +55,9 @@ GEM
|
|
|
54
55
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
55
56
|
rspec-support (~> 3.12.0)
|
|
56
57
|
rspec-support (3.12.0)
|
|
57
|
-
rubocop (1.
|
|
58
|
+
rubocop (1.54.0)
|
|
58
59
|
json (~> 2.3)
|
|
60
|
+
language_server-protocol (>= 3.17.0)
|
|
59
61
|
parallel (~> 1.10)
|
|
60
62
|
parser (>= 3.2.2.3)
|
|
61
63
|
rainbow (>= 2.2.2, < 4.0)
|
|
@@ -37,6 +37,7 @@ module PgOnlineSchemaChange
|
|
|
37
37
|
Store.set(:audit_table_pk, "at_#{pgosc_identifier}_id")
|
|
38
38
|
Store.set(:audit_table_pk_sequence, "#{audit_table}_#{audit_table_pk}_seq")
|
|
39
39
|
Store.set(:shadow_table, "pgosc_st_#{client.table.downcase}_#{pgosc_identifier}")
|
|
40
|
+
Store.set(:primary_table_storage_parameters, Query.storage_parameters_for(client, client.table_name, true) || "")
|
|
40
41
|
|
|
41
42
|
Store.set(
|
|
42
43
|
:referential_foreign_key_statements,
|
|
@@ -59,7 +60,6 @@ module PgOnlineSchemaChange
|
|
|
59
60
|
|
|
60
61
|
setup_trigger!
|
|
61
62
|
setup_shadow_table! # re-uses transaction with serializable
|
|
62
|
-
disable_vacuum! # re-uses transaction with serializable
|
|
63
63
|
run_alter_statement! # re-uses transaction with serializable
|
|
64
64
|
copy_data! # re-uses transaction with serializable
|
|
65
65
|
run_analyze!
|
|
@@ -105,7 +105,7 @@ module PgOnlineSchemaChange
|
|
|
105
105
|
logger.info("Setting up audit table", { audit_table: audit_table })
|
|
106
106
|
|
|
107
107
|
sql = <<~SQL
|
|
108
|
-
CREATE TABLE #{audit_table} (#{audit_table_pk} SERIAL PRIMARY KEY, #{operation_type_column} text, #{trigger_time_column} timestamp, LIKE #{client.table_name});
|
|
108
|
+
CREATE TABLE #{audit_table} (#{audit_table_pk} SERIAL PRIMARY KEY, #{operation_type_column} text, #{trigger_time_column} timestamp, LIKE #{client.table_name}) WITH (autovacuum_enabled = false);
|
|
109
109
|
SQL
|
|
110
110
|
|
|
111
111
|
Query.run(client.connection, sql)
|
|
@@ -177,28 +177,6 @@ module PgOnlineSchemaChange
|
|
|
177
177
|
)
|
|
178
178
|
end
|
|
179
179
|
|
|
180
|
-
def disable_vacuum!
|
|
181
|
-
# re-uses transaction with serializable
|
|
182
|
-
# Disabling vacuum to avoid any issues during the process
|
|
183
|
-
result = Query.storage_parameters_for(client, client.table_name, true) || ""
|
|
184
|
-
Store.set(:primary_table_storage_parameters, result)
|
|
185
|
-
|
|
186
|
-
logger.debug(
|
|
187
|
-
"Disabling vacuum on shadow and audit table",
|
|
188
|
-
{ shadow_table: shadow_table, audit_table: audit_table },
|
|
189
|
-
)
|
|
190
|
-
sql = <<~SQL
|
|
191
|
-
ALTER TABLE #{shadow_table} SET (
|
|
192
|
-
autovacuum_enabled = false, toast.autovacuum_enabled = false
|
|
193
|
-
);
|
|
194
|
-
|
|
195
|
-
ALTER TABLE #{audit_table} SET (
|
|
196
|
-
autovacuum_enabled = false, toast.autovacuum_enabled = false
|
|
197
|
-
);
|
|
198
|
-
SQL
|
|
199
|
-
Query.run(client.connection, sql, true)
|
|
200
|
-
end
|
|
201
|
-
|
|
202
180
|
def run_alter_statement!
|
|
203
181
|
# re-uses transaction with serializable
|
|
204
182
|
statement = Query.alter_statement_for(client, shadow_table)
|
|
@@ -81,7 +81,6 @@ module PgOnlineSchemaChange
|
|
|
81
81
|
connection.block
|
|
82
82
|
logger.info("Exception raised, rolling back query", { rollback: true, query: query })
|
|
83
83
|
connection.async_exec("ROLLBACK;")
|
|
84
|
-
connection.async_exec("COMMIT;")
|
|
85
84
|
raise
|
|
86
85
|
else
|
|
87
86
|
connection.async_exec("COMMIT;") unless reuse_trasaction
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: pg_online_schema_change
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.9.
|
|
4
|
+
version: 0.9.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Shayon Mukherjee
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2023-
|
|
11
|
+
date: 2023-07-04 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: ougai
|