pg_online_schema_change 0.9.1 → 0.9.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c13a6a65723fdd06f0de41359026198f3ea60907b7bf839c1d61e9eb9bbceb42
4
- data.tar.gz: 6259bbb428ffe9a824da3d68289502322db71a26c394c87d1fa37483cb142666
3
+ metadata.gz: 2900c279c3ecb38f1deb228d82cb9c476f9aac331d669fea97c10ddd6eb41a94
4
+ data.tar.gz: 84f9a35eed1d5cde22924297e83d9539a218a964b76901005cdd6f389ee3c423
5
5
  SHA512:
6
- metadata.gz: 367222a59e33bac35dd4778658d23c5acfbb68585fceb439d986f7846123bec295c2d831441891d0e59b1d3ee2feb438f6fc694fe4f498b02696d39492227079
7
- data.tar.gz: 13baa1524266424fba9f25db9b308af2c3cb2c24e21f55fec7fb601e2915382f703430130fe8338534a3ce7a20dfe19334e04465877b4db6c76c6386baa54124
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.1)
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.14.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.52.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)
@@ -45,7 +45,7 @@ FUNC_CREATE_TABLE_ALL = <<~SQL
45
45
  rec record;
46
46
  begin
47
47
  EXECUTE format(
48
- 'CREATE TABLE %s (LIKE %s including all)',
48
+ 'CREATE TABLE %s (LIKE %s including all) WITH (autovacuum_enabled = false)',
49
49
  newsource_table, source_table);
50
50
  END
51
51
  $$;
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PgOnlineSchemaChange
4
- VERSION = "0.9.1"
4
+ VERSION = "0.9.2"
5
5
  end
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.1
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-06-24 00:00:00.000000000 Z
11
+ date: 2023-07-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ougai