-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: backup progress should not add block failed to upload to successful count #209
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -425,7 +425,8 @@ func backupBlock(bsDriver BackupStoreDriver, config *DeltaBackupConfig, | |
return errors.Wrapf(err, "failed to get transfer data size during saving blocks") | ||
} | ||
|
||
if err := bsDriver.Write(blkFile, rs); err != nil { | ||
err = bsDriver.Write(blkFile, rs) | ||
if err != nil { | ||
Comment on lines
+428
to
+429
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Codebase verification Fix Approved for However, similar error handling issues were found in
🔗 Analysis chainLGTM! Fix properly captures Write errors. The change correctly captures and propagates errors from the Write operation, ensuring failed block uploads are not counted as successful. Let's verify if there are similar patterns in the codebase that might need the same fix: 🏁 Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Description: Look for similar patterns where Write errors might not be captured
# Test: Search for direct Write calls without error assignment
ast-grep --pattern 'bsDriver.Write($_, $_)
if err != nil'
Length of output: 59 Script: #!/bin/bash
# Description: Look for bsDriver.Write calls without error assignment
# Test: Search for bsDriver.Write calls that do not assign the returned error to a variable
ast-grep --pattern 'bsDriver.Write($_, $_)' --filter '!(parent(expr_stmt) and parent(expr_stmt).expr = "err = bsDriver.Write($_, $_)")'
Length of output: 325 Script: #!/bin/bash
# Description: Look for bsDriver.Write calls without error assignment
# Test: Search for bsDriver.Write calls not assigned to the err variable
rg -n 'bsDriver\.Write\s*\([^)]*\)\s*(?!\s*err\s*=)'
Length of output: 332 Script: #!/bin/bash
# Description: Look for bsDriver.Write calls without error assignment
# Test: Search for bsDriver.Write calls not assigned to the err variable using PCRE2
rg -n --pcre2 'bsDriver\.Write\s*\([^)]*\)\s*(?!\s*err\s*=)'
Length of output: 196 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So clever! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @derekbit, happy to help! |
||
return errors.Wrapf(err, "failed to write data during saving blocks") | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: consider using a returned
err
variable instead, so updates to the variable won't be missed.