From af2ceaaa0b9cb6ae2a4ab3d0b05115d80b32a029 Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Mon, 24 Jun 2019 14:05:42 +0300 Subject: [PATCH] lib/storage: mention source parts on merge error This should improve determining broken source part. Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/76 --- lib/mergeset/block_stream_reader.go | 7 +++++++ lib/mergeset/merge.go | 2 +- lib/storage/merge.go | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/mergeset/block_stream_reader.go b/lib/mergeset/block_stream_reader.go index 984f3035b..64faa9f47 100644 --- a/lib/mergeset/block_stream_reader.go +++ b/lib/mergeset/block_stream_reader.go @@ -91,6 +91,13 @@ func (bsr *blockStreamReader) reset() { 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. func (bsr *blockStreamReader) InitFromInmemoryPart(ip *inmemoryPart) { bsr.reset() diff --git a/lib/mergeset/merge.go b/lib/mergeset/merge.go index 039ad34d7..2387c793a 100644 --- a/lib/mergeset/merge.go +++ b/lib/mergeset/merge.go @@ -29,7 +29,7 @@ func mergeBlockStreams(ph *partHeader, bsw *blockStreamWriter, bsrs []*blockStre if err == errForciblyStopped { 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{ diff --git a/lib/storage/merge.go b/lib/storage/merge.go index 29da58c0e..524b8a4d1 100644 --- a/lib/storage/merge.go +++ b/lib/storage/merge.go @@ -29,7 +29,7 @@ func mergeBlockStreams(ph *partHeader, bsw *blockStreamWriter, bsrs []*blockStre if err == errForciblyStopped { 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{