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

Fix/meta/full index #3177

Merged
merged 4 commits into from
Mar 7, 2025
Merged

Fix/meta/full index #3177

merged 4 commits into from
Mar 7, 2025

Conversation

carpawell
Copy link
Member

No description provided.

@carpawell carpawell self-assigned this Feb 26, 2025
Copy link

codecov bot commented Feb 26, 2025

Codecov Report

Attention: Patch coverage is 68.60465% with 108 lines in your changes missing coverage. Please review.

Project coverage is 23.42%. Comparing base (ea6b99c) to head (1c2d1a6).
Report is 5 commits behind head on master.

Files with missing lines Patch % Lines
pkg/services/meta/containers.go 80.08% 31 Missing and 15 partials ⚠️
pkg/core/object/metadata.go 0.00% 22 Missing ⚠️
cmd/neofs-node/meta.go 0.00% 21 Missing ⚠️
pkg/services/meta/blocks.go 77.50% 6 Missing and 3 partials ⚠️
pkg/local_object_storage/metabase/metadata.go 85.00% 2 Missing and 1 partial ⚠️
pkg/local_object_storage/metabase/version.go 25.00% 0 Missing and 3 partials ⚠️
pkg/services/meta/meta.go 0.00% 2 Missing ⚠️
pkg/local_object_storage/metabase/put.go 50.00% 0 Missing and 1 partial ⚠️
pkg/services/meta/notifications.go 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3177      +/-   ##
==========================================
+ Coverage   23.22%   23.42%   +0.20%     
==========================================
  Files         760      760              
  Lines       60633    60848     +215     
==========================================
+ Hits        14080    14254     +174     
- Misses      45558    45587      +29     
- Partials      995     1007      +12     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@carpawell carpawell marked this pull request as ready for review February 26, 2025 14:41
wg.Go(func() error {
err := m.handleObjectNotification(ctx, s, ev)
if err != nil {
return fmt.Errorf("handling %s/%s object notification: %w", ev.cID, ev.oID, err)
Copy link
Contributor

Choose a reason for hiding this comment

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

previously we logged all errors, now only the earliest one. I tink they all deserve attention, so suggest to keep logging here, and ignore on Wait()

Copy link
Member Author

@carpawell carpawell Feb 27, 2025

Choose a reason for hiding this comment

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

will fix depening of what we will decide with @roman-khimov about object handing order in the thread above

s.m.Lock()
defer s.m.Unlock()

newKVs := make(map[string][]byte)
dbKVs := make(map[string][]byte)
mptKVs := make(map[string][]byte)
Copy link
Contributor

Choose a reason for hiding this comment

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

we can add its els directly to s.opsBatch, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

we can but dbKVs and commonKVs are still required so imo it is ok to keep them the same. this map should be like ~10 fields long, i do not thinks it even escaped. also it consists of string which made this change almost useless

but ok

commonKVs[string(append([]byte{0, deletedIndex}, commsuffix...))] = e.deletedObjects
clearMpt, clearDB := deleteObjectsOps(s.db, e.deletedObjects)
maps.Copy(mptKVs, clearMpt)
maps.Copy(dbKVs, clearDB)
Copy link
Contributor

Choose a reason for hiding this comment

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

these maps can be accepted and set by deleteObjectsOps so we dont need to copy them

Copy link
Member Author

Choose a reason for hiding this comment

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

makes sence with latest changes

phy := hasParent || (fPart.IsZero() && parID.IsZero())
pldHash, ok := h.PayloadChecksum()
if !ok {
return errors.New("missing payload checksum")
Copy link
Contributor

Choose a reason for hiding this comment

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

i'd handle all error cases on the func top

Copy link
Member Author

Choose a reason for hiding this comment

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

get object's fields in a sep func to pass many args to this func? how it helps?

Copy link
Contributor

Choose a reason for hiding this comment

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

it's a common practice to check for return errors first in a function. I dont suggest to change its signature

Copy link
Member Author

Choose a reason for hiding this comment

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

i was inspired by your func, it was ctrl-c ctrl-v. ok, reused your new verification func


var hPrm getsvc.HeadPrm
hPrm.SetHeaderWriter(&hw)
hPrm.WithAddress(addr)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
hPrm.WithAddress(addr)
hPrm.WithAddress(oid.NewAddress(cID, oID))


resDB[string(keyToDrop)] = nil

if vInt, isInt := parseInt(string(attrV)); isInt {
Copy link
Contributor

Choose a reason for hiding this comment

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

again can panic

keyToDrop = append(keyToDrop, attrToIntIndex)
keyToDrop = append(keyToDrop, attributeDelimiter...)
keyToDrop = keyToDrop[:len(keyToDrop)+intValLen]
putBigInt(keyToDrop, vInt)
Copy link
Contributor

Choose a reason for hiding this comment

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

wrong place to put

// List returns node's containers that support chain-based meta data and
// any error that does not allow listing.
List() (map[cid.ID]struct{}, error)
// IsMineWithMeta checks if the given CID has meta enabled and current
// node belongs to it.
IsMineWithMeta(cid.ID) (bool, error)
// Head returns actual object header from the NeoFS network (non-local
// objects should also be returned). Missing, removed object statuses
// must be reported according to API statuses from SDK.
Copy link
Contributor

Choose a reason for hiding this comment

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

this statement is not needed actually, Meta does not care what error is returned

Copy link
Member Author

@carpawell carpawell Feb 27, 2025

Choose a reason for hiding this comment

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

whay do you mean? an object can be removed, not found, etc. i can imagine future status logic based on response

Copy link
Contributor

Choose a reason for hiding this comment

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

imaginary logic makes the interface heavier without any practical benefit

Copy link
Member Author

Choose a reason for hiding this comment

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

we do need to have a reaction on missing objects, it is already planned logic, not imaginary

err := s.putObject(e)
h, err := m.net.Head(ctx, e.cID, e.oID)
if err != nil {
return fmt.Errorf("HEAD rpc error: %w", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

there is no guarantee that the RPC has been actually done - some preliminary errors are possible, or only local execution. Simply

Suggested change
return fmt.Errorf("HEAD rpc error: %w", err)
return fmt.Errorf("HEAD object: %w", err)

Copy link
Member Author

Choose a reason for hiding this comment

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

well, changed but why?

Copy link
Contributor

Choose a reason for hiding this comment

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

RPC is a remote communication, here we dont always go to remote

@carpawell carpawell force-pushed the fix/meta/full-index branch 2 times, most recently from 9943362 to f7ebf89 Compare February 27, 2025 14:49
@carpawell carpawell marked this pull request as draft February 27, 2025 17:09
@carpawell carpawell requested a review from cthulhu-rider March 1, 2025 01:46
@carpawell carpawell marked this pull request as ready for review March 1, 2025 01:46
@carpawell
Copy link
Member Author

@carpawell carpawell force-pushed the fix/meta/full-index branch from a39907e to 82a66e1 Compare March 4, 2025 11:30
putIntAttribute(batch, id, objectsdk.FilterCreationEpoch, strconv.FormatUint(creationEpoch, 10), new(big.Int).SetUint64(creationEpoch))
putIntAttribute(batch, id, objectsdk.FilterPayloadSize, strconv.FormatUint(pSize, 10), new(big.Int).SetUint64(pSize))
putPlainAttribute(batch, id, objectsdk.FilterPayloadChecksum, string(pldHash.Value()))
putPlainAttribute(batch, id, objectsdk.FilterPayloadHomomorphicHash, string(pldHmmHash))
Copy link
Member

Choose a reason for hiding this comment

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

In many cases that can be a no-op (conversion) in compiled code.

case oidToAttrIndex:
i := bytes.Index(k, attributeDelimiter)
if i < 0 {
panic(fmt.Errorf("unexpected attribute index without delimeter: %s", string(k)))
Copy link
Member

Choose a reason for hiding this comment

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

panic is DOS. We can complain (loudly with "your DB is broken"), but we better keep going.

@carpawell carpawell force-pushed the fix/meta/full-index branch from 82a66e1 to 6652296 Compare March 5, 2025 15:37
@carpawell carpawell requested a review from roman-khimov March 5, 2025 15:42
@carpawell carpawell force-pushed the fix/meta/full-index branch 3 times, most recently from fcf8422 to e9642ae Compare March 6, 2025 09:49
@roman-khimov
Copy link
Member

Conflicts.

@carpawell carpawell force-pushed the fix/meta/full-index branch from e9642ae to a6fc57d Compare March 7, 2025 08:42
Make underlying KV database store the same index structure as in the new
metabase structure for search V2. Exclude repetitive fields from the database in
the old MPT form. Receive object headers via internal object get (head) service.
Closes #3139.

Signed-off-by: Pavel Karpy <[email protected]>
This functionality will be shared for some time meta-service feature is being
developed. Refs #3139.

Signed-off-by: Pavel Karpy <[email protected]>
It is the same for metabase and metaservice. Index delimiter was also moved.

Signed-off-by: Pavel Karpy <[email protected]>
@carpawell carpawell force-pushed the fix/meta/full-index branch from a6fc57d to 1c2d1a6 Compare March 7, 2025 09:02
@roman-khimov roman-khimov merged commit 5a9e733 into master Mar 7, 2025
19 of 22 checks passed
@roman-khimov roman-khimov deleted the fix/meta/full-index branch March 7, 2025 09:37
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