lhm-teak 3.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. checksums.yaml +7 -0
  2. data/.github/workflows/test.yml +43 -0
  3. data/.gitignore +12 -0
  4. data/.rubocop.yml +183 -0
  5. data/.travis.yml +21 -0
  6. data/Appraisals +24 -0
  7. data/CHANGELOG.md +254 -0
  8. data/Gemfile +5 -0
  9. data/Gemfile.lock +67 -0
  10. data/LICENSE +27 -0
  11. data/README.md +335 -0
  12. data/Rakefile +33 -0
  13. data/dev.yml +45 -0
  14. data/docker-compose.yml +60 -0
  15. data/gemfiles/activerecord_5.2.gemfile +9 -0
  16. data/gemfiles/activerecord_5.2.gemfile.lock +66 -0
  17. data/gemfiles/activerecord_6.0.gemfile +7 -0
  18. data/gemfiles/activerecord_6.0.gemfile.lock +68 -0
  19. data/gemfiles/activerecord_6.1.gemfile +7 -0
  20. data/gemfiles/activerecord_6.1.gemfile.lock +67 -0
  21. data/gemfiles/activerecord_7.0.0.alpha2.gemfile +7 -0
  22. data/gemfiles/activerecord_7.0.0.alpha2.gemfile.lock +65 -0
  23. data/lhm.gemspec +38 -0
  24. data/lib/lhm/atomic_switcher.rb +46 -0
  25. data/lib/lhm/chunk_finder.rb +62 -0
  26. data/lib/lhm/chunk_insert.rb +61 -0
  27. data/lib/lhm/chunker.rb +95 -0
  28. data/lib/lhm/cleanup/current.rb +71 -0
  29. data/lib/lhm/command.rb +48 -0
  30. data/lib/lhm/connection.rb +108 -0
  31. data/lib/lhm/entangler.rb +112 -0
  32. data/lib/lhm/intersection.rb +51 -0
  33. data/lib/lhm/invoker.rb +100 -0
  34. data/lib/lhm/locked_switcher.rb +76 -0
  35. data/lib/lhm/migration.rb +51 -0
  36. data/lib/lhm/migrator.rb +244 -0
  37. data/lib/lhm/printer.rb +63 -0
  38. data/lib/lhm/proxysql_helper.rb +10 -0
  39. data/lib/lhm/railtie.rb +9 -0
  40. data/lib/lhm/sql_helper.rb +77 -0
  41. data/lib/lhm/sql_retry.rb +180 -0
  42. data/lib/lhm/table.rb +121 -0
  43. data/lib/lhm/table_name.rb +23 -0
  44. data/lib/lhm/test_support.rb +35 -0
  45. data/lib/lhm/throttler/slave_lag.rb +162 -0
  46. data/lib/lhm/throttler/threads_running.rb +53 -0
  47. data/lib/lhm/throttler/time.rb +29 -0
  48. data/lib/lhm/throttler.rb +36 -0
  49. data/lib/lhm/timestamp.rb +11 -0
  50. data/lib/lhm/version.rb +6 -0
  51. data/lib/lhm-shopify.rb +1 -0
  52. data/lib/lhm.rb +156 -0
  53. data/scripts/helpers/wait-for-dbs.sh +21 -0
  54. data/scripts/mysql/reader/create_replication.sql +10 -0
  55. data/scripts/mysql/writer/create_test_db.sql +1 -0
  56. data/scripts/mysql/writer/create_users.sql +6 -0
  57. data/scripts/proxysql/proxysql.cnf +117 -0
  58. data/shipit.rubygems.yml +0 -0
  59. data/spec/.lhm.example +4 -0
  60. data/spec/README.md +58 -0
  61. data/spec/fixtures/bigint_table.ddl +4 -0
  62. data/spec/fixtures/composite_primary_key.ddl +6 -0
  63. data/spec/fixtures/composite_primary_key_dest.ddl +6 -0
  64. data/spec/fixtures/custom_primary_key.ddl +6 -0
  65. data/spec/fixtures/custom_primary_key_dest.ddl +6 -0
  66. data/spec/fixtures/destination.ddl +6 -0
  67. data/spec/fixtures/lines.ddl +7 -0
  68. data/spec/fixtures/origin.ddl +6 -0
  69. data/spec/fixtures/permissions.ddl +5 -0
  70. data/spec/fixtures/small_table.ddl +4 -0
  71. data/spec/fixtures/tracks.ddl +5 -0
  72. data/spec/fixtures/users.ddl +14 -0
  73. data/spec/fixtures/wo_id_int_column.ddl +6 -0
  74. data/spec/integration/atomic_switcher_spec.rb +129 -0
  75. data/spec/integration/chunk_insert_spec.rb +30 -0
  76. data/spec/integration/chunker_spec.rb +269 -0
  77. data/spec/integration/cleanup_spec.rb +147 -0
  78. data/spec/integration/database.yml +25 -0
  79. data/spec/integration/entangler_spec.rb +68 -0
  80. data/spec/integration/integration_helper.rb +252 -0
  81. data/spec/integration/invoker_spec.rb +33 -0
  82. data/spec/integration/lhm_spec.rb +659 -0
  83. data/spec/integration/lock_wait_timeout_spec.rb +30 -0
  84. data/spec/integration/locked_switcher_spec.rb +50 -0
  85. data/spec/integration/proxysql_spec.rb +34 -0
  86. data/spec/integration/sql_retry/db_connection_helper.rb +52 -0
  87. data/spec/integration/sql_retry/lock_wait_spec.rb +127 -0
  88. data/spec/integration/sql_retry/lock_wait_timeout_test_helper.rb +114 -0
  89. data/spec/integration/sql_retry/proxysql_helper.rb +22 -0
  90. data/spec/integration/sql_retry/retry_with_proxysql_spec.rb +109 -0
  91. data/spec/integration/table_spec.rb +83 -0
  92. data/spec/integration/toxiproxy_helper.rb +40 -0
  93. data/spec/test_helper.rb +69 -0
  94. data/spec/unit/atomic_switcher_spec.rb +29 -0
  95. data/spec/unit/chunk_finder_spec.rb +73 -0
  96. data/spec/unit/chunk_insert_spec.rb +67 -0
  97. data/spec/unit/chunker_spec.rb +176 -0
  98. data/spec/unit/connection_spec.rb +111 -0
  99. data/spec/unit/entangler_spec.rb +187 -0
  100. data/spec/unit/intersection_spec.rb +51 -0
  101. data/spec/unit/lhm_spec.rb +46 -0
  102. data/spec/unit/locked_switcher_spec.rb +46 -0
  103. data/spec/unit/migrator_spec.rb +144 -0
  104. data/spec/unit/printer_spec.rb +85 -0
  105. data/spec/unit/sql_helper_spec.rb +28 -0
  106. data/spec/unit/table_name_spec.rb +39 -0
  107. data/spec/unit/table_spec.rb +47 -0
  108. data/spec/unit/throttler/slave_lag_spec.rb +322 -0
  109. data/spec/unit/throttler/threads_running_spec.rb +64 -0
  110. data/spec/unit/throttler_spec.rb +124 -0
  111. data/spec/unit/unit_helper.rb +26 -0
  112. metadata +366 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: b84f8808e479b9588bcd03e14dd67ef885b058d2abec860e174a947545ff2af0
4
+ data.tar.gz: 644b6c7e3565d091a8a24d05d35d4077c63846c62761ff637ebc754cd1be846a
5
+ SHA512:
6
+ metadata.gz: 046cf2c7d36a0ca272bcb0b0130bfd115cc3723610b6b4f9e8d74fe9757a96c3ab3a2e0be779810a6d7a2894ca660e518ffb407b21371de60e8f31ec45113c61
7
+ data.tar.gz: e60d5ad405e2a7cbc2f9d057a13ad7fc85bd89d0f6472685a5d72a33cc19b8878688e94a8f2968466028db4947cadcdaaa7fb415f442f7140d803d373ee3e21e
@@ -0,0 +1,43 @@
1
+ name: Tests
2
+
3
+ on:
4
+ push:
5
+ branches: [ master ]
6
+ pull_request:
7
+ branches: [ master ]
8
+
9
+ jobs:
10
+ test:
11
+ name: Run tests
12
+ runs-on: ubuntu-latest
13
+
14
+ strategy:
15
+ fail-fast: false
16
+ matrix:
17
+ include:
18
+ - ruby-version: "2.4"
19
+ activerecord-version: "5.2"
20
+ - ruby-version: "2.5"
21
+ activerecord-version: "6.0"
22
+ - ruby-version: "2.7.5"
23
+ activerecord-version: "6.1"
24
+ - ruby-version: "3.0"
25
+ activerecord-version: "7.0.0.alpha2"
26
+ steps:
27
+ - uses: actions/checkout@v2
28
+ - name: Set up Ruby
29
+ uses: ruby/setup-ruby@v1
30
+ with:
31
+ ruby-version: ${{matrix.ruby-version}}
32
+ bundler-cache: false
33
+ - name: Install Ruby packages
34
+ run: BUNDLE_GEMFILE="${GITHUB_WORKSPACE}/gemfiles/activerecord_${{ matrix.activerecord-version }}.gemfile" bundle install
35
+ - name: Install Ubuntu packages
36
+ run: sudo apt-get update && sudo apt-get install numactl libaio-dev libmysqlclient-dev
37
+ - name: Setup MySQL and ProxySQL (docker-compose)
38
+ run: docker-compose up -d # Might have to change to docker compose up -d (i.e. Compose V2) when the Ubuntu image changes the docker-compose version
39
+ - name: Wait until DBs are alive
40
+ run: ./scripts/helpers/wait-for-dbs.sh
41
+ timeout-minutes: 2
42
+ - name: Run tests
43
+ run: BUNDLE_GEMFILE="${GITHUB_WORKSPACE}/gemfiles/activerecord_${{ matrix.activerecord-version }}.gemfile" bundle exec rake specs
data/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ *.gem
2
+ .bundle
3
+ pkg/*
4
+ .rvmrc
5
+ .ruby-version
6
+ .ruby-gemset
7
+ bin/rake
8
+ gemfiles/vendor
9
+ omg.ponies
10
+ *~
11
+ coverage
12
+ .idea/
data/.rubocop.yml ADDED
@@ -0,0 +1,183 @@
1
+ # This configuration was generated by `rubocop --auto-gen-config`
2
+ # on 2015-01-12 14:49:41 +0100 using RuboCop version 0.26.1.
3
+ # The point is for the user to remove these configuration records
4
+ # one by one as the offenses are removed from the code base.
5
+ # Note that changes in the inspected code, or installation of new
6
+ # versions of RuboCop, may require this file to be generated again.
7
+
8
+ AllCops:
9
+ Exclude:
10
+ - 'gemfiles/**/*'
11
+
12
+ # Offense count: 1
13
+ # Configuration parameters: CountComments.
14
+ Metrics/ClassLength:
15
+ Max: 131
16
+
17
+ # Offense count: 3
18
+ Metrics/CyclomaticComplexity:
19
+ Max: 19
20
+
21
+ # Offense count: 77
22
+ # Configuration parameters: AllowURI, URISchemes.
23
+ Metrics/LineLength:
24
+ Max: 197
25
+
26
+ # Offense count: 11
27
+ # Configuration parameters: CountComments.
28
+ Metrics/MethodLength:
29
+ Max: 27
30
+
31
+ # Offense count: 3
32
+ Metrics/PerceivedComplexity:
33
+ Max: 15
34
+
35
+ # Offense count: 5
36
+ # Cop supports --auto-correct.
37
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
38
+ Style/AndOr:
39
+ Enabled: false
40
+
41
+ # Offense count: 13
42
+ # Cop supports --auto-correct.
43
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
44
+ Style/BarePercentLiterals:
45
+ Enabled: false
46
+
47
+ # Offense count: 11
48
+ # Cop supports --auto-correct.
49
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
50
+ Style/BracesAroundHashParameters:
51
+ Enabled: false
52
+
53
+ # Offense count: 5
54
+ Style/ClassVars:
55
+ Enabled: false
56
+
57
+ # Offense count: 3
58
+ # Cop supports --auto-correct.
59
+ # Configuration parameters: PreferredMethods.
60
+ Style/CollectionMethods:
61
+ Enabled: false
62
+
63
+ # Offense count: 24
64
+ Style/Documentation:
65
+ Enabled: false
66
+
67
+ # Offense count: 28
68
+ # Cop supports --auto-correct.
69
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
70
+ Style/DotPosition:
71
+ Enabled: false
72
+
73
+ # Offense count: 4
74
+ Style/DoubleNegation:
75
+ Enabled: false
76
+
77
+ # Offense count: 1
78
+ Style/EachWithObject:
79
+ Enabled: false
80
+
81
+ # Offense count: 1
82
+ # Configuration parameters: Exclude.
83
+ Style/FileName:
84
+ Enabled: false
85
+
86
+ # Offense count: 11
87
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
88
+ Style/FormatString:
89
+ Enabled: false
90
+
91
+ # Offense count: 10
92
+ # Configuration parameters: AllowedVariables.
93
+ Style/GlobalVars:
94
+ Enabled: false
95
+
96
+ # Offense count: 9
97
+ # Configuration parameters: MinBodyLength.
98
+ Style/GuardClause:
99
+ Enabled: false
100
+
101
+ # Offense count: 88
102
+ # Cop supports --auto-correct.
103
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
104
+ Style/HashSyntax:
105
+ Enabled: false
106
+
107
+ # Offense count: 3
108
+ # Configuration parameters: MaxLineLength.
109
+ Style/IfUnlessModifier:
110
+ Enabled: false
111
+
112
+ # Offense count: 14
113
+ # Cop supports --auto-correct.
114
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
115
+ Style/IndentHash:
116
+ Enabled: false
117
+
118
+ # Offense count: 2
119
+ Style/ModuleFunction:
120
+ Enabled: false
121
+
122
+ # Offense count: 2
123
+ Style/MultilineBlockChain:
124
+ Enabled: false
125
+
126
+ # Offense count: 4
127
+ # Cop supports --auto-correct.
128
+ Style/NumericLiterals:
129
+ MinDigits: 8
130
+
131
+ # Offense count: 14
132
+ # Cop supports --auto-correct.
133
+ # Configuration parameters: PreferredDelimiters.
134
+ Style/PercentLiteralDelimiters:
135
+ Enabled: false
136
+
137
+ # Offense count: 3
138
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
139
+ Style/RaiseArgs:
140
+ Enabled: false
141
+
142
+ # Offense count: 1
143
+ Style/RescueModifier:
144
+ Enabled: false
145
+
146
+ # Offense count: 1
147
+ Style/SelfAssignment:
148
+ Enabled: false
149
+
150
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
151
+ Style/SignalException:
152
+ EnforcedStyle: only_raise
153
+ Enabled: true
154
+
155
+ # Cop supports --auto-correct.
156
+ # Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SupportedStyles.
157
+ Style/SpaceInsideHashLiteralBraces:
158
+ SupportedStyles: space
159
+
160
+ # Offense count: 2
161
+ # Cop supports --auto-correct.
162
+ Style/SpecialGlobalVars:
163
+ Enabled: false
164
+
165
+ # Offense count: 5
166
+ # Cop supports --auto-correct.
167
+ # Configuration parameters: ExactNameMatch, AllowPredicates, AllowDSLWriters, Whitelist.
168
+ Style/TrivialAccessors:
169
+ Enabled: false
170
+
171
+ # Offense count: 15
172
+ # Cop supports --auto-correct.
173
+ Style/UnneededPercentQ:
174
+ Enabled: false
175
+
176
+ # Offense count: 3
177
+ # Cop supports --auto-correct.
178
+ Style/WordArray:
179
+ MinSize: 2
180
+
181
+ # Offense count: 7
182
+ Metrics/AbcSize:
183
+ Max: 31
data/.travis.yml ADDED
@@ -0,0 +1,21 @@
1
+ language: ruby
2
+ before_script:
3
+ - "mysql -e 'create database lhm;'"
4
+ rvm:
5
+ - 2.0.0
6
+ - 2.1
7
+ - 2.2
8
+ sudo: false
9
+ gemfile:
10
+ - gemfiles/ar-2.3_mysql.gemfile
11
+ - gemfiles/ar-3.2_mysql.gemfile
12
+ - gemfiles/ar-3.2_mysql2.gemfile
13
+ - gemfiles/ar-4.0_mysql2.gemfile
14
+ - gemfiles/ar-4.1_mysql2.gemfile
15
+ - gemfiles/ar-4.2_mysql2.gemfile
16
+ matrix:
17
+ exclude:
18
+ - rvm: 2.2
19
+ gemfile: gemfiles/ar-3.2_mysql.gemfile
20
+ - rvm: 2.2
21
+ gemfile: gemfiles/ar-2.3_mysql.gemfile
data/Appraisals ADDED
@@ -0,0 +1,24 @@
1
+ # Oldest supported Rails version
2
+ appraise "activerecord-5.2" do
3
+ gem "activerecord", "5.2.6"
4
+
5
+ # This gemfile will be ran against ruby 2.4 and some gems might require 2.4+. The following list are the gems
6
+ # and their respective versions that work with ruby <= 2.4
7
+ gem "simplecov", "0.18.5"
8
+ gem "docile", "1.3.5"
9
+ end
10
+
11
+ # First conflicted version
12
+ appraise "activerecord-6.0" do
13
+ gem "activerecord", "6.0.0"
14
+ end
15
+
16
+ # Second conflicted version
17
+ appraise "activerecord-6.1" do
18
+ gem "activerecord", "6.1.0"
19
+ end
20
+
21
+ # Latest version at the moment
22
+ appraise "activerecord-7.0.0.alpha2" do
23
+ gem "activerecord", "7.0.0.alpha2"
24
+ end
data/CHANGELOG.md ADDED
@@ -0,0 +1,254 @@
1
+ # 3.5.5 (Jan, 2022)
2
+ * Fix error where from Config shadowing which would cause LHM to abort on reconnect (https://github.com/Shopify/lhm/pull/128)
3
+
4
+ # 3.5.4 (Dec, 2021)
5
+ * Refactored the way options are handled internally. Code is now much clearer to understand
6
+ * Removed optional connection_options from `Lhm.setup` and `Lhm.connection`
7
+ * Option `reconnect_with_consistent_host` will now be provided with `options` for `Lhm.change_table`
8
+
9
+ # 3.5.3 (Dec, 2021)
10
+ * Adds ProxySQL comments at the end of query to accommodate for internal tool's requirements
11
+
12
+ # 3.5.2 (Dec, 2021)
13
+ * Fixed error on undefined connection, when calling `Lhm.connection` without calling `Lhm.setup` first
14
+ * Changed `Lhm.connection.connection` to `lhm.connection.ar_connection` for increased clarity and readability
15
+
16
+ # 3.5.1 (Dec , 2021)
17
+ * Add better logging to the LHM components (https://github.com/Shopify/lhm/pull/112)
18
+ * Slave lag throttler now supports ActiveRecord > 6.0
19
+ * [Dev] Add `Appraisals` to test against multiple version
20
+
21
+ # 3.5.0 (Dec , 2021)
22
+ * Duplicate of 3.4.2 (unfortunate mistake)
23
+
24
+ # 3.4.2 (Sept, 2021)
25
+ * Fixed Chunker's undefined name error (https://github.com/Shopify/lhm/pull/110)
26
+
27
+ # 3.4.1 (Sep 22, 2021)
28
+
29
+ * Add better logging to the LHM components (https://github.com/Shopify/lhm/pull/108)
30
+
31
+ # 3.4.0 (Jul 19, 2021)
32
+
33
+ * Log or raise on unexpected duplicated entry warnings during INSERT IGNORE (https://github.com/Shopify/lhm/pull/100)
34
+
35
+ # 3.3.6 (Jul 7, 2021)
36
+
37
+ * Add lhm-shopify.rb to require lhm
38
+
39
+ # 3.3.5 (Jul 5, 2021)
40
+
41
+ * Add comment and collate copying to rename_column
42
+ * Publish to rubygems
43
+
44
+ # 3.3.4 (Feb 9, 2021)
45
+
46
+ * Run migrations inline in local/CI environment
47
+
48
+ # 3.3.3 (Nov 20, 2020)
49
+
50
+ * Add test for tables with composite primary keys.
51
+ * Add test for migrating to a composite primary key.
52
+ * Tests updated to work on MacOS Catalina
53
+ * LHM will now print exceptions to @printer if @printer responds to :exception
54
+ * New ThreadsRunning throttler uses MySQL Performance Schema to decide whether to throttle
55
+
56
+ # 3.3.2 (not fully released)
57
+
58
+ * Catch _even_ more MySQL errors by default with SqlRetry.
59
+
60
+ # 3.3.1 (Nov 8, 2019)
61
+
62
+ * Ensure that :retriable configuration is correctly passed to all SqlRetry
63
+ instances.
64
+ * Retry `Chunker#upper_id` and `options[:verifier]` on MySQL failure.
65
+ * Catch more MySQL errors by default with SqlRetry.
66
+
67
+ # 3.3.0 (Oct 21, 2019)
68
+
69
+ * Add a :verifier key to the options hash, with a default implementation which aborts the LHM if the triggers are removed.
70
+
71
+ # 3.2.5 (Jun 24, 2019)
72
+
73
+ * Tighten dependency on retriable gem and remove workarounds for old version
74
+
75
+ # 3.2.4 (Oct 16, 2018)
76
+
77
+ * Retry `Cleanup::Current` just like we retry all the other DDLs.
78
+
79
+ # 3.2.3 (Oct 16, 2018)
80
+
81
+ * Add ActiveRecord::QueryTimedout exception class to be retried on "Timeout waiting for a response from the last query" message.
82
+
83
+ # 3.2.2 (Oct 11, 2018)
84
+
85
+ * Try to take a higher lock_wait_timeout value than others (https://github.com/Shopify/lhm/pull/60)
86
+
87
+ # 3.2.1 (Oct 11, 2018)
88
+
89
+ * Retry on `MySQL::Error::Timeout` (https://github.com/Shopify/lhm/pull/57)
90
+ * Retry 20 times by default (https://github.com/Shopify/lhm/pull/58)
91
+
92
+ # 3.2.0 (Sep 4, 2018)
93
+
94
+ * Fix Slave lag throttler database config (https://github.com/Shopify/lhm/pull/55)
95
+ * Loosen dependency on retriable gem (https://github.com/Shopify/lhm/pull/54)
96
+ * Overhaul retries for deadlocks, wait timeouts on Chunker, Entangler, and AtomicSwitcher (https://github.com/Shopify/lhm/pull/51)
97
+
98
+ # 3.1.1
99
+
100
+ * Cleanup tables between tests (https://github.com/Shopify/lhm/pull/48)
101
+ * Ensure all table names are less than 64 characters (https://github.com/Shopify/lhm/pull/49)
102
+
103
+ # 3.1.0
104
+
105
+ * Unify Entangler and AtomicSwitcher retry interface (https://github.com/Shopify/lhm/pull/39)
106
+ * Remove scripts replaced by dbdeployer (https://github.com/Shopify/lhm/pull/40)
107
+ * Rename lhmn_ tables to lhma_ to avoid IBP stalls (https://github.com/Shopify/lhm/pull/41)
108
+
109
+ # 3.0.0
110
+
111
+ * Drop support for throttle and stride options. Use `throttler`, instead:
112
+ ```
113
+ Lhm.change_table :users, throttler: [:time_throttler, {stride: x}] do
114
+ end
115
+ ```
116
+ * #118 - Truncate long trigger names. (@sj26)
117
+ * #114 - Update chunker requirements (@bjk-soundcloud)
118
+ * #98 - Add slave lag throttler. (@camilo, @jasonhl)
119
+ * #92 - Fix check for table requirement before starting a lhm.(@hannestyden)
120
+ * #93 - Makes the atomic switcher retry on metadata locks (@camilo)
121
+ * #63 - Sets the LHM's session lock wait timeout variables (@camilo)
122
+ * #75 - Remove DataMapper and ActiveRecord 2.x support (@camilo)
123
+
124
+ # 2.2.0 (Jan 16, 2015)
125
+
126
+ * #84 - Require index names to be strings or symbols (Thibaut)
127
+ * #39 - Adding the ability to rename columns (erikogan)
128
+ * #67 - Allow for optional time filter on .cleanup (joelr)
129
+
130
+ # 2.1.0 (July 31, 2014)
131
+
132
+ * #48 - Add percentage output for migrations (@arthurnn)
133
+ * #60 - Quote table names (@spickermann)
134
+ * #59 - Escape table name in select_limit and select_start methods (@stevehodgkiss)
135
+ * #57 - Ensure chunking 'where' clause handled separately (@rentalcustard)
136
+ * #54 - Chunker handle stride changes (@rentalcustard)
137
+ * #52 - Implement ability to control timeout and stride from Throttler (@edmundsalvacion)
138
+ * #51 - Ensure Lhm.cleanup removes temporary triggers (@edmundsalvacion)
139
+ * #46 - Allow custom throttler (@arthurnn)
140
+
141
+ # 2.0.0 (July 10, 2013)
142
+
143
+ * #44 - Conditional migrations (@durran)
144
+
145
+ # 1.3.0 (May 28, 2013)
146
+
147
+ * Add Lhm.cleanup method for removing copy tables, thanks @bogdan
148
+ * Limit copy table names to 64 characters, thanks @charliesome
149
+
150
+ # 1.2.0 (February 22, 2013)
151
+
152
+ * Added DataMapper support, no API changes for current users. Refer to the
153
+ README for information.
154
+ * Documentation updates. Thanks @tiegz and @vinbarnes.
155
+
156
+ # 1.1.0 (April 29, 2012)
157
+
158
+ * Add option to specify custom index name
159
+ * Add mysql2 compatibility
160
+ * Add AtomicSwitcher
161
+
162
+ # 1.0.3 (February 23, 2012)
163
+
164
+ * Improve change_column
165
+
166
+ # 1.0.2 (February 17, 2012)
167
+
168
+ * closes https://github.com/soundcloud/large-hadron-migrator/issues/11
169
+ this critical bug could cause data loss. table parser was replaced with
170
+ an implementation that reads directly from information_schema.
171
+
172
+ # 1.0.1 (February 09, 2012)
173
+
174
+ * released to rubygems
175
+
176
+ # 1.0.0 (February 09, 2012)
177
+
178
+ * added change_column
179
+ * final 1.0 release
180
+
181
+ # 1.0.0.rc8 (February 09, 2012)
182
+
183
+ * removed spec binaries from gem bins
184
+
185
+ # 1.0.0.rc7 (January 31, 2012)
186
+
187
+ * added SqlHelper.annotation into the middle of trigger statements. this
188
+ is for the benefit of the killer script which should not kill trigger
189
+ statements.
190
+
191
+ # 1.0.0.rc6 (January 30, 2012)
192
+
193
+ * added --confirm to kill script; fixes to kill script
194
+
195
+ # 1.0.0.rc5 (January 30, 2012)
196
+
197
+ * moved scripts into bin, renamed, added to gem binaries
198
+
199
+ # 1.0.0.rc4 (January 29, 2012)
200
+
201
+ * added '-- lhm' to the end of statements for more visibility
202
+
203
+ # 1.0.0.rc3 (January 19, 2012)
204
+
205
+ * Speedup migrations for tables with large minimum id
206
+ * Add a bit yard documentation
207
+ * Fix issues with index creation on reserved column names
208
+ * Improve error handling
209
+ * Add tests for replication
210
+ * Rename public API method from `hadron_change_table` to `change_table`
211
+ * Add tests for ActiveRecord 2.3 and 3.1 compatibility
212
+
213
+ # 1.0.0.rc2 (January 18, 2012)
214
+
215
+ * Speedup migrations for tables with large ids
216
+ * Fix conversion of milliseconds to seconds
217
+ * Fix handling of sql errors
218
+ * Add helper to create unique index
219
+ * Allow index creation on prefix of column
220
+ * Quote column names on index creation
221
+ * Remove ambiguous method signature
222
+ * Documentation fix
223
+ * 1.8.7 compatibility
224
+
225
+ # 1.0.0.rc1 (January 15, 2012)
226
+
227
+ * rewrite.
228
+
229
+ # 0.2.1 (November 26, 2011)
230
+
231
+ * Include changelog in gem
232
+
233
+ # 0.2.0 (November 26, 2011)
234
+
235
+ * Add Ruby 1.8 compatibility
236
+ * Setup travis continuous integration
237
+ * Fix record lose issue
238
+ * Fix and speed up specs
239
+
240
+ # 0.1.4
241
+
242
+ * Merged [Pullrequest #9](https://github.com/soundcloud/large-hadron-migrator/pull/9)
243
+
244
+ # 0.1.3
245
+
246
+ * code cleanup
247
+ * Merged [Pullrequest #8](https://github.com/soundcloud/large-hadron-migrator/pull/8)
248
+ * Merged [Pullrequest #7](https://github.com/soundcloud/large-hadron-migrator/pull/7)
249
+ * Merged [Pullrequest #4](https://github.com/soundcloud/large-hadron-migrator/pull/4)
250
+ * Merged [Pullrequest #1](https://github.com/soundcloud/large-hadron-migrator/pull/1)
251
+
252
+ # 0.1.2
253
+
254
+ * Initial Release
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in shopify_lhm.gemspec
4
+ gemspec
5
+
data/Gemfile.lock ADDED
@@ -0,0 +1,67 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ lhm-teak (3.6.0)
5
+ retriable (>= 3.0.0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ activemodel (6.1.4.1)
11
+ activesupport (= 6.1.4.1)
12
+ activerecord (6.1.4.1)
13
+ activemodel (= 6.1.4.1)
14
+ activesupport (= 6.1.4.1)
15
+ activesupport (6.1.4.1)
16
+ concurrent-ruby (~> 1.0, >= 1.0.2)
17
+ i18n (>= 1.6, < 2)
18
+ minitest (>= 5.1)
19
+ tzinfo (~> 2.0)
20
+ zeitwerk (~> 2.3)
21
+ after_do (0.4.0)
22
+ appraisal (2.4.1)
23
+ bundler
24
+ rake
25
+ thor (>= 0.14.0)
26
+ byebug (11.1.3)
27
+ concurrent-ruby (1.1.9)
28
+ docile (1.4.0)
29
+ i18n (1.8.11)
30
+ concurrent-ruby (~> 1.0)
31
+ minitest (5.14.4)
32
+ mocha (1.13.0)
33
+ mysql2 (0.5.3)
34
+ rake (13.0.6)
35
+ retriable (3.1.2)
36
+ simplecov (0.21.2)
37
+ docile (~> 1.1)
38
+ simplecov-html (~> 0.11)
39
+ simplecov_json_formatter (~> 0.1)
40
+ simplecov-html (0.12.3)
41
+ simplecov_json_formatter (0.1.3)
42
+ thor (1.1.0)
43
+ toxiproxy (2.0.0)
44
+ tzinfo (2.0.4)
45
+ concurrent-ruby (~> 1.0)
46
+ zeitwerk (2.5.1)
47
+
48
+ PLATFORMS
49
+ arm64-darwin-21
50
+ x86_64-darwin-20
51
+ x86_64-linux
52
+
53
+ DEPENDENCIES
54
+ activerecord
55
+ after_do
56
+ appraisal
57
+ byebug
58
+ lhm-teak!
59
+ minitest
60
+ mocha
61
+ mysql2
62
+ rake
63
+ simplecov
64
+ toxiproxy
65
+
66
+ BUNDLED WITH
67
+ 2.2.22
data/LICENSE ADDED
@@ -0,0 +1,27 @@
1
+ Copyright (c) 2011 - 2013, SoundCloud, Rany Keddo, Tobias Bielohlawek, Tobias Schmidt
2
+
3
+ All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are met:
7
+
8
+ - Redistributions of source code must retain the above copyright notice, this
9
+ list of conditions and the following disclaimer.
10
+ - Redistributions in binary form must reproduce the above copyright notice,
11
+ this list of conditions and the following disclaimer in the documentation
12
+ and/or other materials provided with the distribution.
13
+ - Neither the name of the SoundCloud nor the names of its contributors may be
14
+ used to endorse or promote products derived from this software without
15
+ specific prior written permission.
16
+
17
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
21
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
24
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
+