From 370f008220dbf1348ba70ef8a7e15e16d8cec23c Mon Sep 17 00:00:00 2001 From: Paul Dix Date: Thu, 20 Aug 2015 10:52:29 -0400 Subject: [PATCH] Fix reads of metadata file in WAL --- tsdb/engine/wal/wal.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tsdb/engine/wal/wal.go b/tsdb/engine/wal/wal.go index b293e7387f9..a388c68db6c 100644 --- a/tsdb/engine/wal/wal.go +++ b/tsdb/engine/wal/wal.go @@ -349,7 +349,7 @@ func (l *Log) readMetadataFile(fileName string) ([]*seriesAndFields, error) { length := make([]byte, 8) for { // get the length of the compressed seriesAndFields blob - _, err := f.Read(length) + _, err := io.ReadFull(f, length) if err == io.EOF { break } else if err != nil { @@ -365,7 +365,7 @@ func (l *Log) readMetadataFile(fileName string) ([]*seriesAndFields, error) { // read in the compressed block and decod it b := make([]byte, dataLength) - _, err = f.Read(b) + _, err = io.ReadFull(f, b) if err == io.EOF { break } else if err != nil { @@ -550,7 +550,8 @@ func (l *Log) Close() error { func (l *Log) close() error { for _, p := range l.partitions { if err := p.Close(); err != nil { - return err + // log and skip so we can close the other partitions + l.logger.Println("error closing partition:", err) } }