如何在 HBase 中检索行的最后修改时间戳?

How to retrieve row's last modification timestamp in HBase?

返回的Result对象中的每个Cell是否有相同的时间戳? 这样做省钱吗?

  try (Table table = connectionFactory.getConnection().getTable(TABLE)) {
   try (ResultScanner scanner = table.getScanner(generateScan(systemId))) {
    for (Result result: scanner) {
     if (result == null) {
      break;
     }
     long ts = result.rawCells()[0].getTimestamp();
     System.out.println("Row last update time: " + ts);
    }
   }
  }

我会得到最后一行修改的时间戳吗?

结果中的单元格可以有不同的时间戳。每个单元格都是 CF:C:V 的组合,其中 CF 是列族,C 是列,V 是版本。即使您只存储 1 个版本,您也可以独立更新单元格的列。当您存储内容时,单元格时间戳会更新。

例如,您有 table usercf:main 以及两列 nameage。如果您在同一 Put 中更新两列,它们将具有相同的时间戳。如果您只更新 name 列,时间戳将不同。所以一般来说这取决于你的使用模式。