go-hbase的坑

使用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值

发布了52 篇原创文章 · 获赞 4 · 访问量 5万+

猜你喜欢

转载自blog.csdn.net/Gloria_y/article/details/77874877