How to design Riak database (eleveldb backend) avoiding write conflicts?
To make Riak-based database design properly, I need to know, which
operations can be safely done simultaniously, and which can not without
special precautions.
I know for sure values with different keys must be independent (in a
sense, that no conflict resolution is needed, or, if the latest write
overwrite previous one, latest is always choosen).
On the other hand, one can't change part of the value, so in this case
there always be a conflict (whether automatically resolved or with a need
to be resolved).
But what about other situations? For example,
if (differently tagged) links are added to the object, will it require
resolution?
Will the secondary index on the same object cause concurrency problems?
Two different indices?
Same for the text search?
What about metadata?
As an example, consider two processes are actively working with the same
entity, storing/reading different (meta)data from the same object. Is it
better to make one object per process and then one "master" object, which
will link to those (and back) to prevent conflicts? That is, represent the
entity with more than one key/value, so writers can work without
conflicts?
Yet again, eventual read consistency is not a problem. What I do not want
to loose is that one process overwrites something it has not even changed,
because another process was quick enough to write newer data in between.
The problem also is that this problem can be relatively rare in practice
and without proper design may silently cause consistency problems.
Said this, I believe Riak as a DBMS for the project in question is the
best choice, so please, do not suggest going relational database path just
because it offers locks for rows and such.
No comments:
Post a Comment