reduced the places where we probe hourly tables
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -103,19 +103,9 @@ LIMIT ?
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
probed := false
|
probed := false
|
||||||
hasRows := count.Valid && count.Int64 > 0
|
// If count is known and >0, trust it; if NULL, accept optimistically to avoid heavy probes.
|
||||||
|
hasRows := !count.Valid || count.Int64 > 0
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
if !count.Valid {
|
|
||||||
probed = true
|
|
||||||
if ok, err := db.TableHasRows(ctx, dbConn, name); err == nil {
|
|
||||||
hasRows = ok
|
|
||||||
} else {
|
|
||||||
hasRows = false
|
|
||||||
if logger != nil {
|
|
||||||
logger.Debug("snapshot table probe failed", "table", name, "error", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if vcenter != "" && hasRows {
|
if vcenter != "" && hasRows {
|
||||||
probed = true
|
probed = true
|
||||||
vrows, qerr := querySnapshotRows(ctx, dbConn, name, []string{"VmId"}, `"Vcenter" = ? LIMIT 1`, vcenter)
|
vrows, qerr := querySnapshotRows(ctx, dbConn, name, []string{"VmId"}, `"Vcenter" = ? LIMIT 1`, vcenter)
|
||||||
|
|||||||
@@ -137,15 +137,9 @@ ORDER BY snapshot_time ASC
|
|||||||
if err := db.ValidateTableName(t.Table); err != nil {
|
if err := db.ValidateTableName(t.Table); err != nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if t.Count.Valid {
|
// Trust snapshot_count if present; otherwise optimistically include to avoid long probes.
|
||||||
if t.Count.Int64 <= 0 {
|
if t.Count.Valid && t.Count.Int64 <= 0 {
|
||||||
continue
|
continue
|
||||||
}
|
|
||||||
} else {
|
|
||||||
hasRows, err := db.TableHasRows(ctx, dbConn, t.Table)
|
|
||||||
if err != nil || !hasRows {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
tables = append(tables, t)
|
tables = append(tables, t)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user