From a33e4047459bcc24240828c2e55f0d15a186edf6 Mon Sep 17 00:00:00 2001 From: Ivan Sim Date: Thu, 29 Apr 2021 22:44:23 -0700 Subject: [PATCH] Update tar write function to skip irregular file This resolves the occassional 'archive/tar: write too long' error Signed-off-by: Ivan Sim --- core/cmd/main.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/core/cmd/main.go b/core/cmd/main.go index e57c37e..409bdf8 100644 --- a/core/cmd/main.go +++ b/core/cmd/main.go @@ -197,15 +197,14 @@ func compressed(dataDir string, blocks []*promtsdb.Block, writer *io.PipeWriter) return err } - // if dir, only write header - if info.IsDir() { - return writeHeader(path, info, tar.TypeDir) - } - if err := writeHeader(path, info, tar.TypeReg); err != nil { return err } + if !info.Mode().IsRegular() { + return nil + } + data, err := ioutil.ReadFile(path) if err != nil { return fmt.Errorf("failed to read data file: %w", err)