lhm-teak 3.6.2 → 3.6.3

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: dd5262096c187a25e9c5445b203bfc1cf54be3222bd8b3df2d3a53df7ef6fbe1
4
- data.tar.gz: 78e8816b51fb4b41fdd49ef4b4988d3a573e63e523953cf5fdec519b4dc088e1
3
+ metadata.gz: 97826be10fb4623438563b99a21112df2fbbc2c996e67801282f1f89bfd3627b
4
+ data.tar.gz: e10b40b4a0d6e5b99b1b1e76c7c6e7475c6bc796f3d597c9f20c941e2b16c511
5
5
  SHA512:
6
- metadata.gz: 4033f6ddf9f9a04660af221e2fc6af79cb3aa03901db1928a7e5fb0e79fa882fe2d086ad9abddb4423bddbeb76ee647cd5330bcd963b3e16492ff3ecc822f9ae
7
- data.tar.gz: 49335ddb7ddf6cfdbf37ff50ec3ce8d0bc30f99b311ecf3c90948f42dbbb3fea73fa7f36e4cbb595df62a2124fb72391febf120c45d650649ff2bae660420d6c
6
+ metadata.gz: c3044f49b65ab2004cdcfda5ed96cdd7050157f906d58275ad5b774ca61fda52fd3c7d88837a85aa5a7782aa36d7f303a27549c40305c0cf0015a5e2d7030bca
7
+ data.tar.gz: cb8801aaf5d7777eb201accf77f4bc16fd9aae7743a862605b72d4eb547a624ee2db598f81b8cb7b2a58d41348b15f017e5ef132efde824417563aa995531175
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- lhm-teak (3.6.2)
4
+ lhm-teak (3.6.3)
5
5
  retriable (>= 3.0.0)
6
6
 
7
7
  GEM
@@ -6,12 +6,12 @@ module Lhm
6
6
 
7
7
  LOG_PREFIX = "ChunkInsert"
8
8
 
9
- def initialize(migration, connection, lowest, highest, retry_options = {})
9
+ def initialize(migration, connection, lowest, highest, options = {})
10
10
  @migration = migration
11
11
  @connection = connection
12
12
  @lowest = lowest
13
13
  @highest = highest
14
- @retry_options = retry_options
14
+ @options = options
15
15
  end
16
16
 
17
17
  def insert_and_return_count_of_rows_created
@@ -27,7 +27,7 @@ module Lhm
27
27
  end
28
28
 
29
29
  def expected_rows
30
- top - bottom + 1
30
+ @options.fetch(:expected_rows, top - bottom + 1)
31
31
  end
32
32
 
33
33
  private
@@ -23,9 +23,10 @@ module Lhm
23
23
  @processed_rows = 0
24
24
  while @processed_rows < ids.length
25
25
  next_idx = [@processed_rows + @throttler.stride, @ids.length].min
26
- ids_to_insert = ids[@processed_rows...next_idx]
26
+ range = @processed_rows...next_idx
27
+ ids_to_insert = ids[range]
27
28
  @processed_rows = next_idx
28
- yield IdSetChunkInsert.new(@migration, @connection, ids_to_insert)
29
+ yield ChunkInsert.new(@migration, @connection, ids_to_insert[0], ids_to_insert[-1], expected_rows: range.count)
29
30
  end
30
31
  end
31
32
 
data/lib/lhm/version.rb CHANGED
@@ -2,5 +2,5 @@
2
2
  # Schmidt
3
3
 
4
4
  module Lhm
5
- VERSION = '3.6.2'
5
+ VERSION = '3.6.3'
6
6
  end
@@ -43,11 +43,11 @@ describe Lhm::IdSetChunkFinder do
43
43
 
44
44
  @connection.expects(:select_values).with(regexp_matches(/order by id asc/),EXPECTED_RETRY_FLAGS_CHUNKER).returns((1..20).select(&:odd?))
45
45
 
