Cassandra在何处以及如何存储和更新每个单元格的时间戳?

时间:2018-06-14 09:10:27

标签: cassandra

我目前正致力于在Cassandra上实现存储算法的想法, 为了这个想法工作, 除了每个单元格的时间戳之外,我还需要存储一些每单元格元数据。

我的问题是, 在代码库中Cassandra处理每个单元格时间戳的位置? 我已经浏览了写入路径,似乎无法找到它。

1 个答案:

答案 0 :(得分:1)

您可能想从这里开始:

Cell.java:

  32 /**
  33  * A cell is our atomic unit for a single value of a single column.
  34  * <p>
  35  * A cell always holds at least a timestamp that gives us how the cell reconcile. We then
  36  * have 3 main types of cells:
  37  *   1) live regular cells: those will also have a value and, if for a complex column, a path.
  38  *   2) expiring cells: on top of regular cells, those have a ttl and a local deletion time (when they are expired).
  39  *   3) tombstone cells: those won't have value, but they have a local deletion time (when the tombstone was created).
  40  */

https://git-wip-us.apache.org/repos/asf?p=cassandra.git;a=blob;f=src/java/org/apache/cassandra/db/rows/Cell.java;h=300bbce12a225fc7630daee78d2fe64b6a868c73;hb=3b56d4df40800f76dcf2c0019af43b7dbc244c57

AbstractCell.java(继承Cell.java):

https://git-wip-us.apache.org/repos/asf?p=cassandra.git;a=blob;f=src/java/org/apache/cassandra/db/rows/AbstractCell.java;h=bfe7396c23c45a3ed8da479551c8e1a6fa23f76b;hb=3b56d4df40800f76dcf2c0019af43b7dbc244c57

在这里

NativeCell.java(继承AbstractCell.java):

https://git-wip-us.apache.org/repos/asf?p=cassandra.git;a=blob;f=src/java/org/apache/cassandra/db/rows/NativeCell.java;h=c4cb6c1342cba700f5b059d1f5a9108bb83b2a66;hb=3b56d4df40800f76dcf2c0019af43b7dbc244c57

但是,如果您想将Cassandra用于存储解决方案,请明确存储时间戳和元数据,不要使用cassandras内部的单元格元数据。