|
|
@ -84,9 +84,11 @@ func newStreamingBitrotWriter(disk StorageAPI, volume, filePath string, length i |
|
|
|
totalFileSize := bitrotSumsTotalSize + length |
|
|
|
totalFileSize := bitrotSumsTotalSize + length |
|
|
|
err := disk.CreateFile(volume, filePath, totalFileSize, r) |
|
|
|
err := disk.CreateFile(volume, filePath, totalFileSize, r) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
logger.LogIf(context.Background(), err) |
|
|
|
reqInfo := (&logger.ReqInfo{}).AppendTags("storageDisk", disk.String()) |
|
|
|
r.CloseWithError(err) |
|
|
|
ctx := logger.SetReqInfo(context.Background(), reqInfo) |
|
|
|
|
|
|
|
logger.LogIf(ctx, err) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
r.CloseWithError(err) |
|
|
|
close(bw.canClose) |
|
|
|
close(bw.canClose) |
|
|
|
}() |
|
|
|
}() |
|
|
|
return bw |
|
|
|
return bw |
|
|
@ -125,7 +127,9 @@ func (b *streamingBitrotReader) ReadAt(buf []byte, offset int64) (int, error) { |
|
|
|
streamOffset := (offset/b.shardSize)*int64(b.h.Size()) + offset |
|
|
|
streamOffset := (offset/b.shardSize)*int64(b.h.Size()) + offset |
|
|
|
b.rc, err = b.disk.ReadFileStream(b.volume, b.filePath, streamOffset, b.tillOffset-streamOffset) |
|
|
|
b.rc, err = b.disk.ReadFileStream(b.volume, b.filePath, streamOffset, b.tillOffset-streamOffset) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
logger.LogIf(context.Background(), err) |
|
|
|
reqInfo := (&logger.ReqInfo{}).AppendTags("storageDisk", b.disk.String()) |
|
|
|
|
|
|
|
ctx := logger.SetReqInfo(context.Background(), reqInfo) |
|
|
|
|
|
|
|
logger.LogIf(ctx, err) |
|
|
|
return 0, err |
|
|
|
return 0, err |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|