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

JetStream Object Store : Add conditional writes #6322

Open
udf2457 opened this issue Jan 5, 2025 · 4 comments
Open

JetStream Object Store : Add conditional writes #6322

udf2457 opened this issue Jan 5, 2025 · 4 comments
Labels
proposal Enhancement idea or proposal

Comments

@udf2457
Copy link

udf2457 commented Jan 5, 2025

Proposed change

NATS should introduce a conditional write feature in order to protect against race conditions in various scenarios.

Use case

This probably explains it bettter than I could: https://www.exoscale.com/syslog/exoscale-sos-conditional-write/
(The Exoscale implementation is an implementation of the original concept from AWS: https://aws.amazon.com/about-aws/whats-new/2024/08/amazon-s3-conditional-writes/)

Contribution

No response

@udf2457 udf2457 added the proposal Enhancement idea or proposal label Jan 5, 2025
@Jarema
Copy link
Member

Jarema commented Jan 6, 2025

While NATS JetStream supports some mechnisms that conditional writes require, and those are utilized in Key Value store, it is much harder to achieve the same in Object Store API, as Object Store PUT operations are not atomic - they publishing chunks and metadata messages into the stream. That in turn, makes introducing feature like conditional writes quite unreliable.

You could technically use KV with TTL'd messages as a distriubuted lock to achieve similar goals.

@udf2457
Copy link
Author

udf2457 commented Jan 6, 2025

Thanks for the clarification @Jarema .

I guess that makes sense although I suppose I would ask how come even though the operation is not atomic the result (ack-equivalent) of a PUT can be trusted ?

@Jarema
Copy link
Member

Jarema commented Jan 6, 2025

@udf2457 the operation is successful only if all publishes to the Stream (chunks and metadata) were successful (client got acks for all of them).

@udf2457
Copy link
Author

udf2457 commented Jan 6, 2025

@Jarema , thanks.

Maybe at some point a kind soul could update the docs with this sort of useful background info ? It provides reassurance as to data integrity ! The docs are presently as they were during the beta/experimental-feature stages.

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

No branches or pull requests

2 participants