Conversation
The changes to Modify() to not call merge() when the object did not exist are broken. It only called merge() for the primary index and the other indexes got the new object without merging it with the old one. Add a regression test to catch this issue and extend the quick tests to also check for this. Signed-off-by: Jussi Maki <jussi.maki@isovalent.com>
The change to not call merge() if the object did not exist was broken as merge() wasn't called for the object inserted into secondary indexes. Fix the issue by returning the merged new object from tableIndexTxn.modify and inserting that into the secondary indexes. Signed-off-by: Jussi Maki <jussi.maki@isovalent.com>
|
joamaki
added a commit
to joamaki/cilium
that referenced
this pull request
Feb 4, 2026
This fixes a regression in the Modify() method where the secondary indexes were updated with the new object without the result of the merge(). cilium/statedb#141. Signed-off-by: Jussi Maki <jussi@isovalent.com>
github-merge-queue bot
pushed a commit
to cilium/cilium
that referenced
this pull request
Feb 4, 2026
This fixes a regression in the Modify() method where the secondary indexes were updated with the new object without the result of the merge(). cilium/statedb#141. Signed-off-by: Jussi Maki <jussi@isovalent.com>
javiercardona-work
pushed a commit
to javiercardona-work/cilium
that referenced
this pull request
Mar 18, 2026
This fixes a regression in the Modify() method where the secondary indexes were updated with the new object without the result of the merge(). cilium/statedb#141. Signed-off-by: Jussi Maki <jussi@isovalent.com>
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.
The optimization to Modify() to not call
merge/modwhen object is not found in 55fa50d#diff-9735ccc98169ae36c8123697c6112cd96c0a8188ef495766455b752b8f1546b0 was broken (see below). Themergefunction was only called for the object inserted into the primary index and the secondary indexes used the object passed to the Modify() method.Add regression tests and fix the issue by using the new object constructed by
tableIndexTxn.modifyfor the secondary indexes.The diff that broke this:
Earlier we constructed a function closure that called the passed in
mergefunction if the old object was found. This updatedobj.datain-place and thus ensured that the secondary indexes got the right data. When refactoring the indexing to support LPM indexes I had simplified this and completely missed this. The tests were using pointers to objects (e.g.*testObject) which modified the object in-place inmergeand thus didn't catch this.