Skip to content
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

Build full searchv2-compatible index from chained meta #3139

Open
roman-khimov opened this issue Feb 16, 2025 · 4 comments
Open

Build full searchv2-compatible index from chained meta #3139

roman-khimov opened this issue Feb 16, 2025 · 4 comments
Assignees
Labels
enhancement Improving existing functionality I2 Regular impact neofs-storage Storage node application issues S2 Regular significance U2 Seriously planned

Comments

@roman-khimov
Copy link
Member

No description provided.

@roman-khimov roman-khimov added enhancement Improving existing functionality I2 Regular impact neofs-storage Storage node application issues S2 Regular significance U2 Seriously planned labels Feb 16, 2025
@carpawell carpawell self-assigned this Feb 20, 2025
@carpawell
Copy link
Member

@roman-khimov, got some problem: metaservice was done to follow initial requirements to be based on a true KV DB from neo-go's repo (#3070, "forget about buckets, use prefixes for everything"). Does not mean neo-go is the reason, it just was meant to be based on a simple KV. Current metabase implementation uses buckets:

metaBkt, err := tx.CreateBucketIfNotExists(metaBucketKey(cnr))
if err != nil {
return fmt.Errorf("create meta bucket for container: %w", err)
}
idk := [1 + oid.Size]byte{metaPrefixID}
copy(idk[1:], id[:])
if err := metaBkt.Put(idk[:], nil); err != nil {
return fmt.Errorf("put object ID to container's meta bucket: %w", err)
}
var keyBuf keyBuffer
if err = putPlainAttribute(metaBkt, &keyBuf, id, object.FilterVersion, ver.String()); err != nil {
return err
}
if err = putPlainAttribute(metaBkt, &keyBuf, id, object.FilterOwnerID, string(owner[:])); err != nil {
return err
}
if err = putPlainAttribute(metaBkt, &keyBuf, id, object.FilterType, typ.String()); err != nil {
return err
}
if err = putIntAttribute(metaBkt, &keyBuf, id, object.FilterCreationEpoch, strconv.FormatUint(creationEpoch, 10), new(big.Int).SetUint64(creationEpoch)); err != nil {
return err
}
if err = putIntAttribute(metaBkt, &keyBuf, id, object.FilterPayloadSize, strconv.FormatUint(payloadLen, 10), new(big.Int).SetUint64(payloadLen)); err != nil {
return err
}
if err = putPlainAttribute(metaBkt, &keyBuf, id, object.FilterPayloadChecksum, string(pldHash)); err != nil {
return err
}
if err = putPlainAttribute(metaBkt, &keyBuf, id, object.FilterPayloadHomomorphicHash, string(pldHmmHash)); err != nil {
return err
}
if len(splitID) > 0 {
if err = putPlainAttribute(metaBkt, &keyBuf, id, object.FilterSplitID, string(splitID)); err != nil {
return err
}
}
if !firstID.IsZero() {
if err = putPlainAttribute(metaBkt, &keyBuf, id, object.FilterFirstSplitObject, string(firstID[:])); err != nil {
return err
}
}
if !parentID.IsZero() {
if err = putPlainAttribute(metaBkt, &keyBuf, id, object.FilterParentID, string(parentID[:])); err != nil {
return err
}
}
if root {
if err = putPlainAttribute(metaBkt, &keyBuf, id, object.FilterRoot, binPropMarker); err != nil {
return err
}
}
if phy {
if err = putPlainAttribute(metaBkt, &keyBuf, id, object.FilterPhysical, binPropMarker); err != nil {
return err
}
}
for i := range attrs {
ak, av := attrs[i].Key(), attrs[i].Value()
if n, isInt := parseInt(av); isInt && intWithinLimits(n) {
err = putIntAttribute(metaBkt, &keyBuf, id, ak, av, n)
} else {
err = putPlainAttribute(metaBkt, &keyBuf, id, ak, av)
}
if err != nil {
return err
}
}
. Can you explain how "full searchv2-compatible" should both structures be?

@roman-khimov
Copy link
Member Author

SV2 operates on a well-known DB structure. As long as you can make the same structure (even if there is an additional prefix added, this can be handled, but better without it) --- you're OK. Buckets are totally irrelevant here.

@carpawell
Copy link
Member

So "structure" is a general term? It does not need to be handled by the same code and implementation may vary, yes?

@roman-khimov
Copy link
Member Author

The more code you can reuse the better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improving existing functionality I2 Regular impact neofs-storage Storage node application issues S2 Regular significance U2 Seriously planned
Projects
None yet
Development

No branches or pull requests

2 participants