Skip to content

Commit

Permalink
Update errs
Browse files Browse the repository at this point in the history
Signed-off-by: Jason Cameron <[email protected]>
  • Loading branch information
JasonLovesDoggo committed Nov 4, 2024
1 parent fd530cc commit bce8a9a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions handlers/mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,16 @@ func (h *MySQLHandler) getTotalSize(ctx context.Context) (int64, error) {
"-e 'SELECT ROUND(SUM(data_length) * 0.8) AS \"size_bytes\" FROM information_schema.TABLES;'",
)
output, err := cmd.Output()
fmt.Println(cmd.String())

if err != nil {
return 0, &ErrMySQLBackup{Op: "size estimation", Err: err}
}

sizeStr := string(bytes.TrimSpace(output))
size, err := strconv.ParseInt(sizeStr, 10, 64)
if err != nil {
fmt.Println("Failed to convert size string to int64", err)
// Fallback to a default size if parsing fails
return 563091866, nil
}
Expand Down

0 comments on commit bce8a9a

Please sign in to comment.