makara 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. checksums.yaml +4 -4
  2. data/.github/dependabot.yml +11 -0
  3. data/.github/workflows/CI.yml +88 -0
  4. data/.rspec +1 -1
  5. data/.rubocop.yml +15 -0
  6. data/.rubocop_todo.yml +670 -0
  7. data/CHANGELOG.md +14 -6
  8. data/Gemfile +1 -16
  9. data/README.md +2 -1
  10. data/Rakefile +1 -1
  11. data/gemfiles/activerecord_5.2.gemfile +8 -0
  12. data/gemfiles/activerecord_6.0.gemfile +8 -0
  13. data/gemfiles/activerecord_6.1.gemfile +8 -0
  14. data/gemfiles/activerecord_head.gemfile +6 -0
  15. data/lib/active_record/connection_adapters/jdbcmysql_makara_adapter.rb +4 -18
  16. data/lib/active_record/connection_adapters/jdbcpostgresql_makara_adapter.rb +4 -18
  17. data/lib/active_record/connection_adapters/makara_abstract_adapter.rb +3 -31
  18. data/lib/active_record/connection_adapters/makara_jdbcmysql_adapter.rb +4 -18
  19. data/lib/active_record/connection_adapters/makara_jdbcpostgresql_adapter.rb +4 -18
  20. data/lib/active_record/connection_adapters/makara_mysql2_adapter.rb +4 -20
  21. data/lib/active_record/connection_adapters/makara_postgis_adapter.rb +4 -19
  22. data/lib/active_record/connection_adapters/makara_postgresql_adapter.rb +4 -20
  23. data/lib/active_record/connection_adapters/mysql2_makara_adapter.rb +4 -20
  24. data/lib/active_record/connection_adapters/postgresql_makara_adapter.rb +4 -20
  25. data/lib/makara.rb +0 -2
  26. data/lib/makara/cache.rb +0 -2
  27. data/lib/makara/config_parser.rb +5 -14
  28. data/lib/makara/connection_wrapper.rb +24 -27
  29. data/lib/makara/context.rb +1 -0
  30. data/lib/makara/cookie.rb +1 -0
  31. data/lib/makara/error_handler.rb +0 -9
  32. data/lib/makara/errors/all_connections_blacklisted.rb +0 -2
  33. data/lib/makara/errors/blacklist_connection.rb +0 -2
  34. data/lib/makara/errors/blacklisted_while_in_transaction.rb +0 -2
  35. data/lib/makara/errors/invalid_shard.rb +1 -3
  36. data/lib/makara/errors/makara_error.rb +0 -1
  37. data/lib/makara/errors/no_connections_available.rb +0 -2
  38. data/lib/makara/logging/logger.rb +0 -4
  39. data/lib/makara/logging/subscriber.rb +0 -2
  40. data/lib/makara/middleware.rb +1 -2
  41. data/lib/makara/pool.rb +2 -7
  42. data/lib/makara/proxy.rb +25 -27
  43. data/lib/makara/railtie.rb +0 -2
  44. data/lib/makara/strategies/abstract.rb +1 -0
  45. data/lib/makara/strategies/priority_failover.rb +2 -0
  46. data/lib/makara/strategies/round_robin.rb +1 -3
  47. data/lib/makara/strategies/shard_aware.rb +0 -2
  48. data/lib/makara/version.rb +1 -3
  49. data/makara.gemspec +24 -5
  50. data/spec/active_record/connection_adapters/makara_abstract_adapter_error_handling_spec.rb +1 -6
  51. data/spec/active_record/connection_adapters/makara_abstract_adapter_spec.rb +0 -9
  52. data/spec/active_record/connection_adapters/makara_mysql2_adapter_spec.rb +9 -22
  53. data/spec/active_record/connection_adapters/makara_postgis_adapter_spec.rb +2 -10
  54. data/spec/active_record/connection_adapters/makara_postgresql_adapter_spec.rb +7 -20
  55. data/spec/cache_spec.rb +0 -1
  56. data/spec/config_parser_spec.rb +54 -56
  57. data/spec/connection_wrapper_spec.rb +1 -2
  58. data/spec/cookie_spec.rb +1 -1
  59. data/spec/middleware_spec.rb +1 -1
  60. data/spec/pool_spec.rb +3 -16
  61. data/spec/proxy_spec.rb +0 -4
  62. data/spec/spec_helper.rb +5 -1
  63. data/spec/strategies/priority_failover_spec.rb +3 -4
  64. data/spec/strategies/round_robin_spec.rb +4 -8
  65. data/spec/strategies/shard_aware_spec.rb +4 -5
  66. data/spec/support/deep_dup.rb +1 -1
  67. data/spec/support/helpers.rb +5 -5
  68. data/spec/support/mock_objects.rb +1 -4
  69. data/spec/support/mysql2_database.yml +2 -2
  70. data/spec/support/mysql2_database_with_custom_errors.yml +2 -2
  71. data/spec/support/pool_extensions.rb +0 -3
  72. data/spec/support/postgis_schema.rb +1 -1
  73. data/spec/support/postgresql_database.yml +0 -2
  74. data/spec/support/proxy_extensions.rb +1 -3
  75. data/spec/support/schema.rb +1 -1
  76. data/spec/support/user.rb +1 -2
  77. metadata +156 -20
  78. data/.travis.yml +0 -131
  79. data/gemfiles/ar-head.gemfile +0 -24
  80. data/gemfiles/ar30.gemfile +0 -36
  81. data/gemfiles/ar31.gemfile +0 -36
  82. data/gemfiles/ar32.gemfile +0 -36
  83. data/gemfiles/ar40.gemfile +0 -24
  84. data/gemfiles/ar41.gemfile +0 -24
  85. data/gemfiles/ar42.gemfile +0 -24
  86. data/gemfiles/ar50.gemfile +0 -24
  87. data/gemfiles/ar51.gemfile +0 -24
  88. data/gemfiles/ar52.gemfile +0 -24
  89. data/gemfiles/ar60.gemfile +0 -24
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: makara
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Nelson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-12 00:00:00.000000000 Z
11
+ date: 2021-06-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -16,14 +16,154 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 3.0.0
19
+ version: 5.2.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 3.0.0
26
+ version: 5.2.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: rack
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '13.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '13.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.9'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.9'
69
+ - !ruby/object:Gem::Dependency
70
+ name: timecop
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 1.9.1
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 1.9.1
97
+ - !ruby/object:Gem::Dependency
98
+ name: activerecord-postgis-adapter
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: pry-byebug
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: mysql2
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: pg
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: rgeo
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
27
167
  description: Read-write split your DB yo
