pulsar icon indicating copy to clipboard operation
pulsar copied to clipboard

PIP-221: Make TableView support read the non-persistent topic

Open Demogorgon314 opened this issue 3 years ago • 3 comments

Motivation

Currently, the table view only supports persistent topics with read compacted.

However, some data don't require persistent storage, like load data in PIP-192 #16691.

We need to support non-persistent topic read for table view and introduce the TTL to delete the old data. The TTL is based on the message publish time.

Goal

  • Support non-persistent topics for table view
  • 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

N/A

Anything else?

No response

Demogorgon314 avatar Oct 28 '22 00:10 Demogorgon314

@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.

codelipenghui avatar Oct 28 '22 02:10 codelipenghui

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

Demogorgon314 avatar Oct 31 '22 03:10 Demogorgon314

@Demogorgon314 LGTM

codelipenghui avatar Oct 31 '22 04:10 codelipenghui

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

eolivelli avatar Nov 07 '22 10:11 eolivelli

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

Demogorgon314 avatar Nov 07 '22 13:11 Demogorgon314

Discussion Email Thread: https://lists.apache.org/thread/jq8dr965vqox52f5n6h9jt2npnwkxrfn

heesung-sohn avatar Nov 17 '22 17:11 heesung-sohn

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

github-actions[bot] avatar Dec 18 '22 01:12 github-actions[bot]

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

heesung-sohn avatar May 04 '23 16:05 heesung-sohn