Repository navigation
Correct two Deno KV limits: total key size and default list batch size - #3558
Open
basartuncay wants to merge 1 commit into
Open
basartuncay wants to merge 1 commit into
basartuncay wants to merge 1 commit into
Conversation
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two numbers on the Deno KV pages do not match what Deno does. I ran into them while writing a compatibility layer that mirrors Deno KV's limits.
1. Max total size of keys in an atomic operation (
deploy/kv/transactions.md)The page says 90 KiB and that it includes keys in checks. Deno enforces 80 KiB (81,920 bytes), and only for mutations that write a value:
MAX_TOTAL_KEY_SIZE_BYTES = 80 * 1024inext/kv/config.rsext/kv/lib.rs,total_key_sizeis only increased in the loop over mutations that have a value; keys of checks and deletes are added tototal_payload_sizeonlytests/unit/kv_test.tsexpectsTotal key size too large (max 81920 bytes)2. Default batch size of
kv.list()(deploy/kv/operations.md)The page says 500. In
ext/kv/01_db.tsit isoptions.batchSize ?? (options.limit ?? 100), capped at 500 only whenbatchSizewas not passed. So the default is 100, or thelimitwhen one is set, up to 500.Checked on Deno 2.9.8 (
deno run --unstable-kv,Deno.openKv(":memory:"), keys of about 2,000 bytes):set(about 80,000 bytes of keys)setTotal key size too large (max 81920 bytes)sumTotal key size too large (max 81920 bytes)deletecheckplus one smallsetNot checked: the hosted Deno Deploy KV backend. If its key limit really is 90 KiB, I am happy to change the sentence so it names both values.
Both pages get a new
last_modified, anddeno fmtwas run on them.A note on a related spot, not changed here: the
batchSizeJSDoc inlib.deno.unstable.d.tssays larger values are clamped to 500, while an explicitbatchSize: 1000works and1001throwsToo many entries (max 1000). I can send that todenoland/denoseparately if it is wanted.Disclosure: this change was prepared with AI assistance (Claude Code); the behaviour above was run and read before opening the pull request.
🤖 Generated with Claude Code