lhm-shopify 4.2.2 → 4.2.3

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: 0c6d17339f7cb0ec6d9dfa2620e24e5912a4af9302e376297e212be626bd2b15
4
- data.tar.gz: a50feeaf0d1fa60c07c0410b1e01024a82ec1b5b243bf25013ea57c5c7a84c07
3
+ metadata.gz: 8e88f970c0a74075057e83cd9dddaff855c4b1260279604badc45af7d4f096f0
4
+ data.tar.gz: 722aefe84a0e97d6702b4b2706df2ad9c9084dec24be0e3e790fa4f4f535ea73
5
5
  SHA512:
6
- metadata.gz: dcd984207e3b4a341ddf72b3be5674d175330a72b292e754a1e7d646924dd191a454c5dbe3c38ed1e2772f08347f3da2e467e16adb9bb107d4fd9f38b3d6d63d
7
- data.tar.gz: 1e8e0771a774b017c2d8dd64092d7eaaf5fbaba98cbc5772e478be2871d882f55769607abe92b63bd10d62e717e3cb07d90e8e0bb685801994debd48ab618ebb
6
+ metadata.gz: f423dbc69088a1e314e0b460a051f5a3438754382a5f26008e2ed1e754da771467a532c9f269cbfd2e1e0aa347e600b3dbabc436f8cc94c32d0d99819cb0f832
7
+ data.tar.gz: 047c7221c4eb28d5bc01a16287b5e813e46dbc6b7effae12ff6778660e8e295adb53490d9825c8ca714df6e00b3abef50cff522a2f29a0ae9c6834797e9c93e5
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Unreleased
2
2
 
3
+ # 4.2.3 (Jul, 2024)
4
+ * Fix check for warnings against PKs with line breaks
5
+
3
6
  # 4.2.2 (Jun, 2024)
4
7
  * Avoid using the INSTANT algorithm.
5
8
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- lhm-shopify (4.2.2)
4
+ lhm-shopify (4.2.3)
5
5
  retriable (>= 3.0.0)
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- lhm-shopify (4.2.2)
4
+ lhm-shopify (4.2.3)
5
5
  retriable (>= 3.0.0)
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- lhm-shopify (4.2.2)
4
+ lhm-shopify (4.2.3)
5
5
  retriable (>= 3.0.0)
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- lhm-shopify (4.2.2)
4
+ lhm-shopify (4.2.3)
5
5
  retriable (>= 3.0.0)
6
6
 
7
7
  GEM
data/lib/lhm/chunker.rb CHANGED
@@ -23,7 +23,6 @@ module Lhm
23
23
  @chunk_finder = ChunkFinder.new(migration, connection, options)
24
24
  @options = options
25
25
  @raise_on_warnings = options.fetch(:raise_on_warnings, false)
26
- @pk_duplicate_warning_regexp ||= /Duplicate entry .+ for key '(#{@migration.destination_name}\.)?PRIMARY'/
27
26
  @verifier = options[:verifier]
28
27
  if @throttler = options[:throttler]
29
28
  @throttler.connection = @connection if @throttler.respond_to?(:connection=)
@@ -81,7 +80,7 @@ module Lhm
81
80
 
82
81
  def raise_on_non_pk_duplicate_warning
83
82
  @connection.select_all("SHOW WARNINGS", should_retry: true, log_prefix: LOG_PREFIX).each do |row|
84
- next if row["Message"].match?(@pk_duplicate_warning_regexp)
83
+ next if row["Message"].start_with?("Duplicate entry") && row["Message"].match?(/for key '(#{@migration.destination_name}\.)?PRIMARY'\z/)
85
84
 
86
85
  m = "Unexpected warning found for inserted row: #{row["Message"]}"
87
86
  Lhm.logger.warn(m)
data/lib/lhm/version.rb CHANGED
@@ -2,5 +2,5 @@
2
2
  # Schmidt
3
3
 
4
4
  module Lhm
5
- VERSION = '4.2.2'
5
+ VERSION = '4.2.3'
6
6
  end
@@ -0,0 +1,10 @@
1
+ CREATE TABLE `composite_primary_key_with_varchar_columns` (
2
+ `id` bigint NOT NULL AUTO_INCREMENT,
3
+ `shop_id` bigint NOT NULL,
4
+ `owner_type` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '',
5
+ `owner_id` bigint NOT NULL,
6
+ `namespace` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '',
7
+ `key` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '',
8
+ PRIMARY KEY (`shop_id`,`owner_type`,`owner_id`,`namespace`,`key`),
9
+ UNIQUE KEY `id` (`id`)
10
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC
@@ -0,0 +1,10 @@
1
+ CREATE TABLE `composite_primary_key_with_varchar_columns_dest` (
2
+ `id` bigint NOT NULL AUTO_INCREMENT,
3
+ `shop_id` bigint NOT NULL,
4
+ `owner_type` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '',
5
+ `owner_id` bigint NOT NULL,
6
+ `namespace` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '',
7
+ `key` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '',
8
+ PRIMARY KEY (`shop_id`,`owner_type`,`owner_id`,`namespace`,`key`),
9
+ UNIQUE KEY `id` (`id`)
10
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC
@@ -61,6 +61,46 @@ describe Lhm::Chunker do
61
61
  end
62
62
  end
63
63
 
64
+ it 'should copy and ignore duplicate composite primary key with line breaks' do
65
+ origin = table_create(:composite_primary_key_with_varchar_columns)
66
+ destination = table_create(:composite_primary_key_with_varchar_columns_dest)
67
+ migration = Lhm::Migration.new(origin, destination)
68
+
69
+ execute("insert into composite_primary_key_with_varchar_columns set id = 1001, shop_id = 1, owner_type = 'Product', owner_id = 1, namespace = '
70
+ 23
71
+
72
+ 23
73
+ ', `key` = '
74
+ 14
75
+
76
+ 1
77
+ '")
78
+ execute("insert into composite_primary_key_with_varchar_columns set id = 1002, shop_id = 1, owner_type = 'Product', owner_id = 1, namespace = '
79
+ 23
80
+
81
+ 22
82
+ ', `key` = '
83
+ 14
84
+
85
+ 1
86
+ '")
87
+ execute("insert into composite_primary_key_with_varchar_columns_dest set id = 1002, shop_id = 1, owner_type = 'Product', owner_id = 1, namespace = '
88
+ 23
89
+
90
+ 22
91
+ ', `key` = '
92
+ 14
93
+
94
+ 1
95
+ '")
96
+
97
+ Lhm::Chunker.new(migration, connection, {raise_on_warning: true, throttler: throttler, printer: printer} ).run
98
+
99
+ replica do
100
+ value(count_all(destination.name)).must_equal(2)
101
+ end
102
+ end
103
+
64
104
  it 'should copy and raise on unexpected warnings' do
65
105
  origin = table_create(:custom_primary_key)
66
106
  destination = table_create(:custom_primary_key_dest)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lhm-shopify
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.2.2
4
+ version: 4.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - SoundCloud
@@ -9,10 +9,10 @@ authors:
9
9
  - Rany Keddo
10
10
  - Tobias Bielohlawek
11
11
  - Tobias Schmidt
12
- autorequire:
12
+ autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2024-06-05 00:00:00.000000000 Z
15
+ date: 2024-07-23 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: retriable
@@ -254,6 +254,8 @@ files:
254
254
  - spec/fixtures/bigint_table.ddl
255
255
  - spec/fixtures/composite_primary_key.ddl
256
256
  - spec/fixtures/composite_primary_key_dest.ddl
257
+ - spec/fixtures/composite_primary_key_with_varchar_columns.ddl
258
+ - spec/fixtures/composite_primary_key_with_varchar_columns_dest.ddl
257
259
  - spec/fixtures/custom_primary_key.ddl
258
260
  - spec/fixtures/custom_primary_key_dest.ddl
259
261
  - spec/fixtures/destination.ddl
@@ -307,7 +309,7 @@ licenses:
307
309
  - BSD-3-Clause
308
310
  metadata:
309
311
  allowed_push_host: https://rubygems.org
310
- post_install_message:
312
+ post_install_message:
311
313
  rdoc_options: []
312
314
  require_paths:
313
315
  - lib
@@ -322,8 +324,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
322
324
  - !ruby/object:Gem::Version
323
325
  version: '0'
324
326
  requirements: []
325
- rubygems_version: 3.5.11
326
- signing_key:
327
+ rubygems_version: 3.5.16
328
+ signing_key:
327
329
  specification_version: 4
328
330
  summary: online schema changer for mysql
329
331
  test_files: []