switchman 3.3.1 → 4.1.0
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/Rakefile +15 -14
- data/db/migrate/20180828183945_add_default_shard_index.rb +1 -1
- data/db/migrate/20190114212900_add_unique_name_indexes.rb +10 -4
- data/lib/switchman/active_record/abstract_adapter.rb +5 -3
- data/lib/switchman/active_record/associations.rb +91 -51
- data/lib/switchman/active_record/attribute_methods.rb +88 -43
- data/lib/switchman/active_record/base.rb +113 -40
- data/lib/switchman/active_record/calculations.rb +98 -51
- data/lib/switchman/active_record/connection_handler.rb +18 -0
- data/lib/switchman/active_record/connection_pool.rb +56 -6
- data/lib/switchman/active_record/database_configurations.rb +37 -15
- data/lib/switchman/active_record/finder_methods.rb +47 -17
- data/lib/switchman/active_record/log_subscriber.rb +11 -5
- data/lib/switchman/active_record/migration.rb +51 -3
- data/lib/switchman/active_record/pending_migration_connection.rb +17 -0
- data/lib/switchman/active_record/persistence.rb +30 -0
- data/lib/switchman/active_record/postgresql_adapter.rb +37 -22
- data/lib/switchman/active_record/predicate_builder.rb +2 -2
- data/lib/switchman/active_record/query_cache.rb +57 -20
- data/lib/switchman/active_record/query_methods.rb +148 -44
- data/lib/switchman/active_record/reflection.rb +9 -2
- data/lib/switchman/active_record/relation.rb +79 -15
- data/lib/switchman/active_record/spawn_methods.rb +3 -7
- data/lib/switchman/active_record/statement_cache.rb +2 -2
- data/lib/switchman/active_record/table_definition.rb +1 -1
- data/lib/switchman/active_record/tasks/database_tasks.rb +6 -1
- data/lib/switchman/active_record/test_fixtures.rb +75 -25
- data/lib/switchman/active_support/cache.rb +9 -4
- data/lib/switchman/arel.rb +34 -18
- data/lib/switchman/call_super.rb +2 -8
- data/lib/switchman/database_server.rb +72 -34
- data/lib/switchman/default_shard.rb +14 -3
- data/lib/switchman/engine.rb +38 -22
- data/lib/switchman/environment.rb +2 -2
- data/lib/switchman/errors.rb +13 -0
- data/lib/switchman/guard_rail/relation.rb +1 -2
- data/lib/switchman/parallel.rb +6 -6
- data/lib/switchman/r_spec_helper.rb +12 -11
- data/lib/switchman/shard.rb +185 -71
- data/lib/switchman/sharded_instrumenter.rb +3 -3
- data/lib/switchman/shared_schema_cache.rb +11 -0
- data/lib/switchman/standard_error.rb +4 -0
- data/lib/switchman/test_helper.rb +3 -3
- data/lib/switchman/version.rb +1 -1
- data/lib/switchman.rb +27 -15
- data/lib/tasks/switchman.rake +96 -60
- metadata +50 -46
data/lib/switchman.rb
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require
|
|
4
|
-
require
|
|
3
|
+
require "guard_rail"
|
|
4
|
+
require "zeitwerk"
|
|
5
5
|
|
|
6
6
|
class SwitchmanInflector < Zeitwerk::GemInflector
|
|
7
7
|
def camelize(basename, abspath)
|
|
8
8
|
if basename =~ /\Apostgresql_(.*)/
|
|
9
|
-
|
|
9
|
+
"PostgreSQL" + super($1, abspath)
|
|
10
10
|
else
|
|
11
11
|
super
|
|
12
12
|
end
|
|
@@ -18,21 +18,33 @@ loader.inflector = SwitchmanInflector.new(__FILE__)
|
|
|
18
18
|
loader.setup
|
|
19
19
|
|
|
20
20
|
module Switchman
|
|
21
|
-
|
|
22
|
-
# TODO: load from yaml
|
|
23
|
-
@config ||= {}
|
|
24
|
-
end
|
|
21
|
+
Deprecation = ::ActiveSupport::Deprecation.new("4.0", "Switchman")
|
|
25
22
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
end
|
|
23
|
+
class << self
|
|
24
|
+
attr_writer :cache
|
|
29
25
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
26
|
+
def config
|
|
27
|
+
# TODO: load from yaml
|
|
28
|
+
@config ||= {}
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def cache
|
|
32
|
+
(@cache.respond_to?(:call) ? @cache.call : @cache) || ::Rails.cache
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def region
|
|
36
|
+
config[:region]
|
|
37
|
+
end
|
|
33
38
|
|
|
34
|
-
|
|
35
|
-
|
|
39
|
+
def foreign_key_check(name, type, limit: nil)
|
|
40
|
+
return unless name.to_s.end_with?("_id") && type.to_s == "integer" && limit.to_i < 8
|
|
41
|
+
|
|
42
|
+
puts <<~TEXT.squish
|
|
43
|
+
WARNING: All foreign keys need to be 8-byte integers.
|
|
44
|
+
#{name} looks like a foreign key.
|
|
45
|
+
If so, please add the option: `:limit => 8`
|
|
46
|
+
TEXT
|
|
47
|
+
end
|
|
36
48
|
end
|
|
37
49
|
|
|
38
50
|
class OrderOnMultiShardQuery < RuntimeError; end
|
data/lib/tasks/switchman.rake
CHANGED
|
@@ -1,40 +1,30 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# In rails 7.0+ if you have only 1 db in the env it doesn't try to do explicit activation
|
|
4
|
-
# (and for rails purposes we only have one db per env because each database server is a separate env)
|
|
5
|
-
if Rails.version < '7.0'
|
|
6
|
-
task_prefix = ::Rake::Task.task_defined?('app:db:migrate') ? 'app:db' : 'db'
|
|
7
|
-
::Rake::Task["#{task_prefix}:migrate"].clear_actions.enhance do
|
|
8
|
-
::ActiveRecord::Tasks::DatabaseTasks.migrate
|
|
9
|
-
# Ensure this doesn't blow up when running inside the dummy app
|
|
10
|
-
Rake::Task["#{task_prefix}:_dump"].invoke
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
|
|
14
3
|
module Switchman
|
|
15
4
|
module Rake
|
|
16
|
-
def self.filter_database_servers
|
|
17
|
-
|
|
18
|
-
|
|
5
|
+
def self.filter_database_servers
|
|
6
|
+
# use a local variable so that the current chain is closed over in the following lambda
|
|
7
|
+
chain = filter_database_servers_chain
|
|
8
|
+
@filter_database_servers_chain = ->(servers) { yield(servers, chain) }
|
|
19
9
|
end
|
|
20
10
|
|
|
21
11
|
def self.scope(base_scope = Shard,
|
|
22
|
-
database_server: ENV
|
|
23
|
-
shard: ENV
|
|
12
|
+
database_server: ENV.fetch("DATABASE_SERVER", nil),
|
|
13
|
+
shard: ENV.fetch("SHARD", nil))
|
|
24
14
|
servers = DatabaseServer.all
|
|
25
15
|
|
|
26
16
|
if database_server
|
|
27
17
|
servers = database_server
|
|
28
|
-
if servers.first ==
|
|
18
|
+
if servers.first == "-"
|
|
29
19
|
negative = true
|
|
30
20
|
servers = servers[1..]
|
|
31
21
|
end
|
|
32
|
-
servers = servers.split(
|
|
33
|
-
open = servers.delete(
|
|
22
|
+
servers = servers.split(",")
|
|
23
|
+
open = servers.delete("open")
|
|
34
24
|
|
|
35
|
-
servers = servers.
|
|
25
|
+
servers = servers.filter_map { |server| DatabaseServer.find(server) }
|
|
36
26
|
if open
|
|
37
|
-
open_servers = DatabaseServer.
|
|
27
|
+
open_servers = DatabaseServer.select { |server| server.config[:open] }
|
|
38
28
|
servers.concat(open_servers)
|
|
39
29
|
servers << DatabaseServer.find(nil) if open_servers.empty?
|
|
40
30
|
servers.uniq!
|
|
@@ -42,9 +32,22 @@ module Switchman
|
|
|
42
32
|
servers = DatabaseServer.all - servers if negative
|
|
43
33
|
end
|
|
44
34
|
|
|
35
|
+
ENV["REGION"]&.split(",")&.each do |region|
|
|
36
|
+
method = :select!
|
|
37
|
+
if region[0] == "-"
|
|
38
|
+
method = :reject!
|
|
39
|
+
region = region[1..]
|
|
40
|
+
end
|
|
41
|
+
if region == "self"
|
|
42
|
+
servers.send(method, &:in_current_region?)
|
|
43
|
+
else
|
|
44
|
+
servers.send(method) { |server| server.in_region?(region) }
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
45
48
|
servers = filter_database_servers_chain.call(servers)
|
|
46
49
|
|
|
47
|
-
scope = base_scope.order(::Arel.sql(
|
|
50
|
+
scope = base_scope.order(::Arel.sql("database_server_id IS NOT NULL, database_server_id, id"))
|
|
48
51
|
if servers != DatabaseServer.all
|
|
49
52
|
database_server_ids = servers.map(&:id)
|
|
50
53
|
database_server_ids << nil if servers.include?(Shard.default.database_server)
|
|
@@ -57,36 +60,81 @@ module Switchman
|
|
|
57
60
|
end
|
|
58
61
|
|
|
59
62
|
def self.options
|
|
60
|
-
{ parallel: ENV[
|
|
63
|
+
{ exception: (ENV["FAIL_FAST"] == "0") ? :defer : :raise, parallel: ENV["PARALLEL"].to_i }
|
|
61
64
|
end
|
|
62
65
|
|
|
63
66
|
# classes - an array or proc, to activate as the current shard during the
|
|
64
67
|
# task.
|
|
65
68
|
def self.shardify_task(task_name, classes: [::ActiveRecord::Base])
|
|
69
|
+
log_format = ENV.fetch("LOG_FORMAT", nil)
|
|
66
70
|
old_task = ::Rake::Task[task_name]
|
|
67
71
|
old_actions = old_task.actions.dup
|
|
68
72
|
old_task.actions.clear
|
|
69
73
|
|
|
70
74
|
old_task.enhance do |*task_args|
|
|
71
75
|
if ::Rails.env.test?
|
|
72
|
-
require
|
|
76
|
+
require "switchman/test_helper"
|
|
73
77
|
TestHelper.recreate_persistent_test_shards(dont_create: true)
|
|
74
78
|
end
|
|
75
79
|
|
|
76
80
|
::GuardRail.activate(:deploy) do
|
|
77
81
|
Shard.default.database_server.unguard do
|
|
78
82
|
classes = classes.call if classes.respond_to?(:call)
|
|
79
|
-
|
|
83
|
+
|
|
84
|
+
# We don't want the shard status messages to be wrapped using a custom log transfomer
|
|
85
|
+
original_stderr = $stderr
|
|
86
|
+
original_stdout = $stdout
|
|
87
|
+
output = if log_format == "json"
|
|
88
|
+
lambda { |msg|
|
|
89
|
+
JSON.dump(shard: Shard.current.id,
|
|
90
|
+
database_server: Shard.current.database_server.id,
|
|
91
|
+
type: "log",
|
|
92
|
+
message: msg)
|
|
93
|
+
}
|
|
94
|
+
else
|
|
95
|
+
nil
|
|
96
|
+
end
|
|
97
|
+
Shard.with_each_shard(scope, classes, output:, **options) do
|
|
80
98
|
shard = Shard.current
|
|
81
|
-
|
|
99
|
+
|
|
100
|
+
if log_format == "json"
|
|
101
|
+
original_stdout.puts JSON.dump(
|
|
102
|
+
shard: shard.id,
|
|
103
|
+
database_server: shard.database_server.id,
|
|
104
|
+
type: "started"
|
|
105
|
+
)
|
|
106
|
+
else
|
|
107
|
+
original_stdout.puts "#{shard.id}: #{shard.description}"
|
|
108
|
+
end
|
|
82
109
|
|
|
83
110
|
shard.database_server.unguard do
|
|
84
111
|
old_actions.each { |action| action.call(*task_args) }
|
|
85
112
|
end
|
|
113
|
+
|
|
114
|
+
if log_format == "json"
|
|
115
|
+
original_stdout.puts JSON.dump(
|
|
116
|
+
shard: shard.id,
|
|
117
|
+
database_server: shard.database_server.id,
|
|
118
|
+
type: "completed"
|
|
119
|
+
)
|
|
120
|
+
end
|
|
86
121
|
nil
|
|
122
|
+
rescue => e
|
|
123
|
+
if log_format == "json"
|
|
124
|
+
original_stderr.puts JSON.dump(
|
|
125
|
+
shard: shard.id,
|
|
126
|
+
database_server: shard.database_server.id,
|
|
127
|
+
type: "failed",
|
|
128
|
+
message: e.full_message
|
|
129
|
+
)
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
raise
|
|
87
133
|
end
|
|
88
134
|
rescue => e
|
|
89
|
-
|
|
135
|
+
if options[:parallel] != 0
|
|
136
|
+
warn "Exception from #{e.current_shard.id}: #{e.current_shard.description}:\n#{e.full_message}"
|
|
137
|
+
end
|
|
90
138
|
raise
|
|
91
139
|
end
|
|
92
140
|
end
|
|
@@ -98,7 +146,7 @@ module Switchman
|
|
|
98
146
|
end
|
|
99
147
|
|
|
100
148
|
def self.shard_scope(scope, raw_shard_ids)
|
|
101
|
-
raw_shard_ids = raw_shard_ids.split(
|
|
149
|
+
raw_shard_ids = raw_shard_ids.split(",")
|
|
102
150
|
|
|
103
151
|
shard_ids = []
|
|
104
152
|
negative_shard_ids = []
|
|
@@ -108,13 +156,13 @@ module Switchman
|
|
|
108
156
|
|
|
109
157
|
raw_shard_ids.each do |id|
|
|
110
158
|
case id
|
|
111
|
-
when
|
|
159
|
+
when "default"
|
|
112
160
|
shard_ids << Shard.default.id
|
|
113
|
-
when
|
|
161
|
+
when "-default"
|
|
114
162
|
negative_shard_ids << Shard.default.id
|
|
115
|
-
when
|
|
163
|
+
when "primary"
|
|
116
164
|
shard_ids.concat(Shard.primary.pluck(:id))
|
|
117
|
-
when
|
|
165
|
+
when "-primary"
|
|
118
166
|
negative_shard_ids.concat(Shard.primary.pluck(:id))
|
|
119
167
|
when /^(-?)(\d+)?\.\.(\.)?(\d+)?$/
|
|
120
168
|
negative, start, open, finish = $1.present?, $2, $3.present?, $4
|
|
@@ -122,8 +170,8 @@ module Switchman
|
|
|
122
170
|
|
|
123
171
|
range = []
|
|
124
172
|
range << "id>=#{start}" if start
|
|
125
|
-
range << "id<#{
|
|
126
|
-
(negative ? negative_ranges : ranges) << "(#{range.join(
|
|
173
|
+
range << "id<#{"=" unless open}#{finish}" if finish
|
|
174
|
+
(negative ? negative_ranges : ranges) << "(#{range.join(" AND ")})"
|
|
127
175
|
when /^-(\d+)$/
|
|
128
176
|
negative_shard_ids << $1.to_i
|
|
129
177
|
when /^\d+$/
|
|
@@ -151,21 +199,21 @@ module Switchman
|
|
|
151
199
|
select = []
|
|
152
200
|
if index != 1
|
|
153
201
|
subscope = subscope.offset(per_chunk * (index - 1))
|
|
154
|
-
select <<
|
|
202
|
+
select << "MIN(id) AS min_id"
|
|
155
203
|
end
|
|
156
204
|
if index != denominator
|
|
157
205
|
subscope = subscope.limit(per_chunk)
|
|
158
|
-
select <<
|
|
206
|
+
select << "MAX(id) AS max_id"
|
|
159
207
|
end
|
|
160
208
|
|
|
161
|
-
result = Shard.from(subscope).select(select.join(
|
|
209
|
+
result = Shard.from(subscope).select(select.join(", ")).to_a.first
|
|
162
210
|
range = case index
|
|
163
211
|
when 1
|
|
164
|
-
"id<=#{result[
|
|
212
|
+
"id<=#{result["max_id"]}"
|
|
165
213
|
when denominator
|
|
166
|
-
"id>=#{result[
|
|
214
|
+
"id>=#{result["min_id"]}"
|
|
167
215
|
else
|
|
168
|
-
"(id>=#{result[
|
|
216
|
+
"(id>=#{result["min_id"]} AND id<=#{result["max_id"]})"
|
|
169
217
|
end
|
|
170
218
|
|
|
171
219
|
(numerator.negative? ? negative_ranges : ranges) << range
|
|
@@ -186,16 +234,16 @@ module Switchman
|
|
|
186
234
|
|
|
187
235
|
conditions = []
|
|
188
236
|
positive_queries = []
|
|
189
|
-
positive_queries << ranges.join(
|
|
237
|
+
positive_queries << ranges.join(" OR ") unless ranges.empty?
|
|
190
238
|
unless shard_ids.empty?
|
|
191
|
-
positive_queries <<
|
|
239
|
+
positive_queries << "id IN (?)"
|
|
192
240
|
conditions << shard_ids
|
|
193
241
|
end
|
|
194
|
-
positive_query = positive_queries.join(
|
|
242
|
+
positive_query = positive_queries.join(" OR ")
|
|
195
243
|
scope = scope.where(positive_query, *conditions) unless positive_queries.empty?
|
|
196
244
|
|
|
197
|
-
scope = scope.where("NOT (#{negative_ranges.join(
|
|
198
|
-
scope = scope.where(
|
|
245
|
+
scope = scope.where("NOT (#{negative_ranges.join(" OR")})") unless negative_ranges.empty?
|
|
246
|
+
scope = scope.where("id NOT IN (?)", negative_shard_ids) unless negative_shard_ids.empty?
|
|
199
247
|
scope
|
|
200
248
|
end
|
|
201
249
|
|
|
@@ -206,21 +254,9 @@ module Switchman
|
|
|
206
254
|
|
|
207
255
|
module ActiveRecord
|
|
208
256
|
module PostgreSQLDatabaseTasks
|
|
209
|
-
def structure_dump(
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
args.concat(Array(extra_flags)) if extra_flags
|
|
213
|
-
shard = Shard.current.name
|
|
214
|
-
serialized_search_path = shard
|
|
215
|
-
args << "--schema=#{Shellwords.escape(shard)}"
|
|
216
|
-
|
|
217
|
-
ignore_tables = ::ActiveRecord::SchemaDumper.ignore_tables
|
|
218
|
-
args += ignore_tables.flat_map { |table| ['-T', table] } if ignore_tables.any?
|
|
219
|
-
|
|
220
|
-
args << db_config.database
|
|
221
|
-
run_cmd('pg_dump', args, 'dumping')
|
|
222
|
-
remove_sql_header_comments(filename)
|
|
223
|
-
File.open(filename, 'a') { |f| f << "SET search_path TO #{serialized_search_path};\n\n" }
|
|
257
|
+
def structure_dump(...)
|
|
258
|
+
::ActiveRecord.dump_schemas = Switchman::Shard.current.name
|
|
259
|
+
super
|
|
224
260
|
end
|
|
225
261
|
end
|
|
226
262
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: switchman
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 4.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Cody Cutrer
|
|
@@ -10,7 +10,7 @@ authors:
|
|
|
10
10
|
autorequire:
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date:
|
|
13
|
+
date: 2025-03-21 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: activerecord
|
|
@@ -18,20 +18,20 @@ dependencies:
|
|
|
18
18
|
requirements:
|
|
19
19
|
- - ">="
|
|
20
20
|
- !ruby/object:Gem::Version
|
|
21
|
-
version:
|
|
21
|
+
version: '7.0'
|
|
22
22
|
- - "<"
|
|
23
23
|
- !ruby/object:Gem::Version
|
|
24
|
-
version: '7.
|
|
24
|
+
version: '7.3'
|
|
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:
|
|
31
|
+
version: '7.0'
|
|
32
32
|
- - "<"
|
|
33
33
|
- !ruby/object:Gem::Version
|
|
34
|
-
version: '7.
|
|
34
|
+
version: '7.3'
|
|
35
35
|
- !ruby/object:Gem::Dependency
|
|
36
36
|
name: guardrail
|
|
37
37
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -66,160 +66,160 @@ dependencies:
|
|
|
66
66
|
requirements:
|
|
67
67
|
- - ">="
|
|
68
68
|
- !ruby/object:Gem::Version
|
|
69
|
-
version: '
|
|
69
|
+
version: '7.0'
|
|
70
70
|
- - "<"
|
|
71
71
|
- !ruby/object:Gem::Version
|
|
72
|
-
version: '7.
|
|
72
|
+
version: '7.3'
|
|
73
73
|
type: :runtime
|
|
74
74
|
prerelease: false
|
|
75
75
|
version_requirements: !ruby/object:Gem::Requirement
|
|
76
76
|
requirements:
|
|
77
77
|
- - ">="
|
|
78
78
|
- !ruby/object:Gem::Version
|
|
79
|
-
version: '
|
|
79
|
+
version: '7.0'
|
|
80
80
|
- - "<"
|
|
81
81
|
- !ruby/object:Gem::Version
|
|
82
|
-
version: '7.
|
|
82
|
+
version: '7.3'
|
|
83
83
|
- !ruby/object:Gem::Dependency
|
|
84
|
-
name:
|
|
84
|
+
name: debug
|
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
|
86
86
|
requirements:
|
|
87
87
|
- - "~>"
|
|
88
88
|
- !ruby/object:Gem::Version
|
|
89
|
-
version:
|
|
89
|
+
version: '1.8'
|
|
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: '1.8'
|
|
97
97
|
- !ruby/object:Gem::Dependency
|
|
98
|
-
name:
|
|
98
|
+
name: pg
|
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
|
100
100
|
requirements:
|
|
101
|
-
- - "
|
|
101
|
+
- - "~>"
|
|
102
102
|
- !ruby/object:Gem::Version
|
|
103
|
-
version: '
|
|
103
|
+
version: '1.2'
|
|
104
104
|
type: :development
|
|
105
105
|
prerelease: false
|
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
|
107
107
|
requirements:
|
|
108
|
-
- - "
|
|
108
|
+
- - "~>"
|
|
109
109
|
- !ruby/object:Gem::Version
|
|
110
|
-
version: '
|
|
110
|
+
version: '1.2'
|
|
111
111
|
- !ruby/object:Gem::Dependency
|
|
112
|
-
name:
|
|
112
|
+
name: rake
|
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
|
114
114
|
requirements:
|
|
115
115
|
- - "~>"
|
|
116
116
|
- !ruby/object:Gem::Version
|
|
117
|
-
version: '
|
|
117
|
+
version: '13.0'
|
|
118
118
|
type: :development
|
|
119
119
|
prerelease: false
|
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
|
121
121
|
requirements:
|
|
122
122
|
- - "~>"
|
|
123
123
|
- !ruby/object:Gem::Version
|
|
124
|
-
version: '
|
|
124
|
+
version: '13.0'
|
|
125
125
|
- !ruby/object:Gem::Dependency
|
|
126
|
-
name:
|
|
126
|
+
name: rspec-mocks
|
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
|
128
128
|
requirements:
|
|
129
|
-
- - "
|
|
129
|
+
- - "~>"
|
|
130
130
|
- !ruby/object:Gem::Version
|
|
131
|
-
version: '
|
|
131
|
+
version: '3.5'
|
|
132
132
|
type: :development
|
|
133
133
|
prerelease: false
|
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
|
135
135
|
requirements:
|
|
136
|
-
- - "
|
|
136
|
+
- - "~>"
|
|
137
137
|
- !ruby/object:Gem::Version
|
|
138
|
-
version: '
|
|
138
|
+
version: '3.5'
|
|
139
139
|
- !ruby/object:Gem::Dependency
|
|
140
|
-
name:
|
|
140
|
+
name: rspec-rails
|
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
|
142
142
|
requirements:
|
|
143
143
|
- - "~>"
|
|
144
144
|
- !ruby/object:Gem::Version
|
|
145
|
-
version: '
|
|
145
|
+
version: '6.0'
|
|
146
146
|
type: :development
|
|
147
147
|
prerelease: false
|
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
|
149
149
|
requirements:
|
|
150
150
|
- - "~>"
|
|
151
151
|
- !ruby/object:Gem::Version
|
|
152
|
-
version: '
|
|
152
|
+
version: '6.0'
|
|
153
153
|
- !ruby/object:Gem::Dependency
|
|
154
|
-
name:
|
|
154
|
+
name: rubocop
|
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
|
156
156
|
requirements:
|
|
157
157
|
- - "~>"
|
|
158
158
|
- !ruby/object:Gem::Version
|
|
159
|
-
version: '
|
|
159
|
+
version: '1.10'
|
|
160
160
|
type: :development
|
|
161
161
|
prerelease: false
|
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
|
163
163
|
requirements:
|
|
164
164
|
- - "~>"
|
|
165
165
|
- !ruby/object:Gem::Version
|
|
166
|
-
version: '
|
|
166
|
+
version: '1.10'
|
|
167
167
|
- !ruby/object:Gem::Dependency
|
|
168
|
-
name:
|
|
168
|
+
name: rubocop-inst
|
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
|
170
170
|
requirements:
|
|
171
171
|
- - "~>"
|
|
172
172
|
- !ruby/object:Gem::Version
|
|
173
|
-
version: '
|
|
173
|
+
version: '1'
|
|
174
174
|
type: :development
|
|
175
175
|
prerelease: false
|
|
176
176
|
version_requirements: !ruby/object:Gem::Requirement
|
|
177
177
|
requirements:
|
|
178
178
|
- - "~>"
|
|
179
179
|
- !ruby/object:Gem::Version
|
|
180
|
-
version: '
|
|
180
|
+
version: '1'
|
|
181
181
|
- !ruby/object:Gem::Dependency
|
|
182
|
-
name: rubocop
|
|
182
|
+
name: rubocop-rake
|
|
183
183
|
requirement: !ruby/object:Gem::Requirement
|
|
184
184
|
requirements:
|
|
185
185
|
- - "~>"
|
|
186
186
|
- !ruby/object:Gem::Version
|
|
187
|
-
version: '
|
|
187
|
+
version: '0.5'
|
|
188
188
|
type: :development
|
|
189
189
|
prerelease: false
|
|
190
190
|
version_requirements: !ruby/object:Gem::Requirement
|
|
191
191
|
requirements:
|
|
192
192
|
- - "~>"
|
|
193
193
|
- !ruby/object:Gem::Version
|
|
194
|
-
version: '
|
|
194
|
+
version: '0.5'
|
|
195
195
|
- !ruby/object:Gem::Dependency
|
|
196
|
-
name: rubocop-
|
|
196
|
+
name: rubocop-rspec
|
|
197
197
|
requirement: !ruby/object:Gem::Requirement
|
|
198
198
|
requirements:
|
|
199
199
|
- - "~>"
|
|
200
200
|
- !ruby/object:Gem::Version
|
|
201
|
-
version: '0
|
|
201
|
+
version: '3.0'
|
|
202
202
|
type: :development
|
|
203
203
|
prerelease: false
|
|
204
204
|
version_requirements: !ruby/object:Gem::Requirement
|
|
205
205
|
requirements:
|
|
206
206
|
- - "~>"
|
|
207
207
|
- !ruby/object:Gem::Version
|
|
208
|
-
version: '0
|
|
208
|
+
version: '3.0'
|
|
209
209
|
- !ruby/object:Gem::Dependency
|
|
210
|
-
name: rubocop-
|
|
210
|
+
name: rubocop-rspec_rails
|
|
211
211
|
requirement: !ruby/object:Gem::Requirement
|
|
212
212
|
requirements:
|
|
213
213
|
- - "~>"
|
|
214
214
|
- !ruby/object:Gem::Version
|
|
215
|
-
version: '2.
|
|
215
|
+
version: '2.29'
|
|
216
216
|
type: :development
|
|
217
217
|
prerelease: false
|
|
218
218
|
version_requirements: !ruby/object:Gem::Requirement
|
|
219
219
|
requirements:
|
|
220
220
|
- - "~>"
|
|
221
221
|
- !ruby/object:Gem::Version
|
|
222
|
-
version: '2.
|
|
222
|
+
version: '2.29'
|
|
223
223
|
- !ruby/object:Gem::Dependency
|
|
224
224
|
name: simplecov
|
|
225
225
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -255,6 +255,7 @@ files:
|
|
|
255
255
|
- lib/switchman/active_record/attribute_methods.rb
|
|
256
256
|
- lib/switchman/active_record/base.rb
|
|
257
257
|
- lib/switchman/active_record/calculations.rb
|
|
258
|
+
- lib/switchman/active_record/connection_handler.rb
|
|
258
259
|
- lib/switchman/active_record/connection_pool.rb
|
|
259
260
|
- lib/switchman/active_record/database_configurations.rb
|
|
260
261
|
- lib/switchman/active_record/database_configurations/database_config.rb
|
|
@@ -262,6 +263,7 @@ files:
|
|
|
262
263
|
- lib/switchman/active_record/log_subscriber.rb
|
|
263
264
|
- lib/switchman/active_record/migration.rb
|
|
264
265
|
- lib/switchman/active_record/model_schema.rb
|
|
266
|
+
- lib/switchman/active_record/pending_migration_connection.rb
|
|
265
267
|
- lib/switchman/active_record/persistence.rb
|
|
266
268
|
- lib/switchman/active_record/postgresql_adapter.rb
|
|
267
269
|
- lib/switchman/active_record/predicate_builder.rb
|
|
@@ -290,6 +292,7 @@ files:
|
|
|
290
292
|
- lib/switchman/rails.rb
|
|
291
293
|
- lib/switchman/shard.rb
|
|
292
294
|
- lib/switchman/sharded_instrumenter.rb
|
|
295
|
+
- lib/switchman/shared_schema_cache.rb
|
|
293
296
|
- lib/switchman/standard_error.rb
|
|
294
297
|
- lib/switchman/test_helper.rb
|
|
295
298
|
- lib/switchman/unsharded_record.rb
|
|
@@ -300,6 +303,7 @@ licenses:
|
|
|
300
303
|
- MIT
|
|
301
304
|
metadata:
|
|
302
305
|
rubygems_mfa_required: 'true'
|
|
306
|
+
source_code_uri: https://github.com/instructure/switchman
|
|
303
307
|
post_install_message:
|
|
304
308
|
rdoc_options: []
|
|
305
309
|
require_paths:
|
|
@@ -308,14 +312,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
308
312
|
requirements:
|
|
309
313
|
- - ">="
|
|
310
314
|
- !ruby/object:Gem::Version
|
|
311
|
-
version: '
|
|
315
|
+
version: '3.1'
|
|
312
316
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
313
317
|
requirements:
|
|
314
318
|
- - ">="
|
|
315
319
|
- !ruby/object:Gem::Version
|
|
316
320
|
version: '0'
|
|
317
321
|
requirements: []
|
|
318
|
-
rubygems_version: 3.3.
|
|
322
|
+
rubygems_version: 3.3.27
|
|
319
323
|
signing_key:
|
|
320
324
|
specification_version: 4
|
|
321
325
|
summary: Rails sharding magic
|