-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Prefix and LowerBound on non-unique indexes
Prefix and LowerBound searches did not properly deal with non-unique indexes. In these indexes the keys are encoded as <secondary><primary><secondary len>, and prefix searching needs to make sure the secondary key length on the results is equal or longer than the search key as otherwise we might match into the primary key. For example if the object is struct{A, B string}, with A being primary and we have {"a", "a"}, then the secondary index is key'd as "aa<1>". A prefix search with "aa" must not match since the secondary index contains only an object with key "a". Fix this by using a special iteration on non-unique indexes that checks the length of the secondary key and ignores any other matches that are due to matching into the primary key. Another issue with non-unique indexes was due to having no separator between the secondary and primary key, leading to the primary key having an effect on the iteration order. Fix this by adding '\0' as a separator and base64+sha256'ing the primary key. Signed-off-by: Jussi Maki <[email protected]>
- Loading branch information
Showing
8 changed files
with
190 additions
and
58 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.