Skip to content

Commit

Permalink
Update tar write function to skip irregular file
Browse files Browse the repository at this point in the history
This resolves the occassional 'archive/tar: write too long' error

Signed-off-by: Ivan Sim <isim@redhat.com>
  • Loading branch information
Ivan Sim committed Apr 30, 2021
1 parent aebedf7 commit a33e404
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions core/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit a33e404

Please sign in to comment.