ar_mysql_flexmaster 0.1.1 → 0.1.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.
data/ar_mysql_flexmaster.gemspec
CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |gem|
|
|
12
12
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
13
13
|
gem.name = "ar_mysql_flexmaster"
|
14
14
|
gem.require_paths = ["lib"]
|
15
|
-
gem.version = "0.1.
|
15
|
+
gem.version = "0.1.2"
|
16
16
|
|
17
17
|
gem.add_runtime_dependency("mysql2")
|
18
18
|
gem.add_runtime_dependency("activerecord")
|
@@ -76,7 +76,6 @@ module ActiveRecord
|
|
76
76
|
cx = find_correct_host
|
77
77
|
if cx
|
78
78
|
@connection = cx
|
79
|
-
flush_column_information
|
80
79
|
return
|
81
80
|
end
|
82
81
|
sleep(sleep_interval)
|
@@ -127,17 +126,6 @@ module ActiveRecord
|
|
127
126
|
end
|
128
127
|
end
|
129
128
|
|
130
|
-
def flush_column_information
|
131
|
-
if ActiveRecord::Base.respond_to?(:descendants)
|
132
|
-
klass_list = ActiveRecord::Base.descendants
|
133
|
-
else
|
134
|
-
klass_list = ActiveRecord::Base.send(:subclasses)
|
135
|
-
end
|
136
|
-
klass_list.each do |k|
|
137
|
-
k.reset_column_information
|
138
|
-
end
|
139
|
-
end
|
140
|
-
|
141
129
|
def cx_correct?(cx = @connection)
|
142
130
|
res = cx.query("SELECT @@read_only as ro").first
|
143
131
|
|
data/test/ar_flexmaster_test.rb
CHANGED
@@ -116,24 +116,6 @@ class TestArFlexmaster < Test::Unit::TestCase
|
|
116
116
|
assert !main_connection_is_master?
|
117
117
|
end
|
118
118
|
|
119
|
-
def test_altering_on_the_slave
|
120
|
-
User.create!(:name => "foo")
|
121
|
-
$mysql_slave.connection.query("ALTER TABLE flexmaster_test.users add column xtra int(10)")
|
122
|
-
assert !User.column_names.include?("xtra")
|
123
|
-
$mysql_master.set_rw(false)
|
124
|
-
$mysql_slave.set_rw(true)
|
125
|
-
|
126
|
-
# pick up the new connection and column info
|
127
|
-
User.create!(:name => "foo")
|
128
|
-
|
129
|
-
# now we should be able to use it.
|
130
|
-
assert User.create!(:name => "foobar", :xtra => 5)
|
131
|
-
|
132
|
-
# teardown
|
133
|
-
$mysql_slave.connection.query("ALTER TABLE flexmaster_test.users drop column xtra")
|
134
|
-
User.reset_column_information
|
135
|
-
end
|
136
|
-
|
137
119
|
def test_should_choose_a_random_slave_connection
|
138
120
|
h = {}
|
139
121
|
10.times do
|
data/test/boot_mysql_env.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ar_mysql_flexmaster
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-02-
|
12
|
+
date: 2013-02-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: mysql2
|
@@ -141,7 +141,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
141
141
|
version: '0'
|
142
142
|
segments:
|
143
143
|
- 0
|
144
|
-
hash: -
|
144
|
+
hash: -2651405727941520708
|
145
145
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
146
146
|
none: false
|
147
147
|
requirements:
|
@@ -150,7 +150,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
150
150
|
version: '0'
|
151
151
|
segments:
|
152
152
|
- 0
|
153
|
-
hash: -
|
153
|
+
hash: -2651405727941520708
|
154
154
|
requirements: []
|
155
155
|
rubyforge_project:
|
156
156
|
rubygems_version: 1.8.24
|