From 5b8526e925b9f47f3210b6ba2c1b61946db41da9 Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Sun, 28 Jul 2019 12:12:30 +0300 Subject: [PATCH] app/vmselect/netstorage: improve error message when reading data blocks from storage Mention the block number in the error. This should simplify troubleshooting in this code. --- app/vmselect/netstorage/netstorage.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/vmselect/netstorage/netstorage.go b/app/vmselect/netstorage/netstorage.go index 9175fda162..a199f399b6 100644 --- a/app/vmselect/netstorage/netstorage.go +++ b/app/vmselect/netstorage/netstorage.go @@ -724,6 +724,7 @@ func ProcessSearchQuery(at *auth.Token, sq *storage.SearchQuery, deadline Deadli var errors []error tbf := getTmpBlocksFile() m := make(map[string][]tmpBlockAddr) + blocksRead := 0 for i := 0; i < len(storageNodes); i++ { // There is no need in timer here, since all the goroutines executing // sn.processSearchQuery must be finished until the deadline. @@ -733,9 +734,10 @@ func ProcessSearchQuery(at *auth.Token, sq *storage.SearchQuery, deadline Deadli continue } for _, mb := range nr.results { + blocksRead++ addr, err := tbf.WriteBlock(mb.Block) if err != nil { - errors = append(errors, fmt.Errorf("cannot write data to temporary blocks file: %s", err)) + errors = append(errors, fmt.Errorf("cannot write data block #%d to temporary blocks file: %s", blocksRead, err)) break } metricName := mb.MetricName @@ -760,7 +762,7 @@ func ProcessSearchQuery(at *auth.Token, sq *storage.SearchQuery, deadline Deadli } if err := tbf.Finalize(); err != nil { putTmpBlocksFile(tbf) - return nil, false, fmt.Errorf("cannot finalize temporary blocks file: %s", err) + return nil, false, fmt.Errorf("cannot finalize temporary blocks file with %d blocks: %s", blocksRead, err) } var rss Results