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

[FEAT] implements the ability in KV to request a specific revision for a key #302

Merged
merged 2 commits into from
May 17, 2022

Conversation

aricart
Copy link
Member

@aricart aricart commented May 16, 2022

FIX #301

@aricart aricart requested a review from kozlovic May 16, 2022 19:58
const sm = await this.jsm.streams.getMessage(this.bucketName(), {
last_by_subj: this.fullKeyName(ek),
});
const sm = await this.jsm.streams.getMessage(this.bucketName(), arg);
Copy link
Member

Choose a reason for hiding this comment

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

There is a nuance in the Go client: when asking for a revision (sequence number), it is possible that a message is found at that sequence, but that does not mean that it will match the subject (the key). So if you had "A"/seq 1, "B"/seq 2 and you ask Get("A", 2), a message will be returned by the low level "getMessage(2)", but that does not match the key/subject "A", so you should return "key not found" in that case.

await b.put("A", sc.encode("d"));
await check("d");
await check(null, 1);

Copy link
Member

Choose a reason for hiding this comment

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

Should extend the test to demonstrate the issue I was referring to. Do a "put("B", someValue)" and then a "get("A", rev==5)", and you should have a failure (and not whatever value was stored in "B").

…nce (new feature), that the key matched. If not, null is returned as the sequence is not referencing the expected key.

[FIX] conversion from stored message captured the key as provided by the client, and returned an entry with the said key.
@aricart aricart temporarily deployed to CI May 16, 2022 22:09 Inactive
Copy link
Member

@kozlovic kozlovic left a comment

Choose a reason for hiding this comment

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

LGTM!

@aricart aricart merged commit 3a48162 into main May 17, 2022
@aricart aricart deleted the fix-301 branch May 17, 2022 12:39
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.

KV get revision
2 participants