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

Add support for subject delete markers by MaxAge #6378

Merged
merged 1 commit into from
Jan 20, 2025
Merged

Conversation

neilalexander
Copy link
Member

This PR adds the LimitsTTL functionality for system tombstones when a subject is removed via MaxAge. The tombstone will have the header Nats-Applied-Limit and the specified LimitsTTL value as the TTL.

Further limits and/or administrative actions to follow separately.

This also requires API version 1, cannot be set if TTLs are disabled and cannot be combined with a mirror configuration.

Signed-off-by: Neil Twigg [email protected]

@neilalexander neilalexander requested a review from a team as a code owner January 16, 2025 18:06
server/filestore.go Outdated Show resolved Hide resolved
server/filestore.go Show resolved Hide resolved
server/filestore.go Outdated Show resolved Hide resolved
}
// Build the system tombstone.
var _hdr [128]byte
hdr := fmt.Appendf(_hdr[:0], "NATS/1.0\r\n%s: %s\r\n%s: %s\r\n\r\n", JSAppliedLimit, reason, JSMessageTTL, fs.cfg.LimitsTTL)
Copy link
Member

Choose a reason for hiding this comment

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

LimitsTTL seems like wrong name IMO.

Copy link
Member Author

Choose a reason for hiding this comment

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

Best that @ripienaar has input here as this is the name from the ADR.

Copy link
Contributor

Choose a reason for hiding this comment

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

When limits are applied and tombstones are written, this is the TTL of those messages.

We didnt consider purges would be involved until later, do you have a name suggestion @derekcollison ?

Copy link
Member

Choose a reason for hiding this comment

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

Naming is hard, so not at the moment but will give it some thought.

Copy link
Contributor

Choose a reason for hiding this comment

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

something like ActionTTL or NotificationTTL? Other ideas? Failing to find a better name :)

Copy link
Member Author

Choose a reason for hiding this comment

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

It feels weird still, if it's LimitsTombstones then never doesn't make sense for something that does leave TTLs, and if it's LimitsTTL or LimitsTombstonesTTL then it's difficult to explain why the option is named after TTLs when it has a secondary larger effect.

Copy link
Contributor

@ripienaar ripienaar Jan 17, 2025

Choose a reason for hiding this comment

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

We can add 2 fields, I am not super stuck to the idea or anything, just conscious of how many config options we have, though I agree making it awkward is also not good.

And then having to guess if the user just forgot to set a TTL or if they really want forever tombstones etc?

Copy link
Member

Choose a reason for hiding this comment

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

I think the turning on should be a bool that is clear we will generate markers when a subject disappears, and that should have a default TTL. We can have a second that allows them to override or change the TTL for he markers, including a "never" if needed.

Copy link
Contributor

Choose a reason for hiding this comment

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

How about tombstoneTTL?

Copy link
Member Author

Choose a reason for hiding this comment

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

We've gone with SubjectDeleteMarkers bool and SubjectDeleteMarkerTTL string.

The default if not specified will be 15 minutes if not specified, RI and I think this is a good value as it's well outside the recovery time for fetch/ordered consumer/client/route/gateway etc failures as well as even application restarts.

server/filestore.go Outdated Show resolved Hide resolved
server/filestore.go Show resolved Hide resolved
server/filestore.go Outdated Show resolved Hide resolved
@neilalexander neilalexander changed the title System tombstones for subject deletes by MaxAge Add support for subject delete markers by MaxAge Jan 20, 2025
@neilalexander neilalexander marked this pull request as draft January 20, 2025 11:12
@neilalexander neilalexander marked this pull request as ready for review January 20, 2025 11:58
@derekcollison
Copy link
Member

This ready for a second review?

@neilalexander
Copy link
Member Author

@derekcollison Please!

@derekcollison derekcollison self-requested a review January 20, 2025 16:21
Copy link
Member

@derekcollison derekcollison left a comment

Choose a reason for hiding this comment

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

LGTM

@derekcollison derekcollison merged commit abd6197 into main Jan 20, 2025
5 checks passed
@derekcollison derekcollison deleted the neil/limitsttl branch January 20, 2025 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants