byzhang / terrastore

Automatically exported from code.google.com/p/terrastore
Other
0 stars 0 forks source link

Update Merge Function Terrastore 0.8.1 #174

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hello, im using Terrastore to cache our Database and sessions on EC2.

maybe I'm too ... but my update-merge function will only work with version 
0.8.0.

With the new 0.8.1 version its not working anymore...

Im just doing a simple add merge.

fields/values to add: 
{"test" : "test2","test3" : "test4"}
 or
{"+":{"test" : "test2","test3" : "test4"}}

it does not work, but with version >0.8.0 its all fine.

Plz, can someone help me.

Thanks a lot.

Original issue reported on code.google.com by schultem...@gmail.com on 4 Apr 2011 at 9:54

GoogleCodeExporter commented 9 years ago
Hi,

The old merge update function has been replaced in Terrastore 0.8.1 by the 
merge operation described here: 
http://code.google.com/p/terrastore/wiki/Developers_Guide#Merge_update

So, are you referring to the old (0.8.0 and before) merge update, or the new 
one (0.8.1 and above)?

Original comment by sergio.b...@gmail.com on 5 Apr 2011 at 5:24

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Sorry, 

it does not work, but with version >0.8.0 its all fine.
should be 
it does not work, but with version <0.8.1 its all fine.

We are using version 0.8.0, but we want to switch to 0.8.1. I cant find any 
differences in the merge docs and i dont know why its not working with version 
0.8.1. What has been changed between 0.8.0 and 0.8.1 ?

We used this syntax in 0.8.0:
POST /myBucket/myKey/update?function=merge&timeout=10000
{"value2" : "merged"}

And it should be the same within 0.8.1. 

But it does not work. Just 400 Responses....

Original comment by schultem...@gmail.com on 5 Apr 2011 at 6:21

GoogleCodeExporter commented 9 years ago
Sorry, docs are probably not that good in such a regard.

Starting from version 0.8.1, merging has been improved and has now a new HTTP 
path and syntax.
Here's how your example would look like (provided you want to merge/add a new 
key/value):

POST /myBucket/myKey/merge
{"+" : {"value2" : "merged"}}

If you want to replace "value2", just do the following:
POST /myBucket/myKey/merge
{"*" : {"value2" : "merged"}}

Original comment by sergio.b...@gmail.com on 5 Apr 2011 at 7:04

GoogleCodeExporter commented 9 years ago
Got it. Thanks for your help.
I tried it and our merge usage works again with the newest version.

But one last thing....

Wouldn't it be useful to combine the + and * fields and/to create another one.
Something like "+*" ....
The "+*" field contains an object with fields/values to add OR to 
replace/update an existing one

Right now, you have to know the value of your bucket/key to select the right 
field (+ or *), or you have to make a "GET" first, check for exists, select the 
right field. Up to 3 steps for a single merge...

But what if just want to take care that my bucket/key got another OR updated 
value....regardless if it exist or not.

Original comment by schultem...@gmail.com on 5 Apr 2011 at 10:42

GoogleCodeExporter commented 9 years ago
Thanks for your feedback: do you mind opening a new issue about your 
improvement request?

Original comment by sergio.b...@gmail.com on 26 Apr 2011 at 9:50