object/transformer: Add expiration epoch to each part of big object #319

Merged
fyrchik merged 1 commit from a-savchuk/frostfs-sdk-go:parent-parent-attrs-in-ec into master 2025-02-03 11:13:41 +00:00

View file

@ -6,6 +6,7 @@ import (
"crypto/sha256" "crypto/sha256"
"fmt" "fmt"
objectV2 "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/object"
buffPool "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/util/pool" buffPool "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/util/pool"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/checksum" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/checksum"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
@ -327,4 +328,11 @@ func (s *payloadSizeLimiter) prepareFirstChild() {
s.current.SetAttributes() s.current.SetAttributes()
// attributes will be added to parent in detachParent // attributes will be added to parent in detachParent
// add expiration epoch to each part
for _, attr := range s.parAttrs {
if attr.Key() == objectV2.SysAttributeExpEpoch {
Review

We may rely on s.current having empty set of attributes in other places.

  1. Could you check that if you emit the first part and then override attribute set (for some reason), there would be no data races?
  2. This code belongs to prepareFirstChild, why do second child inherit the attribute?
We may rely on `s.current` having empty set of attributes in other places. 1. Could you check that if you emit the first part and then override attribute set (for some reason), there would be no data races? 2. This code belongs to `prepareFirstChild`, why do second child inherit the attribute?
Review

Could you check that if you emit the first part and then override attribute set (for some reason), there would be no data races?

I'll check

This code belongs to prepareFirstChild, why do second child inherit the attribute?

Because each child is initialized from the previous one

s.current = fromObject(s.current)

> Could you check that if you emit the first part and then override attribute set (for some reason), there would be no data races? I'll check > This code belongs to prepareFirstChild, why do second child inherit the attribute? Because each child is initialized from the previous one https://git.frostfs.info/TrueCloudLab/frostfs-sdk-go/src/commit/593dd77d841aa6652377d3755684d0a968e25fff/object/transformer/transformer.go#L87
s.current.SetAttributes(attr)
}
}
} }