ar-octopus 0.8.5 → 0.10.2

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.
Files changed (71) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +1 -0
  3. data/.travis.yml +6 -9
  4. data/Appraisals +8 -8
  5. data/README.mkdn +47 -15
  6. data/Rakefile +1 -0
  7. data/ar-octopus.gemspec +9 -12
  8. data/gemfiles/rails42.gemfile +2 -2
  9. data/gemfiles/{rails32.gemfile → rails5.gemfile} +2 -2
  10. data/gemfiles/{rails4.gemfile → rails51.gemfile} +2 -2
  11. data/gemfiles/{rails41.gemfile → rails52.gemfile} +2 -2
  12. data/lib/octopus/abstract_adapter.rb +4 -10
  13. data/lib/octopus/association.rb +1 -0
  14. data/lib/octopus/association_shard_tracking.rb +41 -71
  15. data/lib/octopus/collection_association.rb +9 -3
  16. data/lib/octopus/exception.rb +4 -0
  17. data/lib/octopus/finder_methods.rb +8 -0
  18. data/lib/octopus/load_balancing/round_robin.rb +2 -1
  19. data/lib/octopus/log_subscriber.rb +6 -2
  20. data/lib/octopus/migration.rb +123 -55
  21. data/lib/octopus/model.rb +42 -27
  22. data/lib/octopus/persistence.rb +33 -27
  23. data/lib/octopus/proxy.rb +147 -272
  24. data/lib/octopus/proxy_config.rb +251 -0
  25. data/lib/octopus/query_cache_for_shards.rb +24 -0
  26. data/lib/octopus/railtie.rb +0 -2
  27. data/lib/octopus/relation_proxy.rb +36 -1
  28. data/lib/octopus/result_patch.rb +19 -0
  29. data/lib/octopus/scope_proxy.rb +12 -5
  30. data/lib/octopus/shard_tracking.rb +8 -3
  31. data/lib/octopus/slave_group.rb +3 -3
  32. data/lib/octopus/version.rb +1 -1
  33. data/lib/octopus.rb +71 -18
  34. data/spec/config/shards.yml +12 -0
  35. data/spec/migrations/10_create_users_using_replication.rb +1 -1
  36. data/spec/migrations/11_add_field_in_all_slaves.rb +1 -1
  37. data/spec/migrations/12_create_users_using_block.rb +1 -1
  38. data/spec/migrations/13_create_users_using_block_and_using.rb +1 -1
  39. data/spec/migrations/14_create_users_on_shards_of_a_group_with_versions.rb +1 -1
  40. data/spec/migrations/15_create_user_on_shards_of_default_group_with_versions.rb +1 -1
  41. data/spec/migrations/1_create_users_on_master.rb +1 -1
  42. data/spec/migrations/2_create_users_on_canada.rb +1 -1
  43. data/spec/migrations/3_create_users_on_both_shards.rb +1 -1
  44. data/spec/migrations/4_create_users_on_shards_of_a_group.rb +1 -1
  45. data/spec/migrations/5_create_users_on_multiples_groups.rb +1 -1
  46. data/spec/migrations/6_raise_exception_with_invalid_shard_name.rb +1 -1
  47. data/spec/migrations/7_raise_exception_with_invalid_multiple_shard_names.rb +1 -1
  48. data/spec/migrations/8_raise_exception_with_invalid_group_name.rb +1 -1
  49. data/spec/migrations/9_raise_exception_with_multiple_invalid_group_names.rb +1 -1
  50. data/spec/octopus/association_shard_tracking_spec.rb +344 -16
  51. data/spec/octopus/load_balancing/round_robin_spec.rb +15 -0
  52. data/spec/octopus/log_subscriber_spec.rb +1 -1
  53. data/spec/octopus/migration_spec.rb +45 -11
  54. data/spec/octopus/model_spec.rb +204 -16
  55. data/spec/octopus/octopus_spec.rb +2 -2
  56. data/spec/octopus/proxy_spec.rb +44 -40
  57. data/spec/octopus/query_cache_for_shards_spec.rb +40 -0
  58. data/spec/octopus/relation_proxy_spec.rb +71 -23
  59. data/spec/octopus/replicated_slave_grouped_spec.rb +27 -0
  60. data/spec/octopus/replication_spec.rb +72 -2
  61. data/spec/octopus/scope_proxy_spec.rb +41 -7
  62. data/spec/spec_helper.rb +2 -0
  63. data/spec/support/database_connection.rb +1 -1
  64. data/spec/support/database_models.rb +1 -1
  65. data/spec/support/octopus_helper.rb +14 -6
  66. data/spec/tasks/octopus.rake_spec.rb +1 -1
  67. metadata +40 -30
  68. data/.ruby-version +0 -1
  69. data/init.rb +0 -1
  70. data/lib/octopus/has_and_belongs_to_many_association.rb +0 -9
  71. data/rails/init.rb +0 -1