28
168
  email:
29
169
  - mike@mikeonrails.com
@@ -31,27 +171,23 @@ executables: []
31
171
  extensions: []
32
172
  extra_rdoc_files: []
33
173
  files:
174
+ - ".github/dependabot.yml"
175
+ - ".github/workflows/CI.yml"
34
176
  - ".github/workflows/gem-publish-public.yml"
35
177
  - ".gitignore"
36
178
  - ".rspec"
179
+ - ".rubocop.yml"
180
+ - ".rubocop_todo.yml"
37
181
  - ".ruby-gemset"
38
- - ".travis.yml"
39
182
  - CHANGELOG.md
40
183
  - Gemfile
41
184
  - LICENSE.txt
42
185
  - README.md
43
186
  - Rakefile
44
- - gemfiles/ar-head.gemfile
45
- - gemfiles/ar30.gemfile
46
- - gemfiles/ar31.gemfile
47
- - gemfiles/ar32.gemfile
48
- - gemfiles/ar40.gemfile
49
- - gemfiles/ar41.gemfile
50
- - gemfiles/ar42.gemfile
51
- - gemfiles/ar50.gemfile
52
- - gemfiles/ar51.gemfile
53
- - gemfiles/ar52.gemfile
54
- - gemfiles/ar60.gemfile
187
+ - gemfiles/activerecord_5.2.gemfile
188
+ - gemfiles/activerecord_6.0.gemfile
189
+ - gemfiles/activerecord_6.1.gemfile
190
+ - gemfiles/activerecord_head.gemfile
55
191
  - lib/active_record/connection_adapters/jdbcmysql_makara_adapter.rb
56
192
  - lib/active_record/connection_adapters/jdbcpostgresql_makara_adapter.rb
57
193
  - lib/active_record/connection_adapters/makara_abstract_adapter.rb
@@ -116,11 +252,11 @@ files:
116
252
  - spec/support/proxy_extensions.rb
117
253
  - spec/support/schema.rb
118
254
  - spec/support/user.rb
119
- homepage: https://github.com/taskrabbit/makara
255
+ homepage: https://github.com/instacart/makara
120
256
  licenses:
121
257
  - MIT
122
258
  metadata:
123
- source_code_uri: https://github.com/taskrabbit/makara
259
+ source_code_uri: https://github.com/instacart/makara
124
260
  post_install_message:
125
261
  rdoc_options: []
126
262
  require_paths:
@@ -129,14 +265,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
129
265
  requirements:
130
266
  - - ">="
131
267
  - !ruby/object:Gem::Version
132
- version: '0'
268
+ version: 2.5.0
133
269
  required_rubygems_version: !ruby/object:Gem::Requirement
