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

If a JSON document contains strings that can't fit in a single chunk, use the naive Blob chunker instead of the smart JSON chunker. #8723

Merged
merged 15 commits into from
Jan 9, 2025

Conversation

nicktobey
Copy link
Contributor

@nicktobey nicktobey commented Jan 8, 2025

The JSON chunker never creates a chunk boundary inside of a string.

Originally, this PR added functionality to allow the JSON chunker to split JSON document inside a string. This was supposed to be safe and backwards compatible, because older versions of Dolt reading documents written by newer versions of Dolt are supposed to fall back on ignoring JSON document metadata if they don't understand it and treat the document like a blob.

However, tests revealed that older clients were not checking for this in enough places and would hang when trying to read documents written with this fix. This PR also contains fixes to check the JSON metadata in more places... but this doesn't do anything for existing Dolt servers running older versions.

So instead, this PR detects when a document contains strings that exceed some limit, and instead the writer falls back on writing the document as a plain blob without metadata. The limit is currently 32KB, but can be raised in the future.

I chose to keep the logic for splitting JSON documents inside a string, although the chunker doesn't currently use it, since we may decide to enable it in the future.

@coffeegoddd
Copy link
Contributor

@nicktobey DOLT

comparing_percentages
100.000000 to 100.000000
version result total
7dd4cd0 ok 5937457
version total_tests
7dd4cd0 5937457
correctness_percentage
100.0

@nicktobey nicktobey changed the title Allow JSON chunker to chunk in the middle of a large string literal. If a JSON document contains strings that can't fit in a single chunk, use the naive Blob chunker instead of the smart JSON chunker. Jan 9, 2025
Copy link
Contributor

@fulghum fulghum left a comment

Choose a reason for hiding this comment

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

Code changes look good. Once you're able to push that fix for the tests and get them passing, this should be good to merge.

integration-tests/compatibility/test_files/setup_repo.sh Outdated Show resolved Hide resolved
@coffeegoddd
Copy link
Contributor

@nicktobey DOLT

comparing_percentages
100.000000 to 100.000000
version result total
fb31064 ok 5937457
version total_tests
fb31064 5937457
correctness_percentage
100.0

@nicktobey nicktobey merged commit b28cb54 into main Jan 9, 2025
21 checks passed
@nicktobey nicktobey deleted the nicktobey/json-big branch January 9, 2025 04:46
@coffeegoddd
Copy link
Contributor

@nicktobey DOLT

comparing_percentages
100.000000 to 100.000000
version result total
5429156 ok 5937457
version total_tests
5429156 5937457
correctness_percentage
100.0

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

Successfully merging this pull request may close these issues.

3 participants