hbase-4507 Create checkAndPut variant that exposes timestamp
Review Request #2118 - Created Sept. 29, 2011 and updated
Adds a checkAndPut that takes a timestamp
expected is not needed here.
Should be existence.
Should be executed.
I don't see this parameter below. I think these four lines can be moved into the body of the method.
Writable parameter is missing here. It would be nice to add it now.
Should be checkAndPut
How about naming this method doTimestampsClash ?
I wish there is a better way to handle this situation :-(
'that of the' can be omitted.
Good stuff. I'm not crazy about the +1 ms but I think it's harmless (we'll literally never run into this for the META use case, as I've understood it)
Nice stuff, Stack. Some questions: 1. The approach of "isTimestampClash and the nowBytes = Bytes.toBytes(now + 1)". It seems there is still a rare case, where EnvironmentEdgeManager.currentTimeMillis() returns expectedTimestampOfLatestVersion - 1. Then later on in put, updateKVTimestamps set it to the new now value, which happens to be expectedTimestampOfLatestVersion. Perhaps we can use "now <= expectedTimestampOfLatestVersion" condition instead of "now == expectedTimestampOfLatestVersion" in isTimestampClash. Set the new time value as nowBytes = Bytes.toBytes(expectedTimestampOfLatestVersion + 1). 2. Do we need to modify coprocessor interfaces preCheckAndPut, postCheckAndPut, etc.? Perhaps we don't have any scenario for this yet. 3. Do we need the same thing for checkAndDelete? Perhaps we don't have any scenario for this yet.
This version fixes Teds issue and then it does 1. and 2. in Ming's list of 3. I refactored some moving the timestamp messing down into innerPut. This cleans up the patch significantly. Added more javadoc on the method to the effect that this method is for low-frequency updates on a cell only; i.e. not > one edit per millisecond. What you think Ming?
It looks good. BTW, it looks like we don't have unit tests for RegionObserver.preCheckAndPut and RegionObserver.postCheckAndPut. Maybe need a separate jira for that.