Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow retention_seconds on append only table and its downstream index #15268

Merged
merged 12 commits into from
Feb 28, 2024

Conversation

st1page
Copy link
Contributor

@st1page st1page commented Feb 26, 2024

I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.

What's changed and what's your intention?

close #14791

Checklist

  • I have written necessary rustdoc comments
  • I have added necessary unit tests and integration tests
  • I have added test labels as necessary. See details.
  • I have added fuzzing tests or opened an issue to track them. (Optional, recommended for new SQL features Sqlsmith: Sql feature generation #7934).
  • My PR contains breaking changes. (If it deprecates some features, please create a tracking issue to remove them in the future).
  • All checks passed in ./risedev check (or alias, ./risedev c)
  • My PR changes performance-critical code. (Please run macro/micro-benchmarks and show the results.)
  • My PR contains critical fixes that are necessary to be merged into the latest release. (Please check out the details)

Documentation

  • My PR needs documentation updates. (Please use the Release note section below to summarize the impact on users)

Release note

Users can set TTL(time to live) on the append-only table with the retention_seconds option and the record will be removed from the table after the retention seconds passed.
The same retention seconds will be applied to the table's downstream index automatically.

dev=> create table t(v int) APPEND ONLY with (retention_seconds = 5);
NOTICE:  APPEND ONLY TABLE is currently an experimental feature.
CREATE_TABLE
dev=> create index i on t(v);
CREATE_INDEX
dev=> insert into t values(1);
INSERT 0 1
dev=> flush;
FLUSH
dev=> select * from t;
 v 
---
 1
(1 row)

dev=> select * from i;
 v 
---
 1
(1 row)

dev=> select pg_sleep(5);
 pg_sleep 
----------
         
(1 row)

dev=> select * from i;
 v 
---
(0 rows)

dev=> select * from t;
 v 
---
(0 rows)

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

license-eye has totally checked 4825 files.

Valid Invalid Ignored Fixed
2093 1 2731 0
Click to see the invalid file list
  • src/frontend/src/optimizer/mod.rs

src/frontend/src/optimizer/mod.rs Show resolved Hide resolved
st1page and others added 4 commits February 26, 2024 20:27
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…thub.com:risingwavelabs/risingwave into sts/allow_retention_seconds_on_append_only_table
@st1page st1page requested review from fuyufjh and hzxa21 February 27, 2024 05:12
st1page and others added 3 commits February 27, 2024 13:13
Copy link
Member

@fuyufjh fuyufjh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

1

statement ok
select pg_sleep(10);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QQ. Once a row has expired, but hasn't been removed by compactor yet, will the scan iterator "hides" it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remember there is some code in state store implementation to "hide" it. need to check @Li0k

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We definitely hide it, by filtering it in the min_epoch of the iterator on the read path.

@st1page st1page added this pull request to the merge queue Feb 27, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 27, 2024
@st1page st1page added this pull request to the merge queue Feb 28, 2024
Merged via the queue into main with commit 15c403c Feb 28, 2024
26 of 27 checks passed
@st1page st1page deleted the sts/allow_retention_seconds_on_append_only_table branch February 28, 2024 03:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

only allow TTL(retention_seconds) on append only table
3 participants