Repository navigation
fix(load): preserve sealed CSV fields on 4.2-dev - #32768
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
|
This pull request is merged. |
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: 795b906bee7f0a1aaf1a4d4e4b16d91f10766f4a
Assessment: approve
The guard preserves sealed-field bytes through the existing boundary owner without adding state or another decoding path. Exact-value tests cover row/header decoding, retained fields and ordinary CRLF controls. No actionable findings remain.
Model: gpt-6.1-sol / max
Session: 01a1a004-90c3-73b1-acc9-3d4636452003 · slot 0 · generation 0
Validation:
-
Reviewed the complete two-file delta, row/header/TrimLastSep/retention consumers, all three discussion entries and linked issue #30462.
-
Isolation preflight passed. The complete-parser differential probe passed 12 candidate scenarios, reproduced eight baseline slice-bounds failures and preserved four CRLF/error controls.
-
Frozen-source, patch, gofmt, whitespace, discussion coverage and execution-evidence audit passed.
-
Assessed author-reported full csvparser normal/race/vet, 4,176 differential combinations and private 4.2 LOAD checks.
Limitations:
-
The local probe replaces four external dependencies with documented standard-library scaffolding; native error codes and live SQL/file-service behavior were not exercised.
-
Author runtime logs were unavailable and six hosted checks remain pending. Linked main/MOTR results are contextual, not fresh 4.2 execution.
## What type of PR is this? - [ ] API-change - [ ] BUG - [x] Improvement - [ ] Documentation - [ ] Feature - [x] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Related to #32751. Port of main #32766. ## What this PR does / why we need it: CSV fragments spanning read blocks were assembled into a temporary growing buffer and then copied into the row buffer, repeating allocation even with a reusable row buffer. Append fragments directly into the caller-owned row/lookahead accumulator, retaining the single-block path. Adapt the change to 4.2's raw record bounds and memory reservation callbacks. Growth grants still precede appends, and rejected lookahead preserves the prior empty-fragment error result. Keep the existing conservative reservation envelope. Six alternating Linux/amd64 CPU benchmark samples with Go 1.26.4: - Reused plain 1 MiB / 8 MiB fields: 3,399,680 / 43,220,992 B/op -> 0; time improves about 44% / 55%. Four concurrent 1 MiB readers improve about 58%. - Tradeoff: serial small/wide CSV framing is about 3.6% / 3.5% slower (roughly 1 ns/field). Cold row capacity after an 8 MiB field is about 9.07 MiB versus 8 MiB (1 MiB: 1.20 versus 1 MiB). This targets large-value ingestion and does not make every workload better. - Parallel fixtures keep mutable row headers local to each goroutine. Corrected small-field concurrent controls do not establish a consistent regression; initial shared-header samples are superseded. Validation: full csvparser normal/race/vet, focused external admission/reset/typed-boundary normal/race controls, 4,176 baseline/head input/config/block comparisons, and final incremental lint (0 issues). CN RSS evidence is from sibling main #32766; this port has branch-specific component and consumer validation. The pre-existing sealed-CR panic found in baseline controls is addressed independently by #32768. Full hosted CI is pending. Maintained benchmarks cover cold/reused, small/wide/quoted/large inputs and independent concurrent readers.
What type of PR is this?
Which issue(s) this PR fixes:
Related to #30462; backport of main #30498.
What this PR does / why we need it:
The end-of-record CR strip can remove a byte from an already sealed CSV field. Its stored boundary then exceeds the row buffer and row/header decoding panics. Preserve sealed-field bytes by stripping CR only within the current open field. Genuine CRLF terminators retain their existing behavior.
Backport the producer-side guard from #30498 to 4.2-dev, with exact-value controls for row/header decoding, TrimLastSep, refill/reuse, unterminated quotes and 4.2 retained-field metadata.
Validation on Linux/amd64, CPU-only, Go 1.26.4:
Full hosted CI is pending. This PR is independent of the CSV allocation optimization.