In
https://github.com/facebook/rocksdb/wiki/Read-Modify-Write-Benchmarks, I noticed that RocksDB conducted comparative experiments for Merge and read-modify-write operations. But I have doubts about implementation details in db_bench. The steps RocksDB take to use UpdateRandom are:
1. Read a random key
2.Write a new value to the random key
But its semantics are essentially different from the MergeRandom. Because the new value written using UpdateRandom has no relationship with the value read, which is different from Merge (the semantics of the latter is: the value written is the value read + 1).
This problem may not be apparent in examples using counters, but consider the StringAppendOperator. If we use this MergeOperator, the semantics of MergeRandom will make the size of the value continuously increase, but the semantics of UpdateRandom will not continuously append the value, so the size of the value will remain unchanged.
Should we consider modifying the UpdateRandom function? After reading out the key, perform certain operations on the corresponding value to generate a new value and then write it in instead of randomly writing a new value like now,.Or add a RMWRandom function to realize the semantics I mentioned above?
Thank you!