134
270
  requirements:
135
271
  - - ">="
136
272
  - !ruby/object:Gem::Version
137
273
  version: '0'
138
274
  requirements: []
139
- rubygems_version: 3.1.4
275
+ rubygems_version: 3.2.15
140
276
  signing_key:
141
277
  specification_version: 4
142
278
  summary: Read-write split your DB yo
data/.travis.yml DELETED
@@ -1,131 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- cache: bundler
4
- dist: xenial
5
-
6
- services:
7
- - mysql
8
- - postgresql
9
-
10
- addons:
11
- postgresql: 10
12
- apt:
13
- packages:
14
- - postgresql-10-postgis-2.4
15
-
16
- before_install:
17
- - gem install bundler
18
-
19
- before_script:
20
- - mysql -e 'create database makara_test;'
21
- - psql -c 'create database makara_test;' -U postgres
22
- - psql -c 'create extension postgis;' -U postgres
23
-
24
- rvm:
25
- # - 2.0
26
- # - 2.1
27
- # - 2.2
28
- - 2.3
29
- - 2.4
30
- - 2.5.0
31
- - 2.6.0
32
- - 2.7.0
33
- - ruby-head
34
- - jruby
35
-
36
- gemfile:
37
- # - gemfiles/ar30.gemfile
38
- # - gemfiles/ar31.gemfile
39
- # - gemfiles/ar32.gemfile
40
- # - gemfiles/ar40.gemfile
41
- # - gemfiles/ar41.gemfile
42
- # - gemfiles/ar42.gemfile
43
- - gemfiles/ar50.gemfile
44
- - gemfiles/ar51.gemfile
45
- - gemfiles/ar52.gemfile
46
- - gemfiles/ar60.gemfile
47
- - gemfiles/ar-head.gemfile
48
-
49
- env:
50
- global:
51
- - "JRUBY_OPTS='--dev -J-Xmx1024M'"
52
-
53
- matrix:
54
- exclude:
55
- - gemfile: gemfiles/ar30.gemfile
56
- rvm: 2.2
57
- - gemfile: gemfiles/ar30.gemfile
58
- rvm: 2.3
59
- - gemfile: gemfiles/ar30.gemfile
60
- rvm: 2.4
61
- - gemfile: gemfiles/ar31.gemfile
62
- rvm: 2.4
63
- - gemfile: gemfiles/ar32.gemfile
64
- rvm: 2.4
65
- - gemfile: gemfiles/ar40.gemfile
66
- rvm: 2.4
67
- - gemfile: gemfiles/ar41.gemfile
68
- rvm: 2.4
69
- - gemfile: gemfiles/ar30.gemfile
70
- rvm: 2.5.0
71
- - gemfile: gemfiles/ar31.gemfile
72
- rvm: 2.5.0
73
- - gemfile: gemfiles/ar32.gemfile
74
- rvm: 2.5.0
75
- - gemfile: gemfiles/ar40.gemfile
76
- rvm: 2.5.0
77
- - gemfile: gemfiles/ar41.gemfile
78
- rvm: 2.5.0
79
- - gemfile: gemfiles/ar30.gemfile
80
- rvm: ruby-head
81
- - gemfile: gemfiles/ar31.gemfile
82
- rvm: ruby-head
83
- - gemfile: gemfiles/ar32.gemfile
84
- rvm: ruby-head
85
- - gemfile: gemfiles/ar40.gemfile
86
- rvm: ruby-head
87
- - gemfile: gemfiles/ar41.gemfile
88
- rvm: ruby-head
89
- - gemfile: gemfiles/ar50.gemfile
90
- rvm: 2.0
91
- - gemfile: gemfiles/ar50.gemfile
92
- rvm: 2.1
93
- - gemfile: gemfiles/ar50.gemfile
94
- rvm: 2.2
95
- - gemfile: gemfiles/ar51.gemfile
96
- rvm: 2.0
97
- - gemfile: gemfiles/ar51.gemfile
98
- rvm: 2.1
99
- - gemfile: gemfiles/ar51.gemfile
100
- rvm: 2.2
101
- - gemfile: gemfiles/ar52.gemfile
102
- rvm: 2.0
103
- - gemfile: gemfiles/ar52.gemfile
104
- rvm: 2.1
105
- - gemfile: gemfiles/ar52.gemfile
106
- rvm: 2.2
107
- - gemfile: gemfiles/ar60.gemfile
108
- rvm: 2.0
109
- - gemfile: gemfiles/ar60.gemfile
110
- rvm: 2.1
111
- - gemfile: gemfiles/ar60.gemfile
112
- rvm: 2.2
113
- - gemfile: gemfiles/ar60.gemfile
114
- rvm: 2.3
115
- - gemfile: gemfiles/ar60.gemfile
116
- rvm: 2.4
117
- - gemfile: gemfiles/ar-head.gemfile
118
- rvm: 2.0
119
- - gemfile: gemfiles/ar-head.gemfile
120
- rvm: 2.1
121
- - gemfile: gemfiles/ar-head.gemfile
122
- rvm: 2.2
123
- - gemfile: gemfiles/ar-head.gemfile
124
- rvm: 2.3
125
- - gemfile: gemfiles/ar-head.gemfile
126
- rvm: 2.4
127
- allow_failures:
128
- - gemfile: gemfiles/ar-head.gemfile
129
- - rvm: ruby-head
130
- - rvm: jruby
131
- fast_finish: true
@@ -1,24 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in makara.gemspec
4
- gemspec :path => '../'
5
-
6
-
7
- gem 'rake'
8
- gem 'activerecord', :git => 'https://github.com/rails/rails'
9
- gem 'rspec'
10
- gem 'rack'
11
- gem 'timecop'
12
- gem 'mysql2', :platform => :ruby
13
- gem 'activerecord-jdbcmysql-adapter', :platform => :jruby
14
- gem 'pg', :platform => :ruby
15
- gem 'activerecord-jdbcpostgresql-adapter', :platform => :jruby
16
-
17
-
18
- rmajor, rminor, rpatch = RUBY_VERSION.split(/[^\d]/)[0..2].map(&:to_i)
19
-
20
- # 2.1 +
21
- if rmajor > 2 || (rmajor == 2 && rminor >= 1)
22
- gem 'activerecord-postgis-adapter', :platform => :ruby
23
- gem 'rgeo', :platform => :ruby
24
- end
@@ -1,36 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in makara.gemspec
4
- gemspec :path => '../'
5
-
6
-
7
- gem 'rake'
8
- gem 'activerecord', '3.0.17'
9
- gem 'rspec'
10
- gem 'rack', '1.6.0'
11
- gem 'i18n', '~> 0.5.0'
12
- gem 'mysql2', '0.2.11', :platform => :ruby
13
- gem 'activerecord-jdbcmysql-adapter', :platform => :jruby
14
- gem 'activerecord-jdbcpostgresql-adapter', :platform => :jruby
15
-
16
-
17
- rmajor, rminor, rpatch = RUBY_VERSION.split(/[^\d]/)[0..2].map(&:to_i)
18
-
19
- if rmajor == 1 && rminor == 8
20
- gem 'timecop', '0.5.9'
21
- else
22
- gem 'timecop'
23
- end
24
-
25
- # 1.8 - 1.9.2
26
- if rmajor == 1 && (rminor == 8 || (rminor == 9 && rpatch < 3))
27
- gem 'pg', '0.17.1', :platform => :ruby
28
- else
29
- gem 'pg', '0.21.0', :platform => :ruby
30
- end
31
-
32
- # 2.1 +
33
- if rmajor > 2 || (rmajor == 2 && rminor >= 1)
34
- gem 'activerecord-postgis-adapter', :platform => :ruby
35
- gem 'rgeo', :platform => :ruby
36
- end
@@ -1,36 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in makara.gemspec
4
- gemspec :path => '../'
5
-
6
-
7
- gem 'rake'
8
- gem 'activerecord', '3.1.8'
9
- gem 'rspec'
10
- gem 'rack', '1.6.0'
11
- gem 'i18n', '~> 0.6.0'
12
- gem 'mysql2', '~> 0.3.10', :platform => :ruby
13
- gem 'activerecord-jdbcmysql-adapter', :platform => :jruby
14
- gem 'activerecord-jdbcpostgresql-adapter', :platform => :jruby
15
-
16
-
17
- rmajor, rminor, rpatch = RUBY_VERSION.split(/[^\d]/)[0..2].map(&:to_i)
18
-
19
- if rmajor == 1 && rminor == 8
20
- gem 'timecop', '0.5.9'
21
- else
22
- gem 'timecop'
23
- end
24
-
25
- # 1.8 - 1.9.2
26
- if rmajor == 1 && (rminor == 8 || (rminor == 9 && rpatch < 3))
27
- gem 'pg', '0.17.1', :platform => :ruby
28
- else
29
- gem 'pg', '0.21.0', :platform => :ruby
30
- end
31
-
32
- # 2.1 +
33
- if rmajor > 2 || (rmajor == 2 && rminor >= 1)
34
- gem 'activerecord-postgis-adapter', :platform => :ruby
35
- gem 'rgeo', :platform => :ruby
36
- end