Is this possible to lock the record in Riak database ?
是否可以锁定Riak数据库中的记录?
Like, in oracle- if we are updating the record in oracle table row, We have an option to lock the record while updating.
比如,在oracle中——如果我们在oracle表行中更新记录,我们可以选择在更新时锁定记录。
Is it possible to lock the record in riak database while updating record/object.
是否可以在更新记录/对象时锁定riak数据库中的记录。
1 个解决方案
#1
2
Locking is not supported in Riak. Instead, if two writers try to update the same value at the same time, both writes are kept as sibling values. Your application can then select the "correct" value.
在Riak中不支持锁。相反,如果两个作者同时尝试更新相同的值,那么这两个写入都被保存为兄弟值。然后,您的应用程序可以选择“正确的”值。
If you would prefer to just keep the most recently written value and discard the other, explicitly set allow_mult
to false on the bucket and Riak will automatically pick the newest time stamp when sibling values are encountered.
如果您希望保留最近的写入值,并抛弃另一个值,那么在bucket中显式地设置allow_mult为false, Riak将在遇到兄弟值时自动选择最新的时间戳。
However, I don't think this setting works with strong consistency or data types.
但是,我不认为这种设置具有很强的一致性或数据类型。
#1
2
Locking is not supported in Riak. Instead, if two writers try to update the same value at the same time, both writes are kept as sibling values. Your application can then select the "correct" value.
在Riak中不支持锁。相反,如果两个作者同时尝试更新相同的值,那么这两个写入都被保存为兄弟值。然后,您的应用程序可以选择“正确的”值。
If you would prefer to just keep the most recently written value and discard the other, explicitly set allow_mult
to false on the bucket and Riak will automatically pick the newest time stamp when sibling values are encountered.
如果您希望保留最近的写入值,并抛弃另一个值,那么在bucket中显式地设置allow_mult为false, Riak将在遇到兄弟值时自动选择最新的时间戳。
However, I don't think this setting works with strong consistency or data types.
但是,我不认为这种设置具有很强的一致性或数据类型。