switchman 1.5.13 → 2.0.9
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 +5 -5
- data/app/models/switchman/shard.rb +746 -11
- data/db/migrate/20130328212039_create_switchman_shards.rb +3 -1
- data/db/migrate/20130328224244_create_default_shard.rb +4 -2
- data/db/migrate/20161206323434_add_back_default_string_limits_switchman.rb +13 -0
- data/db/migrate/20180828183945_add_default_shard_index.rb +15 -0
- data/db/migrate/20180828192111_add_timestamps_to_shards.rb +17 -0
- data/db/migrate/20190114212900_add_unique_name_indexes.rb +9 -0
- data/lib/switchman/action_controller/caching.rb +2 -0
- data/lib/switchman/active_record/abstract_adapter.rb +14 -4
- data/lib/switchman/active_record/association.rb +64 -37
- data/lib/switchman/active_record/attribute_methods.rb +16 -5
- data/lib/switchman/active_record/base.rb +67 -22
- data/lib/switchman/active_record/batches.rb +3 -1
- data/lib/switchman/active_record/calculations.rb +16 -21
- data/lib/switchman/active_record/connection_handler.rb +71 -79
- data/lib/switchman/active_record/connection_pool.rb +28 -23
- data/lib/switchman/active_record/finder_methods.rb +37 -28
- data/lib/switchman/active_record/log_subscriber.rb +14 -19
- data/lib/switchman/active_record/migration.rb +80 -0
- data/lib/switchman/active_record/model_schema.rb +3 -1
- data/lib/switchman/active_record/persistence.rb +9 -1
- data/lib/switchman/active_record/postgresql_adapter.rb +166 -126
- data/lib/switchman/active_record/predicate_builder.rb +2 -0
- data/lib/switchman/active_record/query_cache.rb +22 -87
- data/lib/switchman/active_record/query_methods.rb +123 -124
- data/lib/switchman/active_record/reflection.rb +37 -20
- data/lib/switchman/active_record/relation.rb +50 -29
- data/lib/switchman/active_record/spawn_methods.rb +2 -0
- data/lib/switchman/active_record/statement_cache.rb +44 -52
- data/lib/switchman/active_record/table_definition.rb +4 -2
- data/lib/switchman/active_record/type_caster.rb +2 -0
- data/lib/switchman/active_record/where_clause_factory.rb +5 -2
- data/lib/switchman/active_support/cache.rb +18 -0
- data/lib/switchman/arel.rb +8 -25
- data/lib/switchman/call_super.rb +19 -0
- data/lib/switchman/connection_pool_proxy.rb +70 -24
- data/lib/switchman/database_server.rb +72 -60
- data/lib/switchman/default_shard.rb +3 -0
- data/lib/switchman/engine.rb +45 -40
- data/lib/switchman/environment.rb +2 -0
- data/lib/switchman/errors.rb +3 -0
- data/lib/switchman/{shackles → guard_rail}/relation.rb +7 -5
- data/lib/switchman/{shackles.rb → guard_rail.rb} +6 -4
- data/lib/switchman/open4.rb +80 -0
- data/lib/switchman/r_spec_helper.rb +14 -8
- data/lib/switchman/rails.rb +2 -0
- data/lib/switchman/schema_cache.rb +17 -0
- data/lib/switchman/sharded_instrumenter.rb +4 -2
- data/lib/switchman/standard_error.rb +14 -0
- data/lib/switchman/test_helper.rb +6 -3
- data/lib/switchman/version.rb +3 -1
- data/lib/switchman.rb +4 -2
- data/lib/tasks/switchman.rake +54 -68
- metadata +87 -40
- data/app/models/switchman/shard_internal.rb +0 -659
- data/lib/switchman/engine.rb~ +0 -203
|
@@ -1,11 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module Switchman
|
|
2
4
|
class SchemaCache < ::ActiveRecord::ConnectionAdapters::SchemaCache
|
|
3
5
|
delegate :connection, to: :pool
|
|
4
6
|
attr_reader :pool
|
|
5
7
|
|
|
8
|
+
SHARED_IVS = %i{@columns @columns_hash @primary_keys @data_sources @indexes}.freeze
|
|
9
|
+
|
|
6
10
|
def initialize(pool)
|
|
7
11
|
@pool = pool
|
|
8
12
|
super(nil)
|
|
9
13
|
end
|
|
14
|
+
|
|
15
|
+
def copy_values(other_cache)
|
|
16
|
+
SHARED_IVS.each do |iv|
|
|
17
|
+
instance_variable_get(iv).replace(other_cache.instance_variable_get(iv))
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def copy_references(other_cache)
|
|
22
|
+
# use the same cached values but still fall back to the correct pool
|
|
23
|
+
SHARED_IVS.each do |iv|
|
|
24
|
+
instance_variable_set(iv, other_cache.instance_variable_get(iv))
|
|
25
|
+
end
|
|
26
|
+
end
|
|
10
27
|
end
|
|
11
28
|
end
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module Switchman
|
|
2
4
|
class ShardedInstrumenter < ::SimpleDelegator
|
|
3
5
|
def initialize(instrumenter, shard_host)
|
|
@@ -6,7 +8,7 @@ module Switchman
|
|
|
6
8
|
end
|
|
7
9
|
|
|
8
10
|
def instrument(name, payload={})
|
|
9
|
-
shard = @shard_host
|
|
11
|
+
shard = @shard_host&.shard
|
|
10
12
|
# attribute_methods_generated? will be false during a reload -
|
|
11
13
|
# when we might be doing a query while defining attribute methods,
|
|
12
14
|
# so just avoid logging then
|
|
@@ -14,7 +16,7 @@ module Switchman
|
|
|
14
16
|
payload[:shard] = {
|
|
15
17
|
database_server_id: shard.database_server.id,
|
|
16
18
|
id: shard.id,
|
|
17
|
-
env: shard.database_server.
|
|
19
|
+
env: shard.database_server.guard_rail_environment
|
|
18
20
|
}
|
|
19
21
|
end
|
|
20
22
|
super name, payload
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Switchman
|
|
4
|
+
module StandardError
|
|
5
|
+
def initialize(*args)
|
|
6
|
+
@active_shards = Shard.send(:active_shards).dup
|
|
7
|
+
super
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def current_shard(category = :primary)
|
|
11
|
+
@active_shards&.[](category) || Shard.default
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module Switchman
|
|
2
4
|
module TestHelper
|
|
3
5
|
class << self
|
|
4
6
|
def recreate_persistent_test_shards(dont_create: false)
|
|
5
7
|
# recreate the default shard (it got buhleted)
|
|
6
|
-
|
|
8
|
+
::GuardRail.activate(:deploy) { Switchman.cache.clear }
|
|
9
|
+
if Shard.default(reload: true).is_a?(DefaultShard)
|
|
7
10
|
begin
|
|
8
11
|
Shard.create!(default: true)
|
|
9
12
|
rescue
|
|
@@ -11,7 +14,7 @@ module Switchman
|
|
|
11
14
|
# database doesn't exist yet, presumably cause we're creating it right now
|
|
12
15
|
return [nil, nil]
|
|
13
16
|
end
|
|
14
|
-
Shard.default(true)
|
|
17
|
+
Shard.default(reload: true)
|
|
15
18
|
end
|
|
16
19
|
|
|
17
20
|
# can't auto-create a new shard on the default shard's db server if the
|
|
@@ -21,7 +24,7 @@ module Switchman
|
|
|
21
24
|
else
|
|
22
25
|
server1 = Shard.default.database_server
|
|
23
26
|
end
|
|
24
|
-
server2 = DatabaseServer.create(Shard.default.database_server.config)
|
|
27
|
+
server2 = DatabaseServer.create(Shard.default.database_server.config.merge(server2: true))
|
|
25
28
|
|
|
26
29
|
if server1 == Shard.default.database_server && server1.config[:shard1] && server1.config[:shard2]
|
|
27
30
|
# look for the shards in the db already
|
data/lib/switchman/version.rb
CHANGED
data/lib/switchman.rb
CHANGED
data/lib/tasks/switchman.rake
CHANGED
|
@@ -20,13 +20,18 @@ module Switchman
|
|
|
20
20
|
open = servers.delete('open')
|
|
21
21
|
|
|
22
22
|
servers = servers.map { |server| DatabaseServer.find(server) }.compact
|
|
23
|
-
|
|
23
|
+
if open
|
|
24
|
+
open_servers = DatabaseServer.all.select { |server| server.config[:open] }
|
|
25
|
+
servers.concat(open_servers)
|
|
26
|
+
servers << DatabaseServer.find(nil) if open_servers.empty?
|
|
27
|
+
servers.uniq!
|
|
28
|
+
end
|
|
24
29
|
servers = DatabaseServer.all - servers if negative
|
|
25
30
|
end
|
|
26
31
|
|
|
27
32
|
servers = filter_database_servers_chain.call(servers)
|
|
28
33
|
|
|
29
|
-
scope = base_scope.order("database_server_id IS NOT NULL, database_server_id, id")
|
|
34
|
+
scope = base_scope.order(::Arel.sql("database_server_id IS NOT NULL, database_server_id, id"))
|
|
30
35
|
if servers != DatabaseServer.all
|
|
31
36
|
conditions = ["database_server_id IN (?)", servers.map(&:id)]
|
|
32
37
|
conditions.first << " OR database_server_id IS NULL" if servers.include?(Shard.default.database_server)
|
|
@@ -44,7 +49,11 @@ module Switchman
|
|
|
44
49
|
{ parallel: ENV['PARALLEL'].to_i, max_procs: ENV['MAX_PARALLEL_PROCS'] }
|
|
45
50
|
end
|
|
46
51
|
|
|
47
|
-
|
|
52
|
+
# categories - an array or proc, to activate as the current shard during the
|
|
53
|
+
# task. tasks which modify the schema may want to pass all categories in
|
|
54
|
+
# so that schema updates for non-default tables happen against all shards.
|
|
55
|
+
# this is handled automatically for the default migration tasks, below.
|
|
56
|
+
def self.shardify_task(task_name, categories: [:primary])
|
|
48
57
|
old_task = ::Rake::Task[task_name]
|
|
49
58
|
old_actions = old_task.actions.dup
|
|
50
59
|
old_task.actions.clear
|
|
@@ -55,22 +64,42 @@ module Switchman
|
|
|
55
64
|
TestHelper.recreate_persistent_test_shards(dont_create: true)
|
|
56
65
|
end
|
|
57
66
|
|
|
58
|
-
::
|
|
59
|
-
Shard.
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
67
|
+
::GuardRail.activate(:deploy) do
|
|
68
|
+
Shard.default.database_server.unguard do
|
|
69
|
+
begin
|
|
70
|
+
categories = categories.call if categories.respond_to?(:call)
|
|
71
|
+
Shard.with_each_shard(scope, categories, options) do
|
|
72
|
+
shard = Shard.current
|
|
73
|
+
puts "#{shard.id}: #{shard.description}"
|
|
74
|
+
::ActiveRecord::Base.connection_pool.spec.config[:shard_name] = Shard.current.name
|
|
75
|
+
if ::Rails.version < '6.0'
|
|
76
|
+
::ActiveRecord::Base.configurations[::Rails.env] = ::ActiveRecord::Base.connection_pool.spec.config.stringify_keys
|
|
77
|
+
else
|
|
78
|
+
# Adopted from the deprecated code that currently lives in rails proper
|
|
79
|
+
remaining_configs = ::ActiveRecord::Base.configurations.configurations.reject { |db_config| db_config.env_name == ::Rails.env }
|
|
80
|
+
new_config = ::ActiveRecord::DatabaseConfigurations.new(::Rails.env =>
|
|
81
|
+
::ActiveRecord::Base.connection_pool.spec.config.stringify_keys).configurations
|
|
82
|
+
new_configs = remaining_configs + new_config
|
|
83
|
+
|
|
84
|
+
::ActiveRecord::Base.configurations = new_configs
|
|
85
|
+
end
|
|
86
|
+
shard.database_server.unguard do
|
|
87
|
+
old_actions.each { |action| action.call(*task_args) }
|
|
88
|
+
end
|
|
89
|
+
nil
|
|
90
|
+
end
|
|
91
|
+
rescue => e
|
|
92
|
+
puts "Exception from #{e.current_shard.id}: #{e.current_shard.description}" if options[:parallel] != 0
|
|
93
|
+
raise
|
|
66
94
|
end
|
|
67
|
-
nil
|
|
68
95
|
end
|
|
69
96
|
end
|
|
70
97
|
end
|
|
71
98
|
end
|
|
72
99
|
|
|
73
|
-
%w{db:migrate db:migrate:up db:migrate:down db:rollback}.each
|
|
100
|
+
%w{db:migrate db:migrate:up db:migrate:down db:rollback}.each do |task_name|
|
|
101
|
+
shardify_task(task_name, categories: ->{ Shard.categories })
|
|
102
|
+
end
|
|
74
103
|
|
|
75
104
|
private
|
|
76
105
|
|
|
@@ -181,64 +210,21 @@ module Switchman
|
|
|
181
210
|
@filter_database_servers_chain ||= ->(servers) { servers }
|
|
182
211
|
end
|
|
183
212
|
end
|
|
184
|
-
end
|
|
185
213
|
|
|
186
|
-
module Switchman
|
|
187
214
|
module ActiveRecord
|
|
188
215
|
module PostgreSQLDatabaseTasks
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
end
|
|
202
|
-
|
|
203
|
-
command = "pg_dump -s -x -O -f #{Shellwords.escape(filename)} #{search_path} #{Shellwords.escape(configuration['database'])}"
|
|
204
|
-
raise 'Error dumping database' unless Kernel.system(command)
|
|
205
|
-
|
|
206
|
-
File.open(filename, "a") { |f| f << "SET search_path TO #{serialized_search_path};\n\n" }
|
|
207
|
-
end
|
|
208
|
-
else
|
|
209
|
-
def structure_dump(filename)
|
|
210
|
-
set_psql_env
|
|
211
|
-
args = ['-s', '-x', '-O', '-f', filename]
|
|
212
|
-
search_path = configuration['schema_search_path']
|
|
213
|
-
if configuration['use_qualified_names']
|
|
214
|
-
shard = Shard.current.name
|
|
215
|
-
serialized_search_path = shard
|
|
216
|
-
args << "--schema=#{Shellwords.escape(shard)}"
|
|
217
|
-
elsif !search_path.blank?
|
|
218
|
-
args << search_path.split(',').map do |part|
|
|
219
|
-
"--schema=#{part.strip}"
|
|
220
|
-
end.join(' ')
|
|
221
|
-
serialized_search_path = connection.schema_search_path
|
|
222
|
-
end
|
|
223
|
-
|
|
224
|
-
args << configuration['database']
|
|
225
|
-
run_cmd('pg_dump', args, 'dumping')
|
|
226
|
-
File.open(filename, "a") { |f| f << "SET search_path TO #{serialized_search_path};\n\n" }
|
|
227
|
-
end
|
|
228
|
-
|
|
229
|
-
if ::Rails.version < '4.2.5'
|
|
230
|
-
# These methods are backported from rails 4.2.5 to work with the above
|
|
231
|
-
def run_cmd(cmd, args, action)
|
|
232
|
-
fail run_cmd_error(cmd, args, action) unless Kernel.system(cmd, *args)
|
|
233
|
-
end
|
|
234
|
-
|
|
235
|
-
def run_cmd_error(cmd, args, action)
|
|
236
|
-
msg = "failed to execute:\n"
|
|
237
|
-
msg << "#{cmd} #{args.join(' ')}\n\n"
|
|
238
|
-
msg << "Please check the output above for any errors and make sure that `#{cmd}` is installed in your PATH and has proper permissions.\n\n"
|
|
239
|
-
msg
|
|
240
|
-
end
|
|
241
|
-
end
|
|
216
|
+
def structure_dump(filename, extra_flags=nil)
|
|
217
|
+
set_psql_env
|
|
218
|
+
args = ['-s', '-x', '-O', '-f', filename]
|
|
219
|
+
args.concat(Array(extra_flags)) if extra_flags
|
|
220
|
+
search_path = configuration['schema_search_path']
|
|
221
|
+
shard = Shard.current.name
|
|
222
|
+
serialized_search_path = shard
|
|
223
|
+
args << "--schema=#{Shellwords.escape(shard)}"
|
|
224
|
+
|
|
225
|
+
args << configuration['database']
|
|
226
|
+
run_cmd('pg_dump', args, 'dumping')
|
|
227
|
+
File.open(filename, "a") { |f| f << "SET search_path TO #{serialized_search_path};\n\n" }
|
|
242
228
|
end
|
|
243
229
|
end
|
|
244
230
|
end
|
metadata
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: switchman
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 2.0.9
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Cody Cutrer
|
|
8
8
|
- James Williams
|
|
9
9
|
- Jacob Fugal
|
|
10
|
-
autorequire:
|
|
10
|
+
autorequire:
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date:
|
|
13
|
+
date: 2021-04-16 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: railties
|
|
@@ -18,82 +18,110 @@ dependencies:
|
|
|
18
18
|
requirements:
|
|
19
19
|
- - ">="
|
|
20
20
|
- !ruby/object:Gem::Version
|
|
21
|
-
version: '
|
|
22
|
-
- - "
|
|
21
|
+
version: '5.1'
|
|
22
|
+
- - "<"
|
|
23
23
|
- !ruby/object:Gem::Version
|
|
24
|
-
version:
|
|
24
|
+
version: '6.1'
|
|
25
25
|
type: :runtime
|
|
26
26
|
prerelease: false
|
|
27
27
|
version_requirements: !ruby/object:Gem::Requirement
|
|
28
28
|
requirements:
|
|
29
29
|
- - ">="
|
|
30
30
|
- !ruby/object:Gem::Version
|
|
31
|
-
version: '
|
|
32
|
-
- - "
|
|
31
|
+
version: '5.1'
|
|
32
|
+
- - "<"
|
|
33
33
|
- !ruby/object:Gem::Version
|
|
34
|
-
version:
|
|
34
|
+
version: '6.1'
|
|
35
35
|
- !ruby/object:Gem::Dependency
|
|
36
36
|
name: activerecord
|
|
37
37
|
requirement: !ruby/object:Gem::Requirement
|
|
38
38
|
requirements:
|
|
39
39
|
- - ">="
|
|
40
40
|
- !ruby/object:Gem::Version
|
|
41
|
-
version: '
|
|
42
|
-
- - "
|
|
41
|
+
version: '5.1'
|
|
42
|
+
- - "<"
|
|
43
43
|
- !ruby/object:Gem::Version
|
|
44
|
-
version:
|
|
44
|
+
version: '6.1'
|
|
45
45
|
type: :runtime
|
|
46
46
|
prerelease: false
|
|
47
47
|
version_requirements: !ruby/object:Gem::Requirement
|
|
48
48
|
requirements:
|
|
49
49
|
- - ">="
|
|
50
50
|
- !ruby/object:Gem::Version
|
|
51
|
-
version: '
|
|
52
|
-
- - "
|
|
51
|
+
version: '5.1'
|
|
52
|
+
- - "<"
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
|
-
version:
|
|
54
|
+
version: '6.1'
|
|
55
55
|
- !ruby/object:Gem::Dependency
|
|
56
|
-
name:
|
|
56
|
+
name: guardrail
|
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
|
58
58
|
requirements:
|
|
59
59
|
- - "~>"
|
|
60
60
|
- !ruby/object:Gem::Version
|
|
61
|
-
version:
|
|
61
|
+
version: 2.0.0
|
|
62
62
|
type: :runtime
|
|
63
63
|
prerelease: false
|
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
|
65
65
|
requirements:
|
|
66
66
|
- - "~>"
|
|
67
67
|
- !ruby/object:Gem::Version
|
|
68
|
-
version:
|
|
68
|
+
version: 2.0.0
|
|
69
69
|
- !ruby/object:Gem::Dependency
|
|
70
70
|
name: open4
|
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
|
72
72
|
requirements:
|
|
73
|
-
- -
|
|
73
|
+
- - "~>"
|
|
74
74
|
- !ruby/object:Gem::Version
|
|
75
75
|
version: 1.3.0
|
|
76
76
|
type: :runtime
|
|
77
77
|
prerelease: false
|
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
|
79
79
|
requirements:
|
|
80
|
-
- -
|
|
80
|
+
- - "~>"
|
|
81
81
|
- !ruby/object:Gem::Version
|
|
82
82
|
version: 1.3.0
|
|
83
83
|
- !ruby/object:Gem::Dependency
|
|
84
|
-
name:
|
|
84
|
+
name: appraisal
|
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
|
86
86
|
requirements:
|
|
87
87
|
- - "~>"
|
|
88
88
|
- !ruby/object:Gem::Version
|
|
89
|
-
version: '
|
|
89
|
+
version: '2.1'
|
|
90
90
|
type: :development
|
|
91
91
|
prerelease: false
|
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
|
93
93
|
requirements:
|
|
94
94
|
- - "~>"
|
|
95
95
|
- !ruby/object:Gem::Version
|
|
96
|
-
version: '
|
|
96
|
+
version: '2.1'
|
|
97
|
+
- !ruby/object:Gem::Dependency
|
|
98
|
+
name: byebug
|
|
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
|
|
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'
|
|
97
125
|
- !ruby/object:Gem::Dependency
|
|
98
126
|
name: pg
|
|
99
127
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -114,42 +142,56 @@ dependencies:
|
|
|
114
142
|
requirements:
|
|
115
143
|
- - "~>"
|
|
116
144
|
- !ruby/object:Gem::Version
|
|
117
|
-
version: '3.
|
|
145
|
+
version: '3.5'
|
|
146
|
+
type: :development
|
|
147
|
+
prerelease: false
|
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
149
|
+
requirements:
|
|
150
|
+
- - "~>"
|
|
151
|
+
- !ruby/object:Gem::Version
|
|
152
|
+
version: '3.5'
|
|
153
|
+
- !ruby/object:Gem::Dependency
|
|
154
|
+
name: rspec-mocks
|
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
|
156
|
+
requirements:
|
|
157
|
+
- - "~>"
|
|
158
|
+
- !ruby/object:Gem::Version
|
|
159
|
+
version: '3.5'
|
|
118
160
|
type: :development
|
|
119
161
|
prerelease: false
|
|
120
162
|
version_requirements: !ruby/object:Gem::Requirement
|
|
121
163
|
requirements:
|
|
122
164
|
- - "~>"
|
|
123
165
|
- !ruby/object:Gem::Version
|
|
124
|
-
version: '3.
|
|
166
|
+
version: '3.5'
|
|
125
167
|
- !ruby/object:Gem::Dependency
|
|
126
|
-
name:
|
|
168
|
+
name: simplecov
|
|
127
169
|
requirement: !ruby/object:Gem::Requirement
|
|
128
170
|
requirements:
|
|
129
171
|
- - "~>"
|
|
130
172
|
- !ruby/object:Gem::Version
|
|
131
|
-
version: '
|
|
173
|
+
version: '0.15'
|
|
132
174
|
type: :development
|
|
133
175
|
prerelease: false
|
|
134
176
|
version_requirements: !ruby/object:Gem::Requirement
|
|
135
177
|
requirements:
|
|
136
178
|
- - "~>"
|
|
137
179
|
- !ruby/object:Gem::Version
|
|
138
|
-
version: '
|
|
180
|
+
version: '0.15'
|
|
139
181
|
- !ruby/object:Gem::Dependency
|
|
140
182
|
name: rake
|
|
141
183
|
requirement: !ruby/object:Gem::Requirement
|
|
142
184
|
requirements:
|
|
143
185
|
- - "~>"
|
|
144
186
|
- !ruby/object:Gem::Version
|
|
145
|
-
version: '
|
|
187
|
+
version: '12.0'
|
|
146
188
|
type: :development
|
|
147
189
|
prerelease: false
|
|
148
190
|
version_requirements: !ruby/object:Gem::Requirement
|
|
149
191
|
requirements:
|
|
150
192
|
- - "~>"
|
|
151
193
|
- !ruby/object:Gem::Version
|
|
152
|
-
version: '
|
|
194
|
+
version: '12.0'
|
|
153
195
|
description: Sharding
|
|
154
196
|
email:
|
|
155
197
|
- cody@instructure.com
|
|
@@ -159,9 +201,12 @@ extra_rdoc_files: []
|
|
|
159
201
|
files:
|
|
160
202
|
- Rakefile
|
|
161
203
|
- app/models/switchman/shard.rb
|
|
162
|
-
- app/models/switchman/shard_internal.rb
|
|
163
204
|
- db/migrate/20130328212039_create_switchman_shards.rb
|
|
164
205
|
- db/migrate/20130328224244_create_default_shard.rb
|
|
206
|
+
- db/migrate/20161206323434_add_back_default_string_limits_switchman.rb
|
|
207
|
+
- db/migrate/20180828183945_add_default_shard_index.rb
|
|
208
|
+
- db/migrate/20180828192111_add_timestamps_to_shards.rb
|
|
209
|
+
- db/migrate/20190114212900_add_unique_name_indexes.rb
|
|
165
210
|
- lib/switchman.rb
|
|
166
211
|
- lib/switchman/action_controller/caching.rb
|
|
167
212
|
- lib/switchman/active_record/abstract_adapter.rb
|
|
@@ -174,6 +219,7 @@ files:
|
|
|
174
219
|
- lib/switchman/active_record/connection_pool.rb
|
|
175
220
|
- lib/switchman/active_record/finder_methods.rb
|
|
176
221
|
- lib/switchman/active_record/log_subscriber.rb
|
|
222
|
+
- lib/switchman/active_record/migration.rb
|
|
177
223
|
- lib/switchman/active_record/model_schema.rb
|
|
178
224
|
- lib/switchman/active_record/persistence.rb
|
|
179
225
|
- lib/switchman/active_record/postgresql_adapter.rb
|
|
@@ -189,19 +235,21 @@ files:
|
|
|
189
235
|
- lib/switchman/active_record/where_clause_factory.rb
|
|
190
236
|
- lib/switchman/active_support/cache.rb
|
|
191
237
|
- lib/switchman/arel.rb
|
|
238
|
+
- lib/switchman/call_super.rb
|
|
192
239
|
- lib/switchman/connection_pool_proxy.rb
|
|
193
240
|
- lib/switchman/database_server.rb
|
|
194
241
|
- lib/switchman/default_shard.rb
|
|
195
242
|
- lib/switchman/engine.rb
|
|
196
|
-
- lib/switchman/engine.rb~
|
|
197
243
|
- lib/switchman/environment.rb
|
|
198
244
|
- lib/switchman/errors.rb
|
|
245
|
+
- lib/switchman/guard_rail.rb
|
|
246
|
+
- lib/switchman/guard_rail/relation.rb
|
|
247
|
+
- lib/switchman/open4.rb
|
|
199
248
|
- lib/switchman/r_spec_helper.rb
|
|
200
249
|
- lib/switchman/rails.rb
|
|
201
250
|
- lib/switchman/schema_cache.rb
|
|
202
|
-
- lib/switchman/shackles.rb
|
|
203
|
-
- lib/switchman/shackles/relation.rb
|
|
204
251
|
- lib/switchman/sharded_instrumenter.rb
|
|
252
|
+
- lib/switchman/standard_error.rb
|
|
205
253
|
- lib/switchman/test_helper.rb
|
|
206
254
|
- lib/switchman/version.rb
|
|
207
255
|
- lib/tasks/switchman.rake
|
|
@@ -209,7 +257,7 @@ homepage: http://www.instructure.com/
|
|
|
209
257
|
licenses:
|
|
210
258
|
- MIT
|
|
211
259
|
metadata: {}
|
|
212
|
-
post_install_message:
|
|
260
|
+
post_install_message:
|
|
213
261
|
rdoc_options: []
|
|
214
262
|
require_paths:
|
|
215
263
|
- lib
|
|
@@ -217,16 +265,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
217
265
|
requirements:
|
|
218
266
|
- - ">="
|
|
219
267
|
- !ruby/object:Gem::Version
|
|
220
|
-
version: '2.
|
|
268
|
+
version: '2.5'
|
|
221
269
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
222
270
|
requirements:
|
|
223
271
|
- - ">="
|
|
224
272
|
- !ruby/object:Gem::Version
|
|
225
273
|
version: '0'
|
|
226
274
|
requirements: []
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
signing_key:
|
|
275
|
+
rubygems_version: 3.2.15
|
|
276
|
+
signing_key:
|
|
230
277
|
specification_version: 4
|
|
231
|
-
summary: Rails
|
|
278
|
+
summary: Rails sharding magic
|
|
232
279
|
test_files: []
|