MB-62427: seeking the pointer correctly while reading segmentBase data #252
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.
v16 file format introduced the concept of sections in which as part of metadata the
fieldsIndex
part was replaced by asectionsIndex
which serves the same purpose offieldsIndex
of pointing to a file offset where the actual data of field's section is stored.The PR tries to resolve the situation - where there was only one field's data being written out while creating the in-memory
segmentBase
and the process was crashing while initializing the fields related information in the loadFieldsNew() API atzapx/segment.go
Line 323 in 0c7027f
The reason for the crash is while writing out the data, because there is only one field metadata being written out at the very end of the buffer
zapx/write.go
Line 89 in 0c7027f
zapx/segment.go
Line 323 in 0c7027f
The solution proposed here is to guard this kind of access by keeping in mind the length of the backing buffer like how it was done in v15
zapx/segment.go
Line 268 in a72794c