-
Notifications
You must be signed in to change notification settings - Fork 39
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
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.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. 🚀 New features to boost your workflow:
|
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
pkg/services/meta/containers.go
Outdated
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?
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's a common practice to check for return errors first in a function. I dont suggest to change its signature
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 was inspired by your func, it was ctrl-c ctrl-v. ok, reused your new verification func
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
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.
imaginary logic makes the interface heavier without any practical benefit
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 do need to have a reaction on missing objects, it is already planned logic, not imaginary
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?
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.
RPC is a remote communication, here we dont always go to remote
9943362
to
f7ebf89
Compare
5d22263
to
a39907e
Compare
a39907e
to
82a66e1
Compare
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)) |
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.
In many cases that can be a no-op (conversion) in compiled code.
pkg/services/meta/containers.go
Outdated
case oidToAttrIndex: | ||
i := bytes.Index(k, attributeDelimiter) | ||
if i < 0 { | ||
panic(fmt.Errorf("unexpected attribute index without delimeter: %s", string(k))) |
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.
panic is DOS. We can complain (loudly with "your DB is broken"), but we better keep going.
82a66e1
to
6652296
Compare
fcf8422
to
e9642ae
Compare
Conflicts. |
e9642ae
to
a6fc57d
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]>
It is the same for metabase and metaservice. Index delimiter was also moved. Signed-off-by: Pavel Karpy <[email protected]>
a6fc57d
to
1c2d1a6
Compare
No description provided.