mirror of
https://github.com/prometheus/prometheus.git
synced 2024-11-10 07:34:04 -08:00
Merge pull request #8432 from roidelapluie/backfillpanic
backfill: move checkErr before we close the mmaped file
This commit is contained in:
commit
c1f8bd9944
|
@ -207,7 +207,7 @@ func main() {
|
|||
os.Exit(checkErr(dumpSamples(*dumpPath, *dumpMinTime, *dumpMaxTime)))
|
||||
//TODO(aSquare14): Work on adding support for custom block size.
|
||||
case openMetricsImportCmd.FullCommand():
|
||||
os.Exit(checkErr(backfillOpenMetrics(*importFilePath, *importDBPath, *importHumanReadable)))
|
||||
os.Exit(backfillOpenMetrics(*importFilePath, *importDBPath, *importHumanReadable))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -618,16 +618,16 @@ func checkErr(err error) int {
|
|||
return 0
|
||||
}
|
||||
|
||||
func backfillOpenMetrics(path string, outputDir string, humanReadable bool) (err error) {
|
||||
func backfillOpenMetrics(path string, outputDir string, humanReadable bool) int {
|
||||
inputFile, err := fileutil.OpenMmapFile(path)
|
||||
if err != nil {
|
||||
return err
|
||||
return checkErr(err)
|
||||
}
|
||||
defer inputFile.Close()
|
||||
|
||||
if err := os.MkdirAll(outputDir, 0777); err != nil {
|
||||
return errors.Wrap(err, "create output dir")
|
||||
return checkErr(errors.Wrap(err, "create output dir"))
|
||||
}
|
||||
|
||||
return backfill(5000, inputFile.Bytes(), outputDir, humanReadable)
|
||||
return checkErr(backfill(5000, inputFile.Bytes(), outputDir, humanReadable))
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue