garnet icon indicating copy to clipboard operation
garnet copied to clipboard

Mark auto-expired key-value pairs in the mutable log as tombstoned

Open badrishc opened this issue 11 months ago • 2 comments

Feature request type

enhancement

Is your feature request related to a problem? Please describe

When an expiration time is attached to entries in the store, after expiration, they are not removed from the log until (and if) they tier down to storage and get compacted.

We would like to add some way to tombstone these records so that (1) the heap objects are freed in case of the object store; and (2) the log space can be reused for new objects using revivification, in case of the main store.

Describe the solution you'd like

One way to accomplish this is to have a periodic background scanner thread that scans (only the mutable region of) the log, and tombstones any expired entries.

Describe alternatives you've considered

No response

Additional context

See https://github.com/microsoft/garnet/issues/1097 for a more detailed discussion of this.

badrishc avatar Mar 20 '25 01:03 badrishc

@badrishc can this be assigned to me, if someone has not actively picked this up yet, since this will be something ARG will be needing.

hamdaankhalid avatar Apr 24 '25 22:04 hamdaankhalid

Working on this here: https://github.com/microsoft/garnet/pull/1180

Will probably flush this out tomorrow.

hamdaankhalid avatar Apr 25 '25 06:04 hamdaankhalid

I noticed that PR #1180 was closed with unmerged commits. Is there any update on when this issue will be resolved or if there's an alternative approach being considered?

wessisaac avatar Jun 04 '25 17:06 wessisaac

Working on this here: #1180

Will probably flush this out tomorrow.

I noticed that PR #1180 was closed with unmerged commits. Is there any update on when this issue will be resolved or if there's an alternative approach being considered?

wessisaac avatar Jun 04 '25 18:06 wessisaac

Better approach is being worked on. You really should help us with a stand alone repro if possible, not just code snippets. Program.cs that we can just dotnet run. Otherwise we are making improvements in a vacuum. Thanks!

badrishc avatar Jun 04 '25 20:06 badrishc

Hi Badrish,

Please refer to the GitHub repository below to access my sample source code, which demonstrates the use of Hangfire recurring jobs. In this real-time scenario, all job logs are stored in the Garnet database with 3 minute auto-expiration. However, the database continues to grow indefinitely due to this functionality.

Git Path: https://github.com/wesleyisaacd/GarnetRepro.git

Code: https://github.com/wesleyisaacd/GarnetRepro/tree/master/WebScheduler

wessisaac avatar Jun 06 '25 21:06 wessisaac