@@ -61,4 +61,31 @@ describe 'when the database is replicated and has slave groups' do
61
61
  expect(Cat.count).to eq(2)
62
62
  end
63
63
  end
64
+
65
+ it 'should keep sending to slaves in a using block' do
66
+ OctopusHelper.using_environment :replicated_slave_grouped do
67
+ Cat.create!(:name => 'Thiago1')
68
+ Cat.create!(:name => 'Thiago2')
69
+
70
+ expect(Cat.count).to eq(2)
71
+ Octopus.using(:slave_group => :slaves1) do
72
+ expect(Cat.count).to eq(0)
73
+ expect(Cat.count).to eq(0)
74
+ end
75
+ end
76
+ end
77
+
78
+ it 'should restore previous slave group after a using block' do
79
+ OctopusHelper.using_environment :replicated_slave_grouped do
80
+ Cat.create!(:name => 'Thiago1')
81
+ Cat.create!(:name => 'Thiago2')
82
+
83
+ Octopus.using(:slave_group => :slaves1) do
84
+ Octopus.using(:slave_group => :slaves2) do
85
+ expect(Cat.count).to eq(2)
86
+ end
87
+ expect(Cat.count).to eq(0)
88
+ end
89
+ end
90
+ end
64
91
  end
@@ -1,6 +1,22 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe 'when the database is replicated' do
4
+ let(:slave_pool) do
5
+ ActiveRecord::Base.connection_proxy.shards['slave1']
6
+ end
7
+
8
+ let(:slave_connection) do
9
+ slave_pool.connection
10
+ end
11
+
12
+ let(:master_pool) do
13
+ ActiveRecord::Base.connection_proxy.shards['master']
14
+ end
15
+
16
+ let(:master_connection) do
17
+ master_pool.connection
18
+ end
19
+
4
20
  it 'should send all writes/reads queries to master when you have a non replicated model' do
5
21
  OctopusHelper.using_environment :production_replicated do
6
22
  u = User.create!(:name => 'Replicated')
@@ -26,10 +42,49 @@ describe 'when the database is replicated' do
26
42
  end
27
43
  end
28
44
 
45
+ context 'when updating model' do
46
+ it 'should send writes to master' do
47
+ OctopusHelper.using_environment :replicated_with_one_slave do
48
+ Cat.using(:slave1).create!(:name => 'Cat')
49
+ cat = Cat.find_by_name('Cat')
50
+ cat.name = 'New name'
51
+
52
+ expect(master_connection).to receive(:update).and_call_original
53
+
54
+ cat.save!
55
+ end
56
+ end
57
+ end
58
+
59
+ context 'when querying' do
60
+ it 'Reads from slave' do
61
+ OctopusHelper.using_environment :replicated_with_one_slave do
62
+ expect(master_connection).not_to receive(:select)
63
+
64
+ Cat.where(:name => 'Catman2').first
65
+ end
66
+ end
67
+ end
68
+
69
+ context 'When record is read from slave' do
70
+ it 'Should write associations to master' do
71
+ OctopusHelper.using_environment :replicated_with_one_slave do
72
+ client = Client.using(:slave1).create!(:name => 'Client')
73
+
74
+ client = Client.find(client.id)
75
+
76
+ expect(master_connection).to receive(:insert).and_call_original
77
+
78
+ client.items.create!(:name => 'Item')
79
+ end
80
+ end
81
+ end
82
+
83
+
29
84
  describe 'When enabling the query cache' do
