@@ -184,7 +184,7 @@ func (s *containerStorage) putRawIndexes(ctx context.Context, l *zap.Logger, ee
184
184
185
185
res <- evWithMpt
186
186
187
- fillObjectIndex (batch , h )
187
+ fillObjectIndex (batch , h , false )
188
188
}
189
189
190
190
return finalErr
@@ -238,7 +238,7 @@ func isOpAllowed(db storage.Store, e objEvent) error {
238
238
239
239
const binPropertyMarker = "1" // ROOT, PHY, etc.
240
240
241
- func fillObjectIndex (batch map [string ][]byte , h objectsdk.Object ) {
241
+ func fillObjectIndex (batch map [string ][]byte , h objectsdk.Object , isParent bool ) {
242
242
id := h .GetID ()
243
243
typ := h .Type ()
244
244
owner := h .Owner ()
@@ -247,7 +247,7 @@ func fillObjectIndex(batch map[string][]byte, h objectsdk.Object) {
247
247
fPart := h .GetFirstID ()
248
248
parID := h .GetParentID ()
249
249
hasParent := h .Parent () != nil
250
- phy := hasParent || ( fPart . IsZero () && parID . IsZero ())
250
+ phy := ! isParent
251
251
pldHash , _ := h .PayloadChecksum ()
252
252
var ver version.Version
253
253
if v := h .Version (); v != nil {
@@ -275,7 +275,7 @@ func fillObjectIndex(batch map[string][]byte, h objectsdk.Object) {
275
275
if ! parID .IsZero () {
276
276
putPlainAttribute (batch , id , objectsdk .FilterParentID , string (parID [:]))
277
277
}
278
- if ! hasParent && typ == objectsdk .TypeRegular {
278
+ if ! hasParent && fPart . IsZero () && typ == objectsdk .TypeRegular {
279
279
putPlainAttribute (batch , id , objectsdk .FilterRoot , binPropertyMarker )
280
280
}
281
281
if phy {
@@ -289,6 +289,10 @@ func fillObjectIndex(batch map[string][]byte, h objectsdk.Object) {
289
289
putPlainAttribute (batch , id , ak , av )
290
290
}
291
291
}
292
+
293
+ if hasParent {
294
+ fillObjectIndex (batch , * h .Parent (), true )
295
+ }
292
296
}
293
297
294
298
func deleteObjectsOps (dbKV map [string ][]byte , s storage.Store , objects []byte , canDeleteLockObjects bool ) (map [string ][]byte , error ) {
0 commit comments