-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Without ifNotPresent key-value record will be updated even if it has the same value. For example if you have {"key":"a", "value":"42", "generationId":"001"} stored in the database and next generationId is 002, if you'll /put {"key":"a", "value":"42"}, new record {"key":"a", "value":"42", "generationId":"002"} will be created.
We need to add ifChanged option to read previous stored value and update it only if it was changed.
This option should read value from current generation, not from the next one. Else if we have value A and two requests one of which wants to write A, second one wants to write B, B is faster, writes B, responds with wasPut: true, then first one checks that there is B, writes A back and responds with wasPut: true too. Later we'll add CAS that will check value in the next generation.