go-hbase的坑

来源:互联网 发布:vb用户管理系统 编辑:程序博客网 时间:2024/06/01 13:08

使用pingcap的go-hbase,往设置ttl的表中写数据,写操作没报异常,但是写完发现get不到对应的数据

往另外一个表里,可以写进数据,但是发现timestamp为0

所以ttl的表里面get不到写进去的数据

原因是go-hbase中的put.go里面ts 直接传了个0

HBase的java客户端传的是Long.MAX_VALUE

  /**   * Timestamp to use when we want to refer to the latest cell.   * This is the timestamp sent by clients when no timestamp is specified on   * commit.   */  public static final long LATEST_TIMESTAMP = Long.MAX_VALUE;

最终写入到hbase中的ts是哪里赋值的?
看一下server端的实现:HRegion.mutateRow=>mutateRowsWithLocks=>processRowsWithLocks

long now = EnvironmentEdgeManager.currentTimeMillis();        doProcessRowWithTimeout(            processor, now, this, null, null, timeout);

在上面这个方法中update的ts值

原创粉丝点击