-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SearchV2 merger does not preserve meta DB ordering for some system attributes #3160
Comments
Test cursors deeper. Deduplicate a lot of code also. Refs #3160. Refs #3058. Signed-off-by: Leonard Lyubich <[email protected]>
Test cursors deeper. Many tests fail revealing implementation bugs, mainly ordering. Fixes coming soon. This deduplicates a lot of code also. Refs #3160. Refs #3058. Signed-off-by: Leonard Lyubich <[email protected]>
Test cursors deeper. Many tests fail revealing implementation bugs, mainly ordering. Fixes coming soon. This deduplicates a lot of code also. Refs #3160. Refs #3058. Signed-off-by: Leonard Lyubich <[email protected]>
Test cursors deeper. Many tests fail revealing implementation bugs, mainly ordering. Fixes coming soon. This deduplicates a lot of code also. Refs #3160. Refs #3058. Signed-off-by: Leonard Lyubich <[email protected]>
Test cursors deeper. Many tests fail revealing implementation bugs, mainly ordering. Fixes coming soon. This deduplicates a lot of code also. Refs #3160. Refs #3058. Signed-off-by: Leonard Lyubich <[email protected]>
Test cursors deeper. Many tests fail revealing implementation bugs, mainly ordering. Fixes coming soon. This deduplicates a lot of code also. Refs #3160. Refs #3058. Signed-off-by: Leonard Lyubich <[email protected]>
payload SHA-256 and TZ hashes are HEX strings, so the order is preserved ive got following results for others func checkOrder[T fmt.Stringer](name string, rnd func() T, cmp func(a, b T) int) {
s := make([]T, 1000000)
for i := range s {
s[i] = rnd()
}
slices.SortFunc(s, cmp)
ss := make([]string, len(s))
for i := range s {
ss[i] = s[i].String()
}
fmt.Println(name, "order kept:", slices.IsSorted(ss))
}
func TestOrder(t *testing.T) {
checkOrder("OID", oidtest.ID, func(a, b oid.ID) int { return bytes.Compare(a[:], b[:]) })
checkOrder("User", usertest.ID, func(a, b user.ID) int { return bytes.Compare(a[:], b[:]) })
checkOrder("UUID", uuid.New, func(a, b uuid.UUID) int { return bytes.Compare(a[:], b[:]) })
} UUIDs (split ID) are HEX-encoded, too, so OK. OIDs are expectedly broken the one that surprises me a bit is user ID: it's base58btc-encoded as well as OID, but order is kept. Mb the fact that it has fixed prefix affect smth, but i wouldnt rely on this for now. At the same time, in practice I couldnt find two user IDs with disorder |
meta DB stores and cmps following attributes as plain bytes:
on match, they go to the result in protocol string fmt. On merge multiple results from several sources (shards, nodes), merge func cmps them lexicographically. If string fmt does not preserve byte order, the order can break on merge
Expected Behavior
keep order returned from the meta DBs
Current Behavior
the order can break
Possible Solution
Context
The text was updated successfully, but these errors were encountered: