CBL-6239: Fixed c4doc_getRevisionBody in a 2.x db w/version vectors #2136
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.
VectorRecord didn't properly manage the
body
column of a doc from a 2.x db that doesn't have theextra
column. In such a db the body is the encoded rev tree, not just the current rev. VectorRecord was returning that entire slice from its currentRevisionData method ... and since that wasn't valid Fleece data, getting the root Dict would fail.I added a new member
_bodyDocRange
, a slice that's just the current rev within the _bodyDoc. Normally it's the same as_bodyDoc.data()
, but in a 2.x doc it encompasses just the current rev body.Our db upgrade tests didn't catch this because they called
c4doc_getProperties
but notc4doc_getRevisionBody
. I remedied that (which reproduced the bug.)Fixes CBL-6239