46
- @connection.expects(:update).with(regexp_matches(/`id` in \(1,3\)/),EXPECTED_RETRY_FLAGS_CHUNK_INSERT).returns(2)
47
- @connection.expects(:update).with(regexp_matches(/`id` in \(5,7\)/),EXPECTED_RETRY_FLAGS_CHUNK_INSERT).returns(2)
48
- @connection.expects(:update).with(regexp_matches(/`id` in \(9,11\)/),EXPECTED_RETRY_FLAGS_CHUNK_INSERT).returns(2)
49
- @connection.expects(:update).with(regexp_matches(/`id` in \(13,15\)/),EXPECTED_RETRY_FLAGS_CHUNK_INSERT).returns(2)
50
- @connection.expects(:update).with(regexp_matches(/`id` in \(17,19\)/),EXPECTED_RETRY_FLAGS_CHUNK_INSERT).returns(2)
46
+ @connection.expects(:update).with(regexp_matches(/`id` between 1 and 3/),EXPECTED_RETRY_FLAGS_CHUNK_INSERT).returns(2)
47
+ @connection.expects(:update).with(regexp_matches(/`id` between 5 and 7/),EXPECTED_RETRY_FLAGS_CHUNK_INSERT).returns(2)
48
+ @connection.expects(:update).with(regexp_matches(/`id` between 9 and 11/),EXPECTED_RETRY_FLAGS_CHUNK_INSERT).returns(2)
49
+ @connection.expects(:update).with(regexp_matches(/`id` between 13 and 15/),EXPECTED_RETRY_FLAGS_CHUNK_INSERT).returns(2)
50
+ @connection.expects(:update).with(regexp_matches(/`id` between 17 and 19/),EXPECTED_RETRY_FLAGS_CHUNK_INSERT).returns(2)
51
51
 
52
52
  @chunker.run
53
53
  end
@@ -66,10 +66,10 @@ describe Lhm::IdSetChunkFinder do
66
66
 
67
67
  @connection.expects(:select_values).with(regexp_matches(/order by id asc/),EXPECTED_RETRY_FLAGS_CHUNKER).returns((1..20).select(&:odd?))
68
68
 
69
- @connection.expects(:update).with(regexp_matches(/`id` in \(1,3\)/),EXPECTED_RETRY_FLAGS_CHUNK_INSERT).returns(2)
70
- @connection.expects(:update).with(regexp_matches(/`id` in \(5,7,9\)/),EXPECTED_RETRY_FLAGS_CHUNK_INSERT).returns(2)
71
- @connection.expects(:update).with(regexp_matches(/`id` in \(11,13,15\)/),EXPECTED_RETRY_FLAGS_CHUNK_INSERT).returns(2)
72
- @connection.expects(:update).with(regexp_matches(/`id` in \(17,19\)/),EXPECTED_RETRY_FLAGS_CHUNK_INSERT).returns(2)
69
+ @connection.expects(:update).with(regexp_matches(/`id` between 1 and 3/),EXPECTED_RETRY_FLAGS_CHUNK_INSERT).returns(2)
70
+ @connection.expects(:update).with(regexp_matches(/`id` between 5 and 9/),EXPECTED_RETRY_FLAGS_CHUNK_INSERT).returns(2)
71
+ @connection.expects(:update).with(regexp_matches(/`id` between 11 and 15/),EXPECTED_RETRY_FLAGS_CHUNK_INSERT).returns(2)
72
+ @connection.expects(:update).with(regexp_matches(/`id` between 17 and 19/),EXPECTED_RETRY_FLAGS_CHUNK_INSERT).returns(2)
73
73
 
74
74
  @connection.expects(:execute).twice.with(regexp_matches(/show warnings/),EXPECTED_RETRY_FLAGS_CHUNKER).returns([])
75
75
 
@@ -81,7 +81,7 @@ describe Lhm::IdSetChunkFinder do
81
81
  :chunk_finder => Lhm::IdSetChunkFinder)
82
82
 
83
83
  @connection.expects(:select_values).with(regexp_matches(/order by id asc/),EXPECTED_RETRY_FLAGS_CHUNKER).returns([1])
84
- @connection.expects(:update).with(regexp_matches(/`id` in \(1\)/),EXPECTED_RETRY_FLAGS_CHUNK_INSERT).returns(1)
84
+ @connection.expects(:update).with(regexp_matches(/`id` between 1 and 1/),EXPECTED_RETRY_FLAGS_CHUNK_INSERT).returns(1)
85
85
 
86
86
  @chunker.run
87
87
  end
