Skip to content

Commit

Permalink
[backport] RCBC-102 Fix inconsistent return of store functions
Browse files Browse the repository at this point in the history
The Bucket#set for example should return the object corresponding to
arguments passed:

  1.9.3p327 (main):002:0> conn.set("foo", "bar")
  851339802448297984
  1.9.3p327 (main):003:0> conn.set("foo" => "bar", "baz" => "foo")
  {"foo"=>2995536636664938496, "baz"=>16831440216388861952}

But when :observe option is used, it always return it like for
multi-set:

  1.9.3p327 (main):004:0> conn.set("foo", "bar", :observe => {:persisted => 1})
  {"foo"=>2559248876759744512}

Conflicts:
	ext/couchbase_ext/store.c

Change-Id: I86a1e3f04802e12830831d82045e06ee54092490
Reviewed-on: http://review.couchbase.org/23572
Reviewed-by: Matt Ingenthron <matt@couchbase.com>
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
  • Loading branch information
avsej committed Dec 28, 2012
1 parent cb91565 commit 84e2b34
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions RELEASE_NOTES.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ bugfixes. Do not forget to update this doc in every important patch.
* [major] RCBC-101 Persistence constraints wasn't passed to mutation
methods, so they haven't been applied properly.

* [major] RCBC-102 Inconsistent return values in case of storage
functions with persistence constraints. It always return a Hash like
in case of multi-set, even if there is only one document is being
set.

## 1.2.0 (2012-12-12)

30 files changed, 2079 insertions(+), 662 deletions(-)
Expand Down
2 changes: 1 addition & 1 deletion ext/couchbase_ext/store.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ cb_bucket_store(lcb_storage_t cmd, int argc, VALUE *argv, VALUE self)
}
if (RTEST(obs)) {
cb_gc_unprotect(bucket, obs);
return rb_funcall(bucket->self, cb_id_observe_and_wait, 2, rv, obs);
rv = rb_funcall(bucket->self, cb_id_observe_and_wait, 2, rv, obs);
}
if (params.cmd.store.num > 1) {
return rv; /* return as a hash {key => cas, ...} */
Expand Down

0 comments on commit 84e2b34

Please sign in to comment.