-
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
Fix/meta/full index #3177
base: master
Are you sure you want to change the base?
Fix/meta/full index #3177
Conversation
cb36362
to
981f5cf
Compare
Codecov ReportAttention: Patch coverage is
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. |
pkg/services/meta/blocks.go
Outdated
l.Error("handling object notification", zap.Error(err)) | ||
continue | ||
} | ||
wg.Go(func() error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Random order?
There was a problem hiding this comment.
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
pkg/services/meta/containers.go
Outdated
@@ -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 { |
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
981f5cf
to
3299a41
Compare
3299a41
to
5088635
Compare
pkg/services/meta/blocks.go
Outdated
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) |
There was a problem hiding this comment.
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()
There was a problem hiding this comment.
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
pkg/services/meta/containers.go
Outdated
s.m.Lock() | ||
defer s.m.Unlock() | ||
|
||
newKVs := make(map[string][]byte) | ||
dbKVs := make(map[string][]byte) | ||
mptKVs := make(map[string][]byte) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
pkg/services/meta/containers.go
Outdated
commonKVs[string(append([]byte{0, deletedIndex}, commsuffix...))] = e.deletedObjects | ||
clearMpt, clearDB := deleteObjectsOps(s.db, e.deletedObjects) | ||
maps.Copy(mptKVs, clearMpt) | ||
maps.Copy(dbKVs, clearDB) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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") |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
cmd/neofs-node/meta.go
Outdated
|
||
var hPrm getsvc.HeadPrm | ||
hPrm.SetHeaderWriter(&hw) | ||
hPrm.WithAddress(addr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hPrm.WithAddress(addr) | |
hPrm.WithAddress(oid.NewAddress(cID, oID)) |
pkg/services/meta/containers.go
Outdated
|
||
resDB[string(keyToDrop)] = nil | ||
|
||
if vInt, isInt := parseInt(string(attrV)); isInt { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
again can panic
pkg/services/meta/containers.go
Outdated
keyToDrop = append(keyToDrop, attrToIntIndex) | ||
keyToDrop = append(keyToDrop, attributeDelimiter...) | ||
keyToDrop = keyToDrop[:len(keyToDrop)+intValLen] | ||
putBigInt(keyToDrop, vInt) |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
pkg/services/meta/notifications.go
Outdated
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) |
There was a problem hiding this comment.
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
return fmt.Errorf("HEAD rpc error: %w", err) | |
return fmt.Errorf("HEAD object: %w", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well, changed but why?
9943362
to
f7ebf89
Compare
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]>
Refs #3139. Signed-off-by: Pavel Karpy <[email protected]>
5d22263
to
a39907e
Compare
No description provided.