[ 
https://issues.apache.org/jira/browse/HBASE-7051?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13483921#comment-13483921
 ] 

Lars Hofhansl edited comment on HBASE-7051 at 10/25/12 6:16 AM:
----------------------------------------------------------------

Note that this is not as simple as it looks. Increments are not idempotent. 
They skirt the issue by making changes visible immediately so that other 
increments see the result of all previous increments.
If that was not the case two increments of 1 with a base value of 0 could still 
just lead to 1, even when they are both applied atomically.
That is why the memstoreTS is set to 0 for increments (making it visible 
immediately).

Edit: Forgot an important "not" and spelling :)
                
      was (Author: lhofhansl):
    Note that this is not as simple as it looks. Increments are not idempotent. 
The skirt the issue by making changes visible immediately so that other 
increments see the result all previous increments.
If that were not the case two increments of 1 with a base value of 0 could 
still just lead to 1, even when they are both applied atomically.
That is why the memstoreTS is set to 0 for increments (making it visible 
immediately).

Edit: Forgot an important "not" :)
                  
> Read/Updates (increment,checkAndPut) should properly read MVCC
> --------------------------------------------------------------
>
>                 Key: HBASE-7051
>                 URL: https://issues.apache.org/jira/browse/HBASE-7051
>             Project: HBase
>          Issue Type: Bug
>    Affects Versions: 0.96.0
>            Reporter: Gregory Chanan
>
> See, for example:
> {code}
> // TODO: Use MVCC to make this set of increments atomic to reads
> {code}
> Here's an example of what I can happen (would probably be good to write up a 
> test case for each read/update):
> Concurrent update via increment and put.
> The put grabs the row lock first and updates the memstore, but releases the 
> row lock before the MVCC is advanced.  Then, the increment grabs the row lock 
> and reads right away, reading the old value and incrementing based on that.
> There are a few options here:
> 1) Waiting for the MVCC to advance for read/updates: the downside is that you 
> have to wait for updates on other rows.
> 2) Have an MVCC per-row (table configuration): this avoids the unnecessary 
> contention of 1)
> 3) Transform the read/updates to write-only with rollup on read..  E.g. an 
> increment  would just have the number of values to increment.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to