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

PIP-221: Make TableView support TTL #18229

Closed
Demogorgon314 opened this issue Oct 28, 2022 · 8 comments
Closed

PIP-221: Make TableView support TTL #18229

Demogorgon314 opened this issue Oct 28, 2022 · 8 comments

Comments

@Demogorgon314
Copy link
Member

Demogorgon314 commented Oct 28, 2022

Motivation

Currently, the table view only supports removing messages
when receiving tombstone messages.

However, some old keys may be useless after a while,
but we won't be able to remove them unless we manually scan the map.
Like load data in PIP-192 #16691.

This PIP will introduce the TTL to delete the old data,
and the TTL will be based on the message publish time.

Goal

Add TTL for persistent and non-persistent topic data in the table view.

API Changes

public interface TableViewBuilder<T> {
// ...

    /**
     * Set key to expire after written TTL. 
     * If not set, the key will never expire unless received the tombstone(The value is null) message.
     *
     * @param ttl The key time to live.
     * @param unit The ttl unit.
     * @return The {@link TableViewBuilder} builder instance
     */
    TableViewBuilder<T> ttl(int ttl, TimeUnit unit);
}

Implementation

The data can be stored in a caffeine cache.
We can easily use expireAfter API to add TTL support.

Alternatives

Users manually maintain another cache to scan
and remove it by tombstone messages.

Anything else?

No response

@codelipenghui
Copy link
Contributor

@Demogorgon314 It's a little confusing if the TTL can only apply to the table view that is based on the non-persistent topic. Or can it also apply to the persistent topic?

And the TTL is based on the message publish time or the time arrive the consumer.

@Demogorgon314
Copy link
Member Author

@codelipenghui I have changed the PIP describe base on your comment. Please take a look again! Thanks.

@codelipenghui
Copy link
Contributor

@Demogorgon314 LGTM

@eolivelli
Copy link
Contributor

I don't think that TTL is related to supporting non-persistent topics.

Maybe the TTL feature is worth a PIP, but supporting non-persistent topics is like a small enhancement (or completing the TableView) feature to me and it doesn't need a PIP, as it doesn't need API changes

@Demogorgon314
Copy link
Member Author

@eolivelli Yes, I can change this PIP title to Make TableView support TTL.

@Demogorgon314 Demogorgon314 changed the title PIP-221: Make TableView support read the non-persistent topic PIP-221: Make TableView support TTL Nov 8, 2022
@heesung-sn
Copy link
Contributor

@github-actions
Copy link

The issue had no activity for 30 days, mark with Stale label.

@github-actions github-actions bot added the Stale label Dec 18, 2022
@heesung-sn
Copy link
Contributor

@Demogorgon314 Should we close this PIP if we decide not to work on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants