Jiak issue

Paul Rogers riak at dingosky.com
Thu Nov 12 10:39:01 EST 2009


I've run into what is either a Jiak bug or a bug in my expectation.  
I've outlined summary and detail steps to reproduce.


SUMMARY

Step 1
   Add data under full or wildcard schema
   e.g. JSON with fields f1, f2, and f3

Step 2
   Restrict write_mask
   e.g. Restrict write mask to just f1 and f3

Step 3
   Update previous data, sending only write_mask fields
   e.g. Update with only JSON fields f1 and f3

Issue
   Jiak exception due to write mask violation
   e.g. Error message notes f2 cannot be written, even though f2 was  
not in
   the JSON payload in the Step 3 update.

Note
   In Step 3, it is allowable to send new data with only the f1,f3  
fields, and
   even update that data. Only prior existing data causes the issue.


DETAIL

For brevity I'll only include the JSON payload of the HTTP traffic.

Step 1

--Request--
{"bucket":"b1","key":"v1","object": 
{"f1":"v1","f2":"v2","f3":"v3"},"links":[]}

--Response--
{"object": 
{"f1 
":"v1 
","f2 
":"v2 
","f3 
":"v3 
"},"vclock 
":"a85hYGBgzGDKBVIs7Bsj8zKYEhnzWBnMFxUc4csCAA==","lastmod":"Thu, 12  
Nov 2009 15:13:59  
GMT","vtag":"6FMjBBednEJjWUBrs7qzRK","bucket":"b1","key":"v1","links": 
[]}

Step 2

--Request--
{"schema":{"allowed_fields":["f1","f2","f3"],"required_fields": 
[],"read_mask":["f1","f2","f3"],"write_mask":["f1","f3"]}}

--Response--

Step 3

--Request--
{"bucket":"b1","key":"v1","object":{"f1":"v1","f3":"new v3"},"links": 
[],"vclock 
":"a85hYGBgzGDKBVIs7Bsj8zKYEhnzWBnMFxUc4csCAA 
==","vtag":"6FMjBBednEJjWUBrs7qzRK","lastmod":"Thu, 12 Nov 2009  
15:13:59 GMT"}

--Response--
Write disallowed, some of [<<"f2">>,<<"f3">>] not writable.

As noted above, only f1 and f3 were sent, not f2. Also as noted,  
sending new data with only f1 and f3 is permissible.

--Request--
{"bucket":"b1","key":"w1","object":{"f1":"w1","f3":"w3"},"links":[]}

--Response--
{"object":{"f1":"w1","f3":"w3"},"vclock":"a85hYGBgzGDKBVIszC/ 
PG2cwJTLmsTJwLCk4wpcFAA==","lastmod":"Thu, 12 Nov 2009 15:21:44  
GMT","vtag":"ogFj6mklTCV83pdBgAVqD","bucket":"b1","key":"w1","links":[]}

And even updating this newly added data is permissible.

--Request--
{"bucket":"b1","key":"w1","object":{"f1":"w1","f3":"new w3"},"links": 
[],"vclock":"a85hYGBgzGDKBVIszC\/ 
PG2cwJTLmsTJwLCk4wpcFAA 
==","vtag":"ogFj6mklTCV83pdBgAVqD","lastmod":"Thu, 12 Nov 2009  
15:21:44 GMT"}

--Response--
{"object":{"f1":"w1","f3":"new  
w3 
"},"vclock 
":"a85hYGBgymDKBVIsTOe5 
+TKYEhnzWBmClhQc4YMKM788bwwV5gAJZwEA","lastmod":"Thu, 12 Nov 2009  
15:22:58  
GMT","vtag":"7Ul5CCaRkEwp9q5knvj2NW","bucket":"b1","key":"w1","links": 
[]}


Looks to me that somewhere in either Jiak or Riak the f2 field of the  
existing data is being read and written and that's being flagged as a  
write_mask violation.

-Paul






More information about the riak-users mailing list