lib/storage: mention source parts on merge error

This should improve determining broken source part.

Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/76
This commit is contained in:
Aliaksandr Valialkin 2019-06-24 14:05:42 +03:00
parent 61926bae01
commit af2ceaaa0b
3 changed files with 9 additions and 2 deletions

View file

@ -91,6 +91,13 @@ func (bsr *blockStreamReader) reset() {
bsr.err = nil bsr.err = nil
} }
func (bsr *blockStreamReader) String() string {
if len(bsr.path) > 0 {
return bsr.path
}
return bsr.ph.String()
}
// InitFromInmemoryPart initializes bsr from the given ip. // InitFromInmemoryPart initializes bsr from the given ip.
func (bsr *blockStreamReader) InitFromInmemoryPart(ip *inmemoryPart) { func (bsr *blockStreamReader) InitFromInmemoryPart(ip *inmemoryPart) {
bsr.reset() bsr.reset()

View file

@ -29,7 +29,7 @@ func mergeBlockStreams(ph *partHeader, bsw *blockStreamWriter, bsrs []*blockStre
if err == errForciblyStopped { if err == errForciblyStopped {
return err return err
} }
return fmt.Errorf("cannot merge block streams: %s", err) return fmt.Errorf("cannot merge %d block streams: %s: %s", len(bsrs), bsrs, err)
} }
var bsmPool = &sync.Pool{ var bsmPool = &sync.Pool{

View file

@ -29,7 +29,7 @@ func mergeBlockStreams(ph *partHeader, bsw *blockStreamWriter, bsrs []*blockStre
if err == errForciblyStopped { if err == errForciblyStopped {
return err return err
} }
return fmt.Errorf("cannot merge %d streams: %s", len(bsrs), err) return fmt.Errorf("cannot merge %d streams: %s: %s", len(bsrs), bsrs, err)
} }
var bsmPool = &sync.Pool{ var bsmPool = &sync.Pool{