Repository navigation
Conversation
A serialized chunk header embeds the measurement/column name verbatim, so a column/measurement name of about 1018 characters or more makes the header longer than the fixed 1024-byte window used by ChunkReader::load_by_meta(), AlignedChunkReader::load_by_aligned_meta() and AlignedChunkReader::load_by_aligned_meta_multi(). Reading the header then hit read_var_str()'s "length beyond the stream" check, which surfaces E_PARTIAL_READ: the write succeeded but the first read of that column failed. Add reader/read_chunk_header.h: it reads and deserializes a chunk header at an offset, doubling the read window while deserialization reports that more bytes are needed, capped at 1 MiB and at the end of the file. Use it in both chunk readers and in the recovery self-check (parse_chunk_header_and_skip()) as well, which previously mistook such a chunk for a corrupt tail and truncated the recovered file at it. Callers wrap the returned buffer and advance their stream past header.serialized_size_ to the first page header. Recovery hardening: an allocation failure (E_OOM) during the recovery scan now fails recovery instead of being treated as a corrupt tail, and the in-progress device id is released on that path so LeakSanitizer stays clean. No on-disk format or writer change: names that could already be written are now readable again, matching Java, which has no name length limit. Tests: new LongMeasurementNameTest writes and reads back 1017/1018/1024/4096 character names for table FIELD and TAG columns and tree measurements; new restorable-writer cases recover and append after a 4096-character name and inject an OOM during the self-check. The FIELD, tree and recovery cases fail below the boundary without this fix; the TAG case is coverage only, since tag values come from the device id rather than a value chunk. Known limitations left for a separate change: chunk-group headers in the recovery self-check still use a fixed 4096-byte window, and a chunk header larger than the 1 MiB cap can be written but not read or recovered.
ColinLeeo
force-pushed
the
colin/fix-long-column-name-read
branch
from
December 1, 2026 03:00
1185d0d to
318ad87
Compare
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
A table-model column name of 1018 or more characters made the write succeed but the read return
E_PARTIAL_READ, i.e. a file that is silently unreadable.Root cause
The chunk header embeds the measurement name. The reader parsed chunk headers through a fixed 1024-byte window. For a header of
chunk_type(1) + varint len(2) + name + data_size varint(1) + 3 bytes, a name of 1017 bytes fits in 1024, while 1018 bytes needs 1025 —read_var_strthen returnedE_PARTIAL_READbecause the chunk-header path had no grow-and-retry window (chunk/page header reads did).Changes
ChunkReader, the aligned single-value/multi-value chunk readers, and the restorable recovery scan; keepsE_PARTIAL_READsemantics for truncated data and the same cursor/offset behavior.E_OOMinstead of treating it as a corrupt tail and truncating a valid file; release the in-progress device id on that path.Verification
Review
Self-reviewed, then an independent read-only review; the delta review concluded "mergeable". The change also incorporates the review hardening (bounded read window, OOM recovery) and the OOM cleanup found by LeakSanitizer.