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

He Liangliang commented on HBASE-2256:
--------------------------------------

Also encountered similar problem. What about this solution?
{code}
public class IncrementingWallTimeEnvironmentEdge implements EnvironmentEdge {
  private long clock = -1;

  public IncrementingWallTimeEnvironmentEdge() {
  }

  @Override
  public long currentTimeMillis() {
    long wallTime = System.currentTimeMillis() << 10; // ~us, or any arbitrary 
scaling factor

    synchronized (this) {
        if (clock < wallTime) {
          clock = wallTime;
        }
        return clock++;
    }
  }
}
{code}
This would solve this problem and guarantee the timestamp aligned with the wall 
time clock in milliseconds as long as we set the scaling factor to a larger 
enough number (i.e. make sure the speed of logical clock is slower than 
System.currentTimeMillis()). Shift factor from 10 ~20 (1M-1G qps) is proper 
value for current server configuration which also will not introduce wrapping 
around concern (584M ~ 0.57M year).

> Delete row, followed quickly to put of the same row will sometimes fail.
> ------------------------------------------------------------------------
>
>                 Key: HBASE-2256
>                 URL: https://issues.apache.org/jira/browse/HBASE-2256
>             Project: HBase
>          Issue Type: Bug
>    Affects Versions: 0.20.3
>            Reporter: Clint Morgan
>         Attachments: hbase-2256.patch
>
>
> Doing a Delete of a whole row, followed immediately by a put to that row will 
> sometimes miss a cell. Attached is a test to provoke the issue.



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to