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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/lhm/chunk_insert.rb +3 -3
- data/lib/lhm/id_set_chunk_finder.rb +3 -2
- data/lib/lhm/version.rb +1 -1
- data/spec/unit/id_set_chunk_finder_spec.rb +17 -17
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 97826be10fb4623438563b99a21112df2fbbc2c996e67801282f1f89bfd3627b
|
4
|
+
data.tar.gz: e10b40b4a0d6e5b99b1b1e76c7c6e7475c6bc796f3d597c9f20c941e2b16c511
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c3044f49b65ab2004cdcfda5ed96cdd7050157f906d58275ad5b774ca61fda52fd3c7d88837a85aa5a7782aa36d7f303a27549c40305c0cf0015a5e2d7030bca
|
7
|
+
data.tar.gz: cb8801aaf5d7777eb201accf77f4bc16fd9aae7743a862605b72d4eb547a624ee2db598f81b8cb7b2a58d41348b15f017e5ef132efde824417563aa995531175
|
data/Gemfile.lock
CHANGED
data/lib/lhm/chunk_insert.rb
CHANGED
@@ -6,12 +6,12 @@ module Lhm
|
|
6
6
|
|
7
7
|
LOG_PREFIX = "ChunkInsert"
|
8
8
|
|
9
|
-
def initialize(migration, connection, lowest, highest,
|
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
|
-
@
|
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
|
-
|
26
|
+
range = @processed_rows...next_idx
|
27
|
+
ids_to_insert = ids[range]
|
27
28
|
@processed_rows = next_idx
|
28
|
-
yield
|
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
@@ -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`
|
47
|
-
@connection.expects(:update).with(regexp_matches(/`id`
|
48
|
-
@connection.expects(:update).with(regexp_matches(/`id`
|
49
|
-
@connection.expects(:update).with(regexp_matches(/`id`
|
50
|
-
@connection.expects(:update).with(regexp_matches(/`id`
|
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`
|
70
|
-
@connection.expects(:update).with(regexp_matches(/`id`
|
71
|
-
@connection.expects(:update).with(regexp_matches(/`id`
|
72
|
-
@connection.expects(:update).with(regexp_matches(/`id`
|
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`
|
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`
|
99
|
-
@connection.expects(:update).with(regexp_matches(/`id`
|
100
|
-
@connection.expects(:update).with(regexp_matches(/`id`
|
101
|
-
@connection.expects(:update).with(regexp_matches(/`id`
|
102
|
-
@connection.expects(:update).with(regexp_matches(/`id`
|
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`
|
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`
|
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
|