Skip to content

Commit d69b100

Browse files
committed
Add option to disable logger during writing to Azure
1 parent c6d0e23 commit d69b100

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

pbm/restore/physical.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -988,6 +988,7 @@ func (r *PhysRestore) Snapshot(
988988
path: fmt.Sprintf("%s/%s/rs.%s/log/%s", defs.PhysRestoresDir, r.name, r.rsConf.ID, r.nodeInfo.Me),
989989
limit: 1 << 20, // 1Mb
990990
write: func(name string, data io.Reader) error {
991+
// Logger should be disabled due to: PBM-1531
991992
return r.stg.Save(name, data, -1, storage.UseLogger(false))
992993
},
993994
})

pbm/storage/azure/azure.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,13 @@ func (*Blob) Type() storage.Type {
129129
}
130130

131131
func (b *Blob) Save(name string, data io.Reader, sizeb int64, options ...storage.Option) error {
132+
opts := storage.GetDefaultOpts()
133+
for _, opt := range options {
134+
if err := opt(opts); err != nil {
135+
return errors.Wrap(err, "processing options for save")
136+
}
137+
}
138+
132139
bufsz := defaultUploadBuff
133140
if sizeb > 0 {
134141
ps := int(sizeb / maxBlocks * 11 / 10) // add 10% just in case
@@ -142,7 +149,7 @@ func (b *Blob) Save(name string, data io.Reader, sizeb int64, options ...storage
142149
cc = 1
143150
}
144151

145-
if b.log != nil {
152+
if b.log != nil && opts.UseLogger {
146153
b.log.Debug("BufferSize is set to %d (~%dMb) | %d", bufsz, bufsz>>20, sizeb)
147154
}
148155

pbm/storage/storage.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ type FileInfo struct {
3737

3838
type Storage interface {
3939
Type() Type
40-
Save(name string, data io.Reader, size int64, opts ...Option) error
40+
Save(name string, data io.Reader, size int64, options ...Option) error
4141
SourceReader(name string) (io.ReadCloser, error)
4242
// FileStat returns file info. It returns error if file is empty or not exists.
4343
FileStat(name string) (FileInfo, error)

0 commit comments

Comments
 (0)