Skip to content

[TTL] Historical data may never expire #5131

Closed
@cangfengzhs

Description

@cangfengzhs

Please check the FAQ documentation before raising an issue

Describe the bug (required)

create tag ttl_tag1(age int);
insert vertex ttl_tag1(age) VALUES "1":(10),"2":(20),"3":(30);
alter tag ttl_tag1 add (ttl timestamp default now());
alter tag ttl_tag1 ttl_duration=10, ttl_col="ttl";
insert vertex ttl_tag1(age) VALUES "4":(40);
match (v:ttl_tag1) return v limit 10;

After the above series of operations. The ttl_tag1 of "1", "2" and "3" will never expire.

This is because there is a problem with our definition of default. In this case, the default value of ttl is now(). now(), which will be stored in the definition of ttl (it is the function now(), not the return value of it).

When we read a ttl if the property does not exist in tag1.ttl, it will get the default value from the schema definition. So for ttl_tag1 of "1", "2" and "3", the latest now() will be calculated every time when reading, so they will never expire.

Your Environments (required)

  • OS: uname -a
  • Compiler: g++ --version or clang++ --version
  • CPU: lscpu
  • Commit id (e.g. a3ffc7d8)

How To Reproduce(required)

Steps to reproduce the behavior:

  1. Step 1
  2. Step 2
  3. Step 3

Expected behavior

Additional context

Metadata

Metadata

Assignees

Labels

affects/masterPR/issue: this bug affects master version.doc affectedPR: improvements or additions to documentationprocess/doneProcess of bugseverity/minorSeverity of bugtype/bugType: something is unexpectedwontfixSolution: this will not be worked on recently

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions