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

Attempt via HTTP API to disable existing flag in map without providing context shall be discarded [JIRA: DOC-768] #2344

Open
lucafavatella opened this issue Dec 20, 2016 · 0 comments

Comments

@lucafavatella
Copy link
Contributor

(I am currently in the design phase of a project hence I looked into this and opened ticket for tracking.)

Expected result

From https://github.com/basho/basho_docs/blob/e6550cb629a2abfb4dfac156d6e68d6236d6ae06/content/riak/kv/2.2.0/developing/data-types/maps.md#flags :

To disable an existing flag, you have to read it or provide a context.

Also, first the non-merged PR https://github.com/basho/basho_docs/pull/1550/files#diff-b79a647609dd35cb310d1d7cddf7a12aR1005 and then the recently merged PR https://github.com/basho/basho_docs/pull/2315/files#diff-3eef66dba92a758b737a0b505eea4645R449 proposed update of HTTP example along this line.

Actual result on HTTP

Via HTTP API on Riak KV 2.2.0:

  • I created (without context) a CRDT initializing flag in map specifying operation "enable";
  • I checked flag was true;
  • I waited 5 seconds (just to be sure... but should not matter);
  • Then without context I updated flag in map specifying operation "disable";
  • I checked flag was false. <-- This is wrong according to the documentation.

Actual result on PB

Via PB API (riakc), a disable operation for a flag in a map cannot be encoded without context.

Considerations

I understand that the recommended API is PB. That said, I would expect the presence of the context in any disable operation of a flag in a map to be validated also server side by Riak KV, rather than performing an unsafe choice somewhere in Riak KV (at least when called via HTTP). This would make all Riak KV clients, both PB and HTTP based, more robust.

I understand the relevant CRDT is https://github.com/basho/riak_dt/blob/f96f943ca66902e12263a445cf9099d7f635d5ab/src/riak_dt_od_flag.erl#L3-L4 (not sure about the version/changeset of such CRDT in Riak KV 2.2.0).

@Basho-JIRA Basho-JIRA changed the title Attempt via HTTP API to disable existing flag in map without providing context shall be discarded Attempt via HTTP API to disable existing flag in map without providing context shall be discarded [JIRA: DOC-768] Dec 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants