vesoft-inc / nebula

A distributed, fast open-source graph database featuring horizontal scalability and high availability
https://nebula-graph.io
Apache License 2.0
10.69k stars 1.2k forks source link

TTL-Expired Vertex being queried in GO #2925

Closed wey-gu closed 2 years ago

wey-gu commented 3 years ago

reproduce:

CREATE TAG v_post(id INT NOT NULL, user FIXED_STRING(20) NOT NULL, ts TIMESTAMP);
CREATE TAG v_tag(name FIXED_STRING(29) NOT NULL, ts TIMESTAMP) TTL_DURATION = 30, TTL_COL = "ts";
CREATE EDGE e_tag(ts TIMESTAMP);

INSERT VERTEX v_post(id, user, ts) values "p1001":(1001, "user1", now());
INSERT VERTEX v_tag(name, ts) values "test1":("test1", now());
INSERT VERTEX v_tag(name, ts) values "test2":("test2", now());

INSERT EDGE e_tag(ts) values "p1001"->"test1":(now());
INSERT EDGE e_tag(ts) values "p1001"->"test2":(now());

query after data loaded:


(root@nebula) [basketballplayer]> GO FROM "p1001" OVER e_tag YIELD $$.v_tag.name AS name, $$.v_tag.ts AS ts
+---------+------------+
| name    | ts         |
+---------+------------+
| "test1" | 1632469961 |
+---------+------------+
| "test2" | 1632469962 |
+---------+------------+
Got 2 rows (time spent 68854/108054 us)

Fri, 24 Sep 2021 15:53:29 CST

(root@nebula) [basketballplayer]> MATCH (p:v_post)-[e:e_tag]->(t:v_tag) WHERE id(p) == "p1001" return t.name AS name, t.ts AS ts +---------+------------+ | name | ts | +---------+------------+ | "test1" | 1632469961 | +---------+------------+ | "test2" | 1632469962 | +---------+------------+ Got 2 rows (time spent 56766/90173 us)

Fri, 24 Sep 2021 15:53:30 CST


> query after e_tag expired

(root@nebula) [basketballplayer]> MATCH (p:v_post)-[e:e_tag]->(t:v_tag) WHERE id(p) == "p1001" return t.name AS name, t.ts AS ts +------+----+ | name | ts | +------+----+ +------+----+ Empty set (time spent 71241/104775 us)

Fri, 24 Sep 2021 15:55:36 CST

(root@nebula) [basketballplayer]> GO FROM "p1001" OVER e_tag YIELD $$.v_tag.name AS name, $$.v_tag.ts AS ts +------+----+ name ts +------+----+

+------+----+ | | | +------+----+ Got 2 rows (time spent 30674/62919 us) #<---------------------

Fri, 24 Sep 2021 15:55:38 CST



Shouldn't 0 rows to be returned instead of 2?
wey-gu commented 3 years ago

context slack thread by renman

https://nebulagraph.slack.com/archives/CSHN72Z6X/p1632467880001300

CPWstatic commented 3 years ago

This is because of the hanging edges. And the Match / Go have different semantics. You will be more clear by trying this case:

GO FROM "p1001" OVER e_tag YIELD E_TAG._dst, $$.v_tag.name AS name, $$.v_tag.ts AS ts
CPWstatic commented 3 years ago

This is not an easy handled issue.

critical27 commented 2 years ago

Fixed in #3535