Skip to content

Fix set payload by key on non appendable segment - #5113

Merged
agourlay merged 1 commit into
devfrom
fix-set-payload-non-appendable-segment
Sep 23, 2024
Merged

agourlay merged 1 commit into
devfrom
fix-set-payload-non-appendable-segment

Conversation

@agourlay

@agourlay agourlay commented Sep 20, 2024 •

Copy link
Copy Markdown
Member

fixes: qdrant/qdrant-client#780

The bug affects set payload operation using key on non appendable segments.

It manifest itself by the apparition of unexpected payload values at the root level, which are supposed to be added under key.

The bug was introduced in 1.11.1 with https://github.com/qdrant/qdrant/pull/4855/files#diff-fe6fcf41822e7bcc71c22cfb9067f6e80e36228f69d2727724e4cc51abc12e07R193

The fix is to merge the payloads using the key.

I have tested the fix on a user snapshot file.

chunk,
|id, write_segment| write_segment.set_payload(op_num, id, payload, key),
|_, _, old_payload| old_payload.merge(payload),
|_, _, old_payload| match key {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the fix

Comment thread lib/segment/src/types.rs
}

pub fn merge_by_key(&mut self, value: &Payload, key: &JsonPath) -> OperationResult<()> {
pub fn merge_by_key(&mut self, value: &Payload, key: &JsonPath) {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removing the unnecessary Result type to align with the expected closure

@agourlay
agourlay marked this pull request as ready for review September 20, 2024 20:20

@JojiiOfficial JojiiOfficial left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for that one. Missed the separate merge_by_key function.

@agourlay
agourlay merged commit 89336e6 into dev Sep 23, 2024
@agourlay
agourlay deleted the fix-set-payload-non-appendable-segment branch September 23, 2024 09:59
@agourlay

Copy link
Copy Markdown
Member Author

Merging the fix to expedite the release.

I will work on a unit test to enforce non regression in a different PR 📝

@agourlay

Copy link
Copy Markdown
Member Author

Important information, the bug is present only when there is an indexed on the target payload key.
This is make it a bit less widespread I guess.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants