basho / riak_kv

Riak Key/Value Store
Apache License 2.0
650 stars 233 forks source link

returnbody parameter is ignored when bucket type has a true 'write_once' property [JIRA: RIAK-2396] #1353

Open bashoshaun opened 8 years ago

bashoshaun commented 8 years ago

The body of an HTTP is not returned when inserting an object into a bucket with write_once enabled, even when the returnbody parameter is true. Example:

# ./riak-admin bucket-type create write_many
write_many created
./riak-admin bucket-type activate write_many
write_many has been activated
# ./riak-admin bucket-type create write_once '{"props": {"write_once": true}}'
write_once created
./riak-admin bucket-type activate write_once
write_once has been activated

# Insert an object with a random key into a regular bucket, see how the body is returned
curl -v http://localhost:10018/types/write_many/buckets/testbucket/keys?returnbody=true -H 'Content-Type: text/plain' -d 'test data'
* Hostname was NOT found in DNS cache
*   Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 10018 (#0)
> POST /types/write_many/buckets/testbucket/keys?returnbody=true HTTP/1.1
> User-Agent: curl/7.35.0
> Host: localhost:10018
> Accept: */*
> Content-Type: text/plain
> Content-Length: 9
> 
* upload completely sent off: 9 out of 9 bytes
< HTTP/1.1 201 Created
< X-Riak-Vclock: a85hYGBgzGDKBVI8R4M2cm/U2N4CEUpkzGNlSBSwusCXBQA=
< Vary: Accept-Encoding
* Server MochiWeb/1.1 WebMachine/1.10.8 (that head fake, tho) is not blacklisted
< Server: MochiWeb/1.1 WebMachine/1.10.8 (that head fake, tho)
< Location: /types/write_many/buckets/testbucket/keys/2FqZjhe9DmB8JABaHsj85co7XVl
< Link: </buckets/testbucket>; rel="up"
< Last-Modified: Thu, 18 Feb 2016 09:52:33 GMT
< ETag: "5VdMSgHPwZeLFoCeVSzyVq"
< Date: Thu, 18 Feb 2016 09:52:33 GMT
< Content-Type: text/plain
< Content-Length: 9
< 
* Connection #0 to host localhost left intact

# Insert a random key into a write_once bucket, where's the body now?
curl -v http://localhost:10018/types/write_once/buckets/testbucket/keys?returnbody=true -H 'Content-Type: text/plain' -d 'test data'
* Hostname was NOT found in DNS cache
*   Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 10018 (#0)
> POST /types/write_once/buckets/testbucket/keys?returnbody=true HTTP/1.1
> User-Agent: curl/7.35.0
> Host: localhost:10018
> Accept: */*
> Content-Type: text/plain
> Content-Length: 9
> 
* upload completely sent off: 9 out of 9 bytes
< HTTP/1.1 201 Created
< Vary: Accept-Encoding
* Server MochiWeb/1.1 WebMachine/1.10.8 (that head fake, tho) is not blacklisted
< Server: MochiWeb/1.1 WebMachine/1.10.8 (that head fake, tho)
< Location: /types/write_once/buckets/testbucket/keys/ZWjX0iaV7HfUJfHT5kSe5ymymlA
< Date: Thu, 18 Feb 2016 09:53:54 GMT
< Content-Type: text/plain
< Content-Length: 0
< 
* Connection #0 to host localhost left intact
Basho-JIRA commented 8 years ago

Can anyone confirm if this is intended? Should there be no returnbody option on write once buckets? I think this should be fairly easy/quick to confirm and then we can let the customer know and close the ticket.

Thanks, Dan

_[posted via JIRA by Dan Brown]_