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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Fix/meta/full index #3177

wants to merge 3 commits into from

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 73.80952% with 77 lines in your changes missing coverage. Please review.

Project coverage is 23.35%. Comparing base (414d3e9) to head (a39907e).

Files with missing lines Patch % Lines
pkg/services/meta/containers.go 80.97% 28 Missing and 15 partials ⚠️
cmd/neofs-node/meta.go 0.00% 21 Missing ⚠️
pkg/services/meta/blocks.go 77.50% 6 Missing and 3 partials ⚠️
pkg/services/meta/meta.go 0.00% 2 Missing ⚠️
pkg/local_object_storage/metabase/version.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.13%   23.35%   +0.21%     
==========================================
  Files         760      760              
  Lines       60498    60708     +210     
==========================================
+ Hits        13999    14179     +180     
- Misses      45504    45517      +13     
- Partials      995     1012      +17     

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

@carpawell carpawell marked this pull request as ready for review February 26, 2025 14:41
l.Error("handling object notification", zap.Error(err))
continue
}
wg.Go(func() error {
Copy link
Member

Choose a reason for hiding this comment

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

Random order?

Copy link
Member Author

Choose a reason for hiding this comment

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

to me it is more like this: #3178
imo we should discuss it this way, otherwise order means nothing

@@ -44,71 +48,195 @@ func (s *containerStorage) drop() error {
return nil
}

func (s *containerStorage) putObject(e objEvent) error {
func (s *containerStorage) putObject(e objEvent, h objectsdk.Object) error {
Copy link
Member

Choose a reason for hiding this comment

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

This better be separated, you don't need h for the base index and it should operate in the same fashion. Then you can pass the changeset (in whatever fashion) to the other routine maintaining full index that will fetch things (potentially concurrently) and process them (likely more sequentially).

Copy link
Member Author

@carpawell carpawell Feb 26, 2025

Choose a reason for hiding this comment

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

what do you target? the whole meta service is a concurrent routine that does not block any operations. i do not know how to implement if i do not understand requirements

Copy link
Member

Choose a reason for hiding this comment

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

It can still be concurrent to the main index, there is zero contradiction here.

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?


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

// 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
Copy link
Contributor

Choose a reason for hiding this comment

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

objects are immutable so header cannot be other than actual

Copy link
Member Author

Choose a reason for hiding this comment

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

"actual" means exist/lost. it hightly relates this issue: #3140

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?

@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
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]>
@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

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