forked from TrueCloudLab/frostfs-sdk-go
[#293] object: Fix payload size limiter
* Sending empty chunks by `writeChunk` should not release new objects as this doesn't change `payloadSizeLimiter` internal state. * This also fixes the bug with patcher when an offset of a patch equals to `MaxSize` - `payloadSizeLimiter` releases object again although state is the same. This led to error because EC-encoder receieved empty payload and couldn't not process it. Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
This commit is contained in:
parent
6980651785
commit
cb813e27a8
2 changed files with 73 additions and 1 deletions
|
@ -261,7 +261,7 @@ func (s *payloadSizeLimiter) initializeLinking(parHdr *object.Object) {
|
|||
func (s *payloadSizeLimiter) writeChunk(ctx context.Context, chunk []byte) error {
|
||||
for {
|
||||
// statement is true if the previous write of bytes reached exactly the boundary.
|
||||
if s.written > 0 && s.written%s.MaxSize == 0 {
|
||||
if len(chunk) > 0 && s.written > 0 && s.written%s.MaxSize == 0 {
|
||||
if s.written == s.MaxSize {
|
||||
s.prepareFirstChild()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue