Skip to content
This repository has been archived by the owner on Apr 1, 2024. It is now read-only.

ISSUE-18229: PIP-221: Make TableView support TTL #5046

Open
sijie opened this issue Oct 28, 2022 · 0 comments
Open

ISSUE-18229: PIP-221: Make TableView support TTL #5046

sijie opened this issue Oct 28, 2022 · 0 comments

Comments

@sijie
Copy link
Member

sijie commented Oct 28, 2022

Original Issue: apache#18229


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

@sijie sijie added the PIP label Oct 28, 2022
@sijie sijie changed the title ISSUE-18229: PIP-221: Make TableView support read the non-persistent topic ISSUE-18229: PIP-221: Make TableView support TTL Dec 18, 2022
@sijie sijie added the Stale label Dec 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant