Improve empty RRD files detection for faster recovery

This commit is contained in:
emanuele-f 2020-02-26 19:09:08 +01:00
parent c694035da3
commit 7b6ce10940
2 changed files with 15 additions and 10 deletions

View file

@ -400,7 +400,7 @@ function driver:append(schema, timestamp, tags, metrics)
return false
end
if not ntop.exists(rrdfile) then
if not ntop.notEmptyFile(rrdfile) then
ntop.mkdir(base)
if not create_rrd(schema, rrdfile) then
return false
@ -507,7 +507,7 @@ function driver:query(schema, tstart, tend, tags, options)
local base, rrd = schema_get_path(schema, tags)
local rrdfile = os_utils.fixPath(base .. "/" .. rrd .. ".rrd")
if not ntop.exists(rrdfile) then
if not ntop.notEmptyFile(rrdfile) then
return nil
end
@ -826,7 +826,7 @@ end
function driver:queryTotal(schema, tstart, tend, tags, options)
local rrdfile = driver.schema_get_full_path(schema, tags)
if not ntop.exists(rrdfile) then
if not ntop.notEmptyFile(rrdfile) then
return nil
end