-
Notifications
You must be signed in to change notification settings - Fork 38
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
Feat/add big objects support for meta on chain #3063
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3063 +/- ##
==========================================
- Coverage 22.36% 21.96% -0.40%
==========================================
Files 793 797 +4
Lines 58713 59852 +1139
==========================================
+ Hits 13130 13149 +19
- Misses 44682 45800 +1118
- Partials 901 903 +2 ☔ View full report in Codecov by Sentry. |
Follows nspcc-dev/neofs-node#3063. Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Follows nspcc-dev/neofs-node#3063. Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Follows nspcc-dev/neofs-node#3063. Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Follows nspcc-dev/neofs-node#3063. Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
@@ -206,6 +206,12 @@ func objectFromMessage(gMsg *objectGRPC.Object) (*object.Object, error) { | |||
} | |||
|
|||
func (s *Server) metaInfoSignature(o object.Object) ([]byte, error) { | |||
firstObj, _ := o.FirstID() | |||
if firstObj.IsZero() && o.HasParent() && o.SplitID() == nil { |
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.
last operand is inobvious to me. How about create a helper func for this? U check this condition twice here
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 differs split V1. in the engine it is required to be possible handle both schemes. in fact, it should be impossible to meet it here, since meta-on-chain containers are new containers, so not V1 is expected but still i would like to see this check
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.
check is OK, i just suggest to share and doc it. Again, if i'd need to check whether object is first or not, i'd miss split ID check
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 miss split ID check
as i said, this check is the only thing that differs v1 from v2. but if a drop code is requested i usually support it, dropped
pkg/core/object/replicate.go
Outdated
@@ -38,14 +38,46 @@ const ( | |||
// "validuntil": last valid block number for meta information | |||
// | |||
// Last valid epoch is object's creation epoch + 10. | |||
func EncodeReplicationMetaInfo(cID cid.ID, oID, firstPart oid.ID, pSize uint64, | |||
deleted, locked []oid.ID, vub uint64, magicNumber uint32) []byte { | |||
func EncodeReplicationMetaInfo(o object.Object, vub uint64, magicNumber uint32) ([]byte, 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.
callers aint happy about this change. One was completely okay w/o an error, while the second forced to do multiple decoding. If u wanna decrease prm num, typedef a structure
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.
typedef a structure
object.Object is such a struct, why not?
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.
object has no deleted, locked []oid.ID
fields
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.
object has no deleted, locked []oid.ID fields
yes, but object.Object
is enough to get this information and it will be always gotten like this
this commit was already dropped anyway
if err != nil { | ||
return nil, fmt.Errorf("encoding metadata") | ||
} | ||
secondMeta, _ := objectcore.EncodeReplicationMetaInfo(o, secondBlock, s.mNumber) |
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.
one more proof of the refactoring dubiousness
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 is just a context of this func: you need to repeat the same encoding 3 times, error happens for all or does not happen at all
ok, it is easier to drop this commit
pkg/core/object/replicate.go
Outdated
deleted, locked []oid.ID, vub uint64, magicNumber uint32) []byte { | ||
kvs := []stackitem.MapElement{ | ||
kv(networkMagicKey, magicNumber), | ||
kv(cidKey, cID[:]), | ||
kv(oidKey, oID[:]), | ||
kv(firstPartKey, firstPart[:]), |
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 dont suggest to push missing firstPart
as zero ID, it's a reserved invalid value. Push emptiness instead: this will match the zero length condition from ur contract change nspcc-dev/neofs-contract@416936f
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.
added optional fields support. firstPart
is now one of them
Not sure what made me go this way, there is no reason for it. Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
3a07bdd
to
0265840
Compare
Should have been done in ae6e37d. Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
0265840
to
983b38b
Compare
Follows nspcc-dev/neofs-node#3063. Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Follows nspcc-dev/neofs-node#3063. Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
// "validUntil": last valid block number for meta information | ||
// "network": network magic |
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.
Better keep them alphabetically sorted (in optional/non-optional groups).
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 optional/non-optional groups)
👍
alphabetically sorted
👎. Excessive load to the dev brain "where to place new key?". And i like how they are grouped by type currently
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.
Better keep them alphabetically sorted
well, my suggestion is not a random order, it was an intention. i grouped it like "logically" or as @cthulhu-rider said, currently, it is by type too. do you have any pros as to why it is better to sort them? new value will be harder to add, and alphabet sorting has no advantages (or change my mind)
@@ -59,6 +62,9 @@ func EncodeReplicationMetaInfo(cID cid.ID, oID, firstPart, previousPart oid.ID, | |||
if len(locked) > 0 { | |||
kvs = append(kvs, oidsKV(lockedKey, locked)) | |||
} | |||
if typ != objectsdk.TypeRegular { | |||
kvs = append(kvs, kv(typeKey, uint32(typ))) |
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.
Notice that tombstone/lock can be detected by deleted/locked already. But this covers more things, so OK.
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.
you mean lock type with some non-empy deleted
should be an error (panic in fact) in this func?
validUntilKey = "validUntil" | ||
networkMagicKey = "network" |
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.
motivated movement?
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.
the same as in #3063 (comment)
ok-ok, waste of time, more code to review, etc. but i feel better this way
// "validUntil": last valid block number for meta information | ||
// "network": network magic |
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 optional/non-optional groups)
👍
alphabetically sorted
👎. Excessive load to the dev brain "where to place new key?". And i like how they are grouped by type currently
kv(networkMagicKey, magicNumber), | ||
} | ||
|
||
if len(deleted) > 0 { |
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 split unit tests into min
and full
cases. And include fields added in the following commits
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.
done
@@ -59,6 +62,9 @@ func EncodeReplicationMetaInfo(cID cid.ID, oID, firstPart, previousPart oid.ID, | |||
if len(locked) > 0 { | |||
kvs = append(kvs, oidsKV(lockedKey, locked)) | |||
} | |||
if typ != objectsdk.TypeRegular { | |||
kvs = append(kvs, kv(typeKey, uint32(typ))) |
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.
although typ
is uint32
, lets to cast to int32
. It will be int32
soon (im also unhappy bout this, but wcyd). We'll most likely forget to change conversion later
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.
ok
Map type allows to be flexible and not rely on positional data interpretation, so there is no need to put empty `deleted` or `locked` arrays for objects that do not delete or lock anything. Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
fb4685d
to
858354c
Compare
858354c
to
ce1096b
Compare
ce1096b
to
fb345bf
Compare
fb345bf
to
cde8332
Compare
A first object has its own OID to simplify detection of such objects by indexed meta-information. Closes #2935. Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
It is optional since one of the types (REGULAR) is the most expected, and its missing can be recognizable. Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
An omission from ae6e37d: check all 3 signatures and slice them correctly. Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
cde8332
to
8ebd425
Compare
Blocked by #3044.