mogilefs-client 3.5.0 → 3.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/GIT-VERSION-GEN +1 -1
- data/lib/mogilefs/backend.rb +7 -2
- data/lib/mogilefs/mogilefs.rb +1 -1
- data/lib/mogilefs/mysql.rb +1 -1
- data/lib/mogilefs/version.rb +1 -1
- data/test/fresh.rb +6 -2
- data/test/test_fresh.rb +50 -0
- metadata +52 -66
data/GIT-VERSION-GEN
CHANGED
data/lib/mogilefs/backend.rb
CHANGED
@@ -138,12 +138,17 @@ class MogileFS::Backend
|
|
138
138
|
end
|
139
139
|
|
140
140
|
def dispatch_unlocked(request, timeout = @timeout) # :nodoc:
|
141
|
+
tries = nil
|
141
142
|
begin
|
142
143
|
io = socket
|
143
144
|
io.timed_write(request, timeout)
|
144
145
|
io
|
145
|
-
rescue SystemCallError, MogileFS::RequestTruncatedError
|
146
|
-
|
146
|
+
rescue SystemCallError, MogileFS::RequestTruncatedError => err
|
147
|
+
tries ||= Hash.new { |hash,host| hash[host] = 0 }
|
148
|
+
nr = tries[@active_host] += 1
|
149
|
+
if nr >= 2
|
150
|
+
@dead[@active_host] = [ Time.now, err ]
|
151
|
+
end
|
147
152
|
shutdown_unlocked
|
148
153
|
retry
|
149
154
|
end
|
data/lib/mogilefs/mogilefs.rb
CHANGED
@@ -205,7 +205,7 @@ class MogileFS::MogileFS < MogileFS::Client
|
|
205
205
|
if Hash === args[0]
|
206
206
|
args = args[0]
|
207
207
|
opts[:noverify] = args[:noverify]
|
208
|
-
|
208
|
+
zone = args[:zone] and opts[:zone] = zone
|
209
209
|
pathcount = args[:pathcount] and opts[:pathcount] = pathcount.to_i
|
210
210
|
end
|
211
211
|
|
data/lib/mogilefs/mysql.rb
CHANGED
@@ -82,7 +82,7 @@ class MogileFS::Mysql
|
|
82
82
|
# Get the paths for +key+.
|
83
83
|
def _get_paths(params = {})
|
84
84
|
zone = params[:zone]
|
85
|
-
noverify = (params[:noverify] == 1) # TODO this is unused atm
|
85
|
+
# noverify = (params[:noverify] == 1) # TODO this is unused atm
|
86
86
|
dmid = get_dmid(params[:domain])
|
87
87
|
devices = refresh_device or raise MogileFS::Backend::NoDevicesError
|
88
88
|
urls = []
|
data/lib/mogilefs/version.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
MogileFS::VERSION = '3.
|
1
|
+
MogileFS::VERSION = '3.6.0'
|
data/test/fresh.rb
CHANGED
@@ -39,8 +39,7 @@ EOF
|
|
39
39
|
|
40
40
|
@trackers = @hosts = [ "#@test_host:#@tracker_port" ]
|
41
41
|
@tracker.close
|
42
|
-
|
43
|
-
wait_for_port @tracker_port
|
42
|
+
start_tracker
|
44
43
|
@admin = MogileFS::Admin.new(:hosts => @hosts)
|
45
44
|
50.times do
|
46
45
|
break if File.size(@mogstored_pid.path) > 0
|
@@ -48,6 +47,11 @@ EOF
|
|
48
47
|
end
|
49
48
|
end
|
50
49
|
|
50
|
+
def start_tracker
|
51
|
+
x!("mogilefsd", "--daemon", "--config=#{@mogilefsd_conf.path}")
|
52
|
+
wait_for_port @tracker_port
|
53
|
+
end
|
54
|
+
|
51
55
|
def wait_for_port(port)
|
52
56
|
tries = 50
|
53
57
|
begin
|
data/test/test_fresh.rb
CHANGED
@@ -147,4 +147,54 @@ class TestMogFresh < Test::Unit::TestCase
|
|
147
147
|
end
|
148
148
|
src.close!
|
149
149
|
end
|
150
|
+
|
151
|
+
def test_new_file_copy_stream_known_length
|
152
|
+
add_host_device_domain
|
153
|
+
opts = { :content_length => 666 }
|
154
|
+
input = StringIO.new("short")
|
155
|
+
client = MogileFS::MogileFS.new :hosts => @hosts, :domain => @domain
|
156
|
+
assert_raises(MogileFS::SizeMismatchError) do
|
157
|
+
client.new_file("copy_stream", opts) do |io|
|
158
|
+
IO.copy_stream(input, io)
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
assert_raises(MogileFS::SizeMismatchError) do
|
163
|
+
client.new_file("copy_stream", opts) do |io|
|
164
|
+
IO.copy_stream(input, io, 666)
|
165
|
+
end
|
166
|
+
end
|
167
|
+
end if IO.respond_to?(:copy_stream)
|
168
|
+
|
169
|
+
def test_single_tracker_restart
|
170
|
+
add_host_device_domain
|
171
|
+
client = MogileFS::MogileFS.new :hosts => @hosts, :domain => @domain
|
172
|
+
|
173
|
+
data = "data"
|
174
|
+
client.store_content("key", "default", data)
|
175
|
+
listing = client.list_keys
|
176
|
+
assert_instance_of Array, listing
|
177
|
+
|
178
|
+
# restart the tracker
|
179
|
+
s = TCPSocket.new(@test_host, @tracker_port)
|
180
|
+
s.write "!shutdown\r\n"
|
181
|
+
s.flush # just in case, MRI (at least) syncs by default
|
182
|
+
assert_nil s.gets
|
183
|
+
|
184
|
+
start_tracker
|
185
|
+
|
186
|
+
# transparent retry
|
187
|
+
listing2 = client.list_keys
|
188
|
+
assert_instance_of Array, listing2
|
189
|
+
assert_equal listing, listing2
|
190
|
+
assert_equal([['key'], 'key'], listing)
|
191
|
+
|
192
|
+
# kill the tracker
|
193
|
+
s = TCPSocket.new(@test_host, @tracker_port)
|
194
|
+
s.write "!shutdown\r\n"
|
195
|
+
s.flush # just in case, MRI (at least) syncs by default
|
196
|
+
assert_nil s.gets
|
197
|
+
@mogilefsd_pid = nil
|
198
|
+
assert_raises(MogileFS::UnreachableBackendError) { client.list_keys }
|
199
|
+
end
|
150
200
|
end
|
metadata
CHANGED
@@ -1,66 +1,59 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: mogilefs-client
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 3.6.0
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 3
|
8
|
-
- 5
|
9
|
-
- 0
|
10
|
-
version: 3.5.0
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Eric Wong
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2013-02-21 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: rdoc
|
22
|
-
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
24
17
|
none: false
|
25
|
-
requirements:
|
18
|
+
requirements:
|
26
19
|
- - ~>
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
|
29
|
-
segments:
|
30
|
-
- 3
|
31
|
-
- 10
|
32
|
-
version: "3.10"
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '3.10'
|
33
22
|
type: :development
|
34
|
-
version_requirements: *id001
|
35
|
-
- !ruby/object:Gem::Dependency
|
36
|
-
name: hoe
|
37
23
|
prerelease: false
|
38
|
-
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '3.10'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: hoe
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
39
33
|
none: false
|
40
|
-
requirements:
|
34
|
+
requirements:
|
41
35
|
- - ~>
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
|
44
|
-
segments:
|
45
|
-
- 3
|
46
|
-
- 0
|
47
|
-
version: "3.0"
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '3.5'
|
48
38
|
type: :development
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '3.5'
|
46
|
+
description: ! '["A MogileFS client library for Ruby. MogileFS is an open source\ndistributed
|
47
|
+
filesystem, see: http://mogilefs.org for more details. This\nlibrary allows any
|
48
|
+
Ruby application to read, write and delete files in a\nMogileFS instance."]'
|
49
|
+
email:
|
56
50
|
- normalperson@yhbt.net
|
57
|
-
executables:
|
51
|
+
executables:
|
58
52
|
- mog
|
59
53
|
extensions: []
|
60
|
-
|
61
|
-
extra_rdoc_files:
|
54
|
+
extra_rdoc_files:
|
62
55
|
- Manifest.txt
|
63
|
-
files:
|
56
|
+
files:
|
64
57
|
- .document
|
65
58
|
- .gitignore
|
66
59
|
- .wrongdoc.yml
|
@@ -132,39 +125,31 @@ files:
|
|
132
125
|
- .gemtest
|
133
126
|
homepage: http://bogomips.org/mogilefs-client/
|
134
127
|
licenses: []
|
135
|
-
|
136
128
|
post_install_message:
|
137
|
-
rdoc_options:
|
129
|
+
rdoc_options:
|
138
130
|
- --main
|
139
131
|
- README
|
140
|
-
require_paths:
|
132
|
+
require_paths:
|
141
133
|
- lib
|
142
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
134
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
143
135
|
none: false
|
144
|
-
requirements:
|
145
|
-
- -
|
146
|
-
- !ruby/object:Gem::Version
|
147
|
-
|
148
|
-
|
149
|
-
- 0
|
150
|
-
version: "0"
|
151
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - ! '>='
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '0'
|
140
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
152
141
|
none: false
|
153
|
-
requirements:
|
154
|
-
- -
|
155
|
-
- !ruby/object:Gem::Version
|
156
|
-
|
157
|
-
segments:
|
158
|
-
- 0
|
159
|
-
version: "0"
|
142
|
+
requirements:
|
143
|
+
- - ! '>='
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
160
146
|
requirements: []
|
161
|
-
|
162
147
|
rubyforge_project: seattlerb
|
163
|
-
rubygems_version: 1.8.
|
148
|
+
rubygems_version: 1.8.23
|
164
149
|
signing_key:
|
165
150
|
specification_version: 3
|
166
151
|
summary: MogileFS client library for Ruby
|
167
|
-
test_files:
|
152
|
+
test_files:
|
168
153
|
- test/test_http_reader.rb
|
169
154
|
- test/test_mogilefs_integration_list_keys.rb
|
170
155
|
- test/test_db_backend.rb
|
@@ -182,3 +167,4 @@ test_files:
|
|
182
167
|
- test/test_bigfile.rb
|
183
168
|
- test/test_mogilefs_integration_large_pipe.rb
|
184
169
|
- test/test_mogstored_rack.rb
|
170
|
+
- test/socket_test.rb
|