Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2i Requests over PBC block forever when 0 results match in 1.4.x #121

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ end

platforms :mri do
gem 'yajl-ruby'
gem 'debugger'
end

platforms :jruby do
Expand Down
18 changes: 18 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# Riak Ruby Client Release Notes

## 1.4.1 Patch/Bugfix Release - 2013-09-06

Release 1.4.1 fixes a few minor bugs and issues.

Issues:

* Test for object existence using head request, reported and fixed by
Elias "eliaslevy" Levy in https://github.com/basho/riak-ruby-client/pull/102

Bugfixes:

* License missing from gemspec, reported by Benjamin "bf4" Fleischer
in https://github.com/basho/riak-ruby-client/pull/108
* Debugger required by Gemfile, reported by Basho Giddyup
in https://github.com/basho/riak-ruby-client/pull/114
* Issue when reading Git-based version numbers, reported and fixed by
jacepp in https://github.com/basho/riak-ruby-client/pull/120

## 1.4.0 Feature Release - 2013-08-16

Release 1.4.0 adds support for Riak 1.4 and fixes a few bugs.
Expand Down
5 changes: 3 additions & 2 deletions lib/riak/bucket.rb
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,10 @@ def counter(key)
# @return [true, false] whether the key exists in this bucket
def exists?(key, options={})
begin
get(key, options)
get(key, options.merge({ :head => true }))
true
rescue Riak::FailedRequest
rescue Riak::FailedRequest => e
raise e unless e.not_found?
false
end
end
Expand Down
5 changes: 5 additions & 0 deletions lib/riak/client/beefcake_protobuffs_backend.rb
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,11 @@ def decode_index_response
code = MESSAGE_CODES[msgcode]
raise SocketError, "Expected IndexResp, got #{code}" unless code == :IndexResp

if msglen == 1
return if block_given?
return IndexCollection.new_from_protobuf(RpbIndexResp.decode(''))
end

message = RpbIndexResp.decode socket.read msglen - 1

if !block_given?
Expand Down
2 changes: 1 addition & 1 deletion lib/riak/client/feature_detection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def get_server_version
# @return [Gem::Version] the version of the Riak node to which
# this backend is connected
def server_version
@server_version ||= Gem::Version.new(get_server_version)
@server_version ||= Gem::Version.new(get_server_version.split("-").first)
end

# @return [true,false] whether MapReduce requests can be submitted without
Expand Down
3 changes: 2 additions & 1 deletion lib/riak/client/http_backend.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ def ping
# @return [RObject] the fetched object
def fetch_object(bucket, key, options={})
bucket = Bucket.new(client, bucket) if String === bucket
response = get([200,300], object_path(bucket.name, key, options))
method = options.delete(:head) ? :head : :get
response = send(method, [200,300], object_path(bucket.name, key, options))
load_object(RObject.new(bucket, key), response)
end

Expand Down
2 changes: 1 addition & 1 deletion lib/riak/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Riak
VERSION = "1.4.0"
VERSION = "1.4.1"
end
9 changes: 6 additions & 3 deletions spec/riak/beefcake_protobuffs_backend_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,17 +99,20 @@
results.should == %w{asdf asdg asdh}
end

it "should not crash out when no keys or terms are released" do
it "should not crash out when no keys or terms are returned" do
backend.should_receive(:write_protobuff) do |msg, req|
msg.should == :IndexReq
req[:stream].should_not be
end

response_message = Riak::Client::BeefcakeProtobuffsBackend::
RpbIndexResp.new().encode

header = [response_message.length + 1, 26].pack 'NC'
@socket.should_receive(:read).and_return(header, response_message)
@socket.
should_receive(:read).
with(5).
and_return(header)

results = nil
fetch = proc do
Expand Down