@@ -95,11 +95,11 @@ describe Lhm::IdSetChunkFinder do
95
95
 
96
96
  @connection.expects(:select_values).with(regexp_matches(/order by id asc/),EXPECTED_RETRY_FLAGS_CHUNKER).returns((2..10).to_a)
97
97
 
98
- @connection.expects(:update).with(regexp_matches(/`id` in \(2,3\)/),EXPECTED_RETRY_FLAGS_CHUNK_INSERT).returns(2)
99
- @connection.expects(:update).with(regexp_matches(/`id` in \(4,5\)/),EXPECTED_RETRY_FLAGS_CHUNK_INSERT).returns(2)
100
- @connection.expects(:update).with(regexp_matches(/`id` in \(6,7\)/),EXPECTED_RETRY_FLAGS_CHUNK_INSERT).returns(2)
101
- @connection.expects(:update).with(regexp_matches(/`id` in \(8,9\)/),EXPECTED_RETRY_FLAGS_CHUNK_INSERT).returns(2)
102
- @connection.expects(:update).with(regexp_matches(/`id` in \(10\)/),EXPECTED_RETRY_FLAGS_CHUNK_INSERT).returns(1)
98
+ @connection.expects(:update).with(regexp_matches(/`id` between 2 and 3/),EXPECTED_RETRY_FLAGS_CHUNK_INSERT).returns(2)
99
+ @connection.expects(:update).with(regexp_matches(/`id` between 4 and 5/),EXPECTED_RETRY_FLAGS_CHUNK_INSERT).returns(2)
100
+ @connection.expects(:update).with(regexp_matches(/`id` between 6 and 7/),EXPECTED_RETRY_FLAGS_CHUNK_INSERT).returns(2)
101
+ @connection.expects(:update).with(regexp_matches(/`id` between 8 and 9/),EXPECTED_RETRY_FLAGS_CHUNK_INSERT).returns(2)
102
+ @connection.expects(:update).with(regexp_matches(/`id` between 10 and 10/),EXPECTED_RETRY_FLAGS_CHUNK_INSERT).returns(1)
103
103
 
104
104
  @chunker.run
105
105
  end
@@ -113,7 +113,7 @@ describe Lhm::IdSetChunkFinder do
113
113
  end
114
114
 
115
115
  @connection.expects(:select_values).with(regexp_matches(/order by id asc/),EXPECTED_RETRY_FLAGS_CHUNKER).returns([1, 2])
116
- @connection.expects(:update).with(regexp_matches(/where \(foo.created_at > '2013-07-10' or foo.baz = 'quux'\) and `foo`.*`id` in \(1,2\)/),EXPECTED_RETRY_FLAGS_CHUNK_INSERT).returns(1)
116
+ @connection.expects(:update).with(regexp_matches(/where \(foo.created_at > '2013-07-10' or foo.baz = 'quux'\) and `foo`.*`id` between 1 and 2/),EXPECTED_RETRY_FLAGS_CHUNK_INSERT).returns(1)
117
117
  @connection.expects(:execute).with(regexp_matches(/show warnings/),EXPECTED_RETRY_FLAGS_CHUNKER).returns([])
118
118
 
119
119
  def @migration.conditions
@@ -132,7 +132,7 @@ describe Lhm::IdSetChunkFinder do
132
132
  end
133
133
 
134
134
  @connection.expects(:select_values).with(regexp_matches(/order by id asc/),EXPECTED_RETRY_FLAGS_CHUNKER).returns([1,2])
135
- @connection.expects(:update).with(regexp_matches(/inner join bar on foo.id = bar.foo_id and.*`id` in \(1,2\)/),EXPECTED_RETRY_FLAGS_CHUNK_INSERT).returns(1)
135
+ @connection.expects(:update).with(regexp_matches(/inner join bar on foo.id = bar.foo_id and.*`id` between 1 and 2/),EXPECTED_RETRY_FLAGS_CHUNK_INSERT).returns(1)
136
136
  @connection.expects(:execute).with(regexp_matches(/show warnings/),EXPECTED_RETRY_FLAGS_CHUNKER).returns([])
137
137
 
138
138
  def @migration.conditions
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lhm-teak
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.6.2
4
+ version: 3.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - SoundCloud