Cannot use vertex and edge TTL on Hbase
I saw the document on the JanusGraph website and it said Hbase support vertex and edge TTL setting. I am using JanusGraph 0.2.0 and Hbase 1.1.4. but when the time ran out, the vertex and edge didn't disappear.
Did you try JanusGraph 0.2.0 instead of SNAPSHOT?
Yes,I have tried it already.
Do you mean JanusGraph 0.2.0 release has the same problem?
Is this related to #448?
#448 said can not set the TTL, 0.2.0 can set it,but when time run out. the TTL doesn't work.
canssandra is ok, but hbase can't.
have the same problem on hbase. Is there any solutions?
I finally got a chance to dig into this problem. The problem is with the TIMESTAMP_PROVIDER in janusgraph.
public static final ConfigOption<TimestampProviders> TIMESTAMP_PROVIDER = new ConfigOption<>(GRAPH_NS, "timestamps",
"The timestamp resolution to use when writing to storage and indices. Sets the time granularity for the " +
"entire graph cluster. To avoid potential inaccuracies, the configured time resolution should match " +
"those of the backend systems. Some JanusGraph storage backends declare a preferred timestamp resolution that " +
"reflects design constraints in the underlying service. When the backend provides " +
"a preferred default, and when this setting is not explicitly declared in the config file, the backend " +
"default is used and the general default associated with this setting is ignored. An explicit " +
"declaration of this setting overrides both the general and backend-specific defaults.",
ConfigOption.Type.FIXED, TimestampProviders.class, TimestampProviders.MICRO);
In HBase, the timestamp is always interpreted as millisec. Thus from janusgraph, we need to use millisec.
The reason why the TTL has not been honored is explained here.
I looked at the hfile (hbase data file), which is shown here:
K: (\x00\x00\x00\x00\x00\x00\x84/e:\x02/1514590685901001/Put/vlen=4/seqid=59 V: \x00\x01\x04\x85 T[0]: \x00\x00\x00\x00\x00\x00\x13\x88
K: (\x00\x00\x00\x00\x00\x00\x84/e:$/1514590685901001/Put/vlen=5/seqid=59 V: \x04\x8D\x08\x85\xFF T[0]: \x00\x00\x00\x00\x00\x00\x13\x88
The commit timestamp is 1514590685901001. This is the timestamp that janusgraph sent in as micro sec. But HBase will regard it as millisec. Convert the millisec timestamp to a real date. It is 6/20/49965. This is far in the future. That is why the cell will never expire.
The TTLs were corrected recorded in the cell as T[0]: \x00\x00\x00\x00\x00\x00\x13\x88
Setting the property graph.timestamps will solve the problem.
graph.timestamps=MILLI
This is a FIXED global property.
From the description of the TIMESTAMP_PROVIDER option,
To avoid potential inaccuracies, the configured time resolution should match those of the backend systems. Some JanusGraph storage backends declare a preferred timestamp resolution that reflects design constraints in the underlying service. When the backend provides a preferred default, and when this setting is not explicitly declared in the config file, the backend default is used and the general default associated with this setting is ignored. An explicit declaration of this setting overrides both the general and backend-specific defaults.
HBaseStoreManager defines a preferred TIMESTAMP_PROVIDER:
public static final TimestampProviders PREFERRED_TIMESTAMPS = TimestampProviders.MILLI;
Apparently, the 'preferred default' logic is broken in general janusgraph configuration.
We need to:
- Fix the 'preferred default' logic in general janusgraph configuration.
- We should require MILLI always for HBase backend.
To conclude this Issue, we will fix:
- [x] #862
- [x] #887
These two should be able to cover this Issue.
I am closing this issue while marking #887 for 0.21 release.