30
85
  include_context 'with query cache enabled' do
31
86
  it 'should do the queries with cache' do
32
- OctopusHelper.using_environment :replicated_with_one_slave do
87
+ OctopusHelper.using_environment :replicated_with_one_slave do
33
88
  cat1 = Cat.using(:master).create!(:name => 'Master Cat 1')
34
89
  _ct2 = Cat.using(:master).create!(:name => 'Master Cat 2')
35
90
  expect(Cat.using(:master).find(cat1.id)).to eq(cat1)
@@ -42,7 +97,11 @@ describe 'when the database is replicated' do
42
97
  expect(Cat.find(cat3.id).id).to eq(cat3.id)
43
98
  expect(Cat.find(cat3.id).id).to eq(cat3.id)
44
99
 
45
- expect(counter.query_count).to eq(14)
100
+ # Rails 5.1 count the cached queries as regular queries.
101
+ # TODO: How we can verify if the queries are using cache on Rails 5.1? - @thiagopradi
102
+ expected_records = Octopus.rails51? || Octopus.rails52? ? 19 : 14
103
+
104
+ expect(counter.query_count).to eq(expected_records)
46
105
  end
47
106
  end
48
107
  end
@@ -123,4 +182,15 @@ describe 'when the database is replicated and the entire application is replicat
123
182
  expect(Cat.connection.current_shard).to eql(:master)
124
183
  end
125
184
  end
185
+
186
+ it 'should reset current shard if slave throws an exception with custom master' do
187
+ OctopusHelper.using_environment :production_fully_replicated do
188
+ Octopus.config[:master_shard] = :slave2
189
+ Cat.create!(:name => 'Slave Cat')
190
+ expect(Cat.connection.current_shard).to eql(:slave2)
191
+ Cat.where(:rubbish => true)
192
+ expect(Cat.connection.current_shard).to eql(:slave2)
193
+ Octopus.config[:master_shard] = nil
194
+ end
195
+ end
126
196
  end
@@ -46,18 +46,52 @@ describe Octopus::ScopeProxy do
46
46
  expect(@evan.select(%w(id name)).first.id).to be_a(Fixnum)
47
47
  end
48
48
 
49
- if Octopus.rails4?
50
- it 'allows multiple selection by symbol' do
51
- expect(@evan.select(:id, :name).first.id).to be_a(Fixnum)
52
- end
49
+ it 'allows multiple selection by symbol' do
50
+ expect(@evan.select(:id, :name).first.id).to be_a(Fixnum)
51
+ end
53
52
 
54
- it 'allows multiple selection by string and symbol' do
55
- expect(@evan.select(:id, 'name').first.id).to be_a(Fixnum)
56
- end
53
+ it 'allows multiple selection by string and symbol' do
54
+ expect(@evan.select(:id, 'name').first.id).to be_a(Fixnum)
57
55
  end
58
56
  end
59
57
 
60
58
  it "should raise a exception when trying to send a query to a shard that don't exists" do
61
59
  expect { User.using(:dont_exists).all }.to raise_exception('Nonexistent Shard Name: dont_exists')
62
60
  end
61
+
62
+ context "dup / clone" do
63
+ before(:each) do
64
+ User.using(:brazil).create!(:name => 'Thiago', :number => 1)
65
+ end
66
+
67
+ it "should change it's object id" do
68
+ user = User.using(:brazil).where(id: 1)
69
+ dupped_object = user.dup
70
+ cloned_object = user.clone
71
+
72
+ expect(dupped_object.object_id).not_to eq(user.object_id)
73
+ expect(cloned_object.object_id).not_to eq(user.object_id)
74
+ end
75
+ end
76
+
77
+ context 'When iterated with Enumerable methods' do
78
+ before(:each) do
79
+ User.using(:brazil).create!(:name => 'Evan', :number => 1)
80
+ User.using(:brazil).create!(:name => 'Evan', :number => 2)
81
+ User.using(:brazil).create!(:name => 'Evan', :number => 3)
82
+ @evans = User.using(:brazil).where(:name => 'Evan')
83
+ end
84
+
85
+ it 'allows each method' do
86
+ expect(@evans.each.count).to eq(3)
87
+ end
88
+
89
+ it 'allows each_with_index method' do
90
+ expect(@evans.each_with_index.to_a.flatten.count).to eq(6)
91
+ end
92
+
93
+ it 'allows map method' do
94
+ expect(@evans.map(&:number)).to eq([1, 2, 3])
95
+ end
96
+ end
63
97
  end
data/spec/spec_helper.rb CHANGED
@@ -5,6 +5,8 @@ require 'octopus'
5
5
 
6
6
  Octopus.instance_variable_set(:@directory, File.dirname(__FILE__))
7
7
 
8
+ BaseOctopusMigrationClass = (Octopus.rails4? ? ActiveRecord::Migration : ActiveRecord::Migration[ActiveRecord::VERSION::STRING[0..2]])
9
+
8
10
  # Requires supporting files with custom matchers and macros, etc,
9
11
  # in ./support/ and its subdirectories.
10
12
  Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
@@ -1,4 +1,4 @@
1
1
  require 'logger'
2
2
 
3
- ActiveRecord::Base.establish_connection(:adapter => 'mysql2', :database => 'octopus_shard_1', :username => 'root', :password => '')
3
+ ActiveRecord::Base.establish_connection(:adapter => 'mysql2', :database => 'octopus_shard_1', :username => "#{ENV['MYSQL_USER'] || 'root'}", :password => '')
4
4
  ActiveRecord::Base.logger = Logger.new(File.open('database.log', 'a'))
@@ -28,7 +28,7 @@ end
28
28
  # This class sets its own connection
29
29
  class CustomConnection < ActiveRecord::Base
30
30
  self.table_name = 'custom'
31
- octopus_establish_connection(:adapter => 'mysql2', :database => 'octopus_shard_2', :username => 'root', :password => '')
31
+ octopus_establish_connection(:adapter => 'mysql2', :database => 'octopus_shard_2', :username => "#{ENV['MYSQL_USER'] || 'root'}", :password => '')
32
32
  end
33
33
 
34
34
  # This items belongs to a client
@@ -1,19 +1,19 @@
1
1
  module OctopusHelper
2
2
  def self.clean_all_shards(shards)
3
3
  if shards.nil?
4
- shards = BlankModel.using(:master).connection.instance_variable_get(:@shards).keys
4
+ shards = BlankModel.using(:master).connection.shards.keys
5
5
  end
6
6
 
7
7
  shards.each do |shard_symbol|
8
8
  %w(schema_migrations users clients cats items keyboards computers permissions_roles roles permissions assignments projects programmers yummy adverts).each do |tables|
9
9
  BlankModel.using(shard_symbol).connection.execute("DELETE FROM #{tables}")
10
10
  end
11
-
12
11
  if shard_symbol == 'alone_shard'
13
12
  %w(mmorpg_players weapons skills).each do |table|
14
13
  BlankModel.using(shard_symbol).connection.execute("DELETE FROM #{table}")
15
14
  end
16
15
  end
16
+ BlankModel.using(:master).connection.shards[shard_symbol].disconnect if Octopus.atleast_rails50?
17
17
  end
18
18
  end
19
19
 
@@ -23,19 +23,27 @@ module OctopusHelper
23
23
  Thread.current['octopus.current_group'] = nil
24
24
  Thread.current['octopus.current_slave_group'] = nil
25
25
  Thread.current['octopus.block'] = nil
26
- Thread.current['octopus.last_current_shard'] = nil
27
26
 
28
27
  ActiveRecord::Base.class_variable_set(:@@connection_proxy, nil)
29
28
  end
30
29
 
31
30
  def self.migrating_to_version(version, &_block)
32
31
  migrations_root = File.expand_path(File.join(File.dirname(__FILE__), '..', 'migrations'))
33
-
32
+
34
33
  begin
35
- ActiveRecord::Migrator.run(:up, migrations_root, version)
34
+ migrate_to_version(:up, migrations_root, version)
36
35
  yield
37
36
  ensure
38
- ActiveRecord::Migrator.run(:down, migrations_root, version)
37
+ migrate_to_version(:down, migrations_root, version)
38
+ end
39
+ end
40
+
41
+ def self.migrate_to_version(direction, root, version)
42
+ if Octopus.atleast_rails52?
43
+ migrations = ActiveRecord::MigrationContext.new(root).migrations.select {|mig| version == mig.version }
44
+ ActiveRecord::Migrator.new(direction, migrations, version).run
45
+ else
46
+ ActiveRecord::Migrator.run(direction, root, version)
39
47
  end
40
48
  end
41
49
 
@@ -25,7 +25,7 @@ describe 'octopus.rake' do
25
25
  Rake::Task['octopus:copy_schema_versions'].invoke
26
26
 
27
27
  ActiveRecord::Base.connection.shard_names.each do |shard_name|
28
- expect(Octopus.using(shard_name) { ActiveRecord::Migrator.get_all_versions }).to eq([1, 2, 3])
28
+ expect(Octopus.using(shard_name) { ActiveRecord::SchemaMigration.all.pluck(:version).map(&:to_i).sort }).to eq([1, 2, 3])
29
29
  end
30
30
  end
31
31
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ar-octopus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.5
4
+ version: 0.10.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thiago Pradi
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-03-12 00:00:00.000000000 Z
13
+ date: 2019-03-11 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activerecord
@@ -18,28 +18,28 @@ dependencies:
18
18
  requirements:
19
19
  - - ">="
20
20
  - !ruby/object:Gem::Version
21
- version: 3.2.0
21
+ version: 4.2.0
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
26
  - - ">="
27
27
  - !ruby/object:Gem::Version
28
- version: 3.2.0
28
+ version: 4.2.0
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: activesupport
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
33
  - - ">="
34
34
  - !ruby/object:Gem::Version
35
- version: 3.2.0
35
+ version: 4.2.0
36
36
  type: :runtime
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
40
  - - ">="
41
41
  - !ruby/object:Gem::Version
42
- version: 3.2.0
42
+ version: 4.2.0
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: appraisal
45
45
  requirement: !ruby/object:Gem::Requirement
@@ -58,44 +58,50 @@ dependencies:
58
58
  name: mysql2
59
59
  requirement: !ruby/object:Gem::Requirement
60
60
  requirements:
61
- - - ">"
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: 0.3.18
64
+ - - "<"
62
65
  - !ruby/object:Gem::Version
63
- version: '0.3'
66
+ version: '0.5'
64
67
  type: :development
65
68
  prerelease: false
66
69
  version_requirements: !ruby/object:Gem::Requirement
67
70
  requirements:
68
- - - ">"
71
+ - - ">="
69
72
  - !ruby/object:Gem::Version
70
- version: '0.3'
73
+ version: 0.3.18
74
+ - - "<"
75
+ - !ruby/object:Gem::Version
76
+ version: '0.5'
71
77
  - !ruby/object:Gem::Dependency
72
78
  name: pg
73
79
  requirement: !ruby/object:Gem::Requirement
74
80
  requirements:
75
- - - ">="
81
+ - - "~>"
76
82
  - !ruby/object:Gem::Version
77
- version: 0.11.0
83
+ version: '0.18'
78
84
  type: :development
79
85
  prerelease: false
80
86
  version_requirements: !ruby/object:Gem::Requirement
81
87
  requirements:
82
- - - ">="
88
+ - - "~>"
83
89
  - !ruby/object:Gem::Version
84
- version: 0.11.0
90
+ version: '0.18'
85
91
  - !ruby/object:Gem::Dependency
86
92
  name: rake
87
93
  requirement: !ruby/object:Gem::Requirement
88
94
  requirements:
89
95
  - - ">="
90
96
  - !ruby/object:Gem::Version
91
- version: 0.8.7
97
+ version: '0'
92
98
  type: :development
93
99
  prerelease: false
94
100
  version_requirements: !ruby/object:Gem::Requirement
95
101
  requirements:
96
102
  - - ">="
97
103
  - !ruby/object:Gem::Version
98
- version: 0.8.7
104
+ version: '0'
99
105
  - !ruby/object:Gem::Dependency
100
106
  name: rspec
101
107
  requirement: !ruby/object:Gem::Requirement
@@ -128,16 +134,16 @@ dependencies:
128
134
  name: sqlite3
129
135
  requirement: !ruby/object:Gem::Requirement
130
136
  requirements:
131
- - - ">="
137
+ - - "~>"
132
138
  - !ruby/object:Gem::Version
133
- version: 1.3.4
139
+ version: 1.3.6
134
140
  type: :development
135
141
  prerelease: false
136
142
  version_requirements: !ruby/object:Gem::Requirement
137
143
  requirements:
138
- - - ">="
144
+ - - "~>"
139
145
  - !ruby/object:Gem::Version
140
- version: 1.3.4
146
+ version: 1.3.6
141
147
  - !ruby/object:Gem::Dependency
142
148
  name: pry-byebug
143
149
  requirement: !ruby/object:Gem::Requirement
@@ -167,7 +173,6 @@ files:
167
173
  - ".rspec"
168
174
  - ".rubocop.yml"
169
175
  - ".rubocop_todo.yml"
170
- - ".ruby-version"
171
176
  - ".travis.yml"
172
177
  - Appraisals
173
178
  - Gemfile
@@ -175,11 +180,10 @@ files:
175
180
  - Rakefile
176
181
  - TODO.txt
177
182
  - ar-octopus.gemspec
178
- - gemfiles/rails32.gemfile
179
- - gemfiles/rails4.gemfile
180
- - gemfiles/rails41.gemfile
181
183
  - gemfiles/rails42.gemfile
182
- - init.rb
184
+ - gemfiles/rails5.gemfile
185
+ - gemfiles/rails51.gemfile
186
+ - gemfiles/rails52.gemfile
183
187
  - lib/ar-octopus.rb
184
188
  - lib/octopus.rb
185
189
  - lib/octopus/abstract_adapter.rb
@@ -187,7 +191,8 @@ files:
187
191
  - lib/octopus/association_shard_tracking.rb
188
192
  - lib/octopus/collection_association.rb
189
193
  - lib/octopus/collection_proxy.rb
190
- - lib/octopus/has_and_belongs_to_many_association.rb
194
+ - lib/octopus/exception.rb
195
+ - lib/octopus/finder_methods.rb
191
196
  - lib/octopus/load_balancing.rb
192
197
  - lib/octopus/load_balancing/round_robin.rb
193
198
  - lib/octopus/log_subscriber.rb
@@ -195,8 +200,11 @@ files:
195
200
  - lib/octopus/model.rb
196
201
  - lib/octopus/persistence.rb
197
202
  - lib/octopus/proxy.rb
203
+ - lib/octopus/proxy_config.rb
204
+ - lib/octopus/query_cache_for_shards.rb
198
205
  - lib/octopus/railtie.rb
199
206
  - lib/octopus/relation_proxy.rb
207
+ - lib/octopus/result_patch.rb
200
208
  - lib/octopus/scope_proxy.rb
201
209
  - lib/octopus/shard_tracking.rb
202
210
  - lib/octopus/shard_tracking/attribute.rb
@@ -205,7 +213,6 @@ files:
205
213
  - lib/octopus/slave_group.rb
206
214
  - lib/octopus/version.rb
207
215
  - lib/tasks/octopus.rake
208
- - rails/init.rb
209
216
  - sample_app/.gitignore
210
217
  - sample_app/.rspec
211
218
  - sample_app/Gemfile
@@ -299,11 +306,13 @@ files:
299
306
  - spec/migrations/9_raise_exception_with_multiple_invalid_group_names.rb
300
307
  - spec/octopus/association_shard_tracking_spec.rb
301
308
  - spec/octopus/collection_proxy_spec.rb
309
+ - spec/octopus/load_balancing/round_robin_spec.rb
302
310
  - spec/octopus/log_subscriber_spec.rb
303
311
  - spec/octopus/migration_spec.rb
304
312
  - spec/octopus/model_spec.rb
305
313
  - spec/octopus/octopus_spec.rb
306
314
  - spec/octopus/proxy_spec.rb
315
+ - spec/octopus/query_cache_for_shards_spec.rb
307
316
  - spec/octopus/relation_proxy_spec.rb
308
317
  - spec/octopus/replicated_slave_grouped_spec.rb
309
318
  - spec/octopus/replication_spec.rb
@@ -334,15 +343,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
334
343
  requirements:
335
344
  - - ">="
336
345
  - !ruby/object:Gem::Version
337
- version: '0'
346
+ version: 2.2.0
338
347
  required_rubygems_version: !ruby/object:Gem::Requirement
339
348
  requirements:
340
349
  - - ">="
341
350
  - !ruby/object:Gem::Version
342
351
  version: '0'
343
352
  requirements: []
344
- rubyforge_project:
345
- rubygems_version: 2.4.4
353
+ rubygems_version: 3.0.1
346
354
  signing_key:
347
355
  specification_version: 4
348
356
  summary: Easy Database Sharding for ActiveRecord
@@ -365,11 +373,13 @@ test_files:
365
373
  - spec/migrations/9_raise_exception_with_multiple_invalid_group_names.rb
366
374
  - spec/octopus/association_shard_tracking_spec.rb
367
375
  - spec/octopus/collection_proxy_spec.rb
376
+ - spec/octopus/load_balancing/round_robin_spec.rb
368
377
  - spec/octopus/log_subscriber_spec.rb
369
378
  - spec/octopus/migration_spec.rb
370
379
  - spec/octopus/model_spec.rb
371
380
  - spec/octopus/octopus_spec.rb
372
381
  - spec/octopus/proxy_spec.rb
382
+ - spec/octopus/query_cache_for_shards_spec.rb
373
383
  - spec/octopus/relation_proxy_spec.rb
374
384
  - spec/octopus/replicated_slave_grouped_spec.rb
375
385
  - spec/octopus/replication_spec.rb
data/.ruby-version DELETED
@@ -1 +0,0 @@
1
- 2.1.5
data/init.rb DELETED
@@ -1 +0,0 @@
1
- require File.join(File.dirname(__FILE__), 'rails', 'init')
@@ -1,9 +0,0 @@
1
- module Octopus
2
- module HasAndBelongsToManyAssociation
3
- def self.included(base)
4
- base.sharded_methods :insert_record
5
- end
6
- end
7
- end
8
-
9
- ActiveRecord::Associations::HasAndBelongsToManyAssociation.send(:include, Octopus::HasAndBelongsToManyAssociation)
data/rails/init.rb DELETED
@@ -1 +0,0 @@
1
- require 'octopus'