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

Native ETag Support #908

Merged
merged 104 commits into from
Jan 11, 2025
Merged

Native ETag Support #908

merged 104 commits into from
Jan 11, 2025

Conversation

hamdaankhalid
Copy link
Contributor

Native ETag Support

Garnet provides support for ETags on raw strings. You can associate any string-based key-value pair inserted into Garnet with an automatically updated ETag.
Compatibility with non-ETag commands and the behavior of data inserted with ETags are detailed in the markdown for garnet specific commands. Please read the markdown file for API contracts, and compatibility.

HLD:

RecordInfo for a record indicated whether or not a record contains an ETag. This bit on the record info is used to indicate that the first 8 bytes of the payload of the record include a long data type that represents the eTag associated with the value that is present after the first 8 bytes.

Reads don't modify the eTag, but any RMW operations do. Blind Upsert (SET) will remove the eTag unless sent with the WITHETAG flag.

ETags are incremented on each update, and the user can use them to handle things such as caching and Optimistic concurrency control.

@hamdaankhalid hamdaankhalid changed the base branch from hkhalid/etag-impl to main January 10, 2025 19:07
@hamdaankhalid hamdaankhalid changed the title Native ETag impl Native ETag Suppor Jan 10, 2025
@hamdaankhalid hamdaankhalid changed the title Native ETag Suppor Native ETag Support Jan 10, 2025
@hamdaankhalid
Copy link
Contributor Author

hamdaankhalid commented Jan 10, 2025

@badrishc
Copy link
Contributor

Link to older PR with earlier comments: #675

@badrishc
Copy link
Contributor

Really nice work that moves the Garnet API beyond state-of-the-art! ETags are a critical building block for cache consistency use cases. Much appreciated!

Copy link
Contributor

@TalZaccai TalZaccai left a comment

Choose a reason for hiding this comment

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

Good stuff! A few cosmetic / non-urgent comments. Can be resolved in a consecutive PR.

libs/resources/RespCommandsDocs.json Show resolved Hide resolved
libs/server/Constants.cs Show resolved Hide resolved
libs/common/RespWriteUtils.cs Show resolved Hide resolved
libs/resources/RespCommandsDocs.json Show resolved Hide resolved
libs/server/Resp/BasicCommands.cs Show resolved Hide resolved
libs/server/Resp/BasicEtagCommands.cs Show resolved Hide resolved
libs/server/Resp/BasicEtagCommands.cs Show resolved Hide resolved
libs/server/Resp/BasicEtagCommands.cs Show resolved Hide resolved
libs/server/Resp/BasicEtagCommands.cs Show resolved Hide resolved
@TalZaccai TalZaccai merged commit 9f90803 into microsoft:main Jan 11, 2025
18 checks passed
@hamdaankhalid hamdaankhalid deleted the hkhalid/etag-impl branch January 11, 2025 02:29
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.

5 participants