Repository navigation
Raise the CSV field limit, and set VERSION to 0.2.0 - #16
Merged
Merged
Conversation
Statistics values are now published as PostgreSQL computed them rather than as fixed-width digests, which made the csv module's default 128 KiB per-field cap reachable at ordinary settings. ANALYZE caps an individual value at about 1 KiB but collects statistics_target of them, so a wide text column with the default target of 100 lands near the cap and a raised target goes well past it. A run against such a column died with "field larger than field limit". Uses 2**31-1 rather than sys.maxsize: the limit is stored in a C long, which is 32 bits on 64-bit Windows, where sys.maxsize raises OverflowError. VERSION goes to 0.2.0 because the released 0.1.0 tag is taken and the bundle contract is now 2.0. Co-Authored-By: roachdev-claude <roachdev-claude-bot@cockroachlabs.com>
The UUID-shaped token tests were the only users, and they went with tokenization. ruff has been failing on main since. Co-Authored-By: roachdev-claude <roachdev-claude-bot@cockroachlabs.com>
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.
Summary
Two changes, both needed before a release can go out.
Raise the CSV field limit.
dbprofiler.pynever calledcsv.field_size_limit(), so it ran on the module default of 128 KiB per field. Now that statistics values are published as PostgreSQL computed them rather than as fixed-width digests, that cap is reachable at ordinary settings:ANALYZEcaps an individual value at about 1 KiB (WIDTH_THRESHOLD) but collectsstatistics_targetof them, so a widetextcolumn at the default target of 100 lands near the cap and a raised target goes past it.statistics_targetA run against such a column failed with
_csv.Error: field larger than field limit (131072). The bug was latent before and only reachable at extreme targets; publishing values verbatim moved it into normal use.Uses
2**31 - 1rather than the more commonsys.maxsize. The limit is stored in a Clong, which is 32 bits on 64-bit Windows, socsv.field_size_limit(sys.maxsize)raisesOverflowErrorthere. 2 GB is still ~200x the worst realistic field.Set
VERSIONto 0.2.0. The releasedv0.1.0tag is taken, and the release workflow refuses to build when the tag disagrees withVERSION. Minor rather than patch because the bundle contract is now2.0— payload set, column set, and field names all changed.Why this is urgent
The releases page still serves
v0.1.0, which is the tokenizing build and also carries this bug. Anyone following the install instructions in the README today gets it, and hits a prompt for aDBPROFILER_TOKEN_KEYenvironment variable that no longer exists in the project.Test plan
python3 -m unittest— 394 tests, OKpython3 dbprofiler.py --check-safety— OK (17 SQL constants checked)run_psql, one asserts the limit is raised to a value that fits a 32-bit longpython3 dbprofiler.py --versionreports0.2.0v0.2.0after merge so the releases page stops serving the tokenizing build