canceled PUTs throw frivolous logs (#14475)

remote drives might throw frivolous logs,
if the caller canceled the PUT operation
in such scenarios there is no reason to log.
This commit is contained in:
Harshavardhana 2022-03-04 10:31:33 -08:00 committed by GitHub
parent 9b0a8de7de
commit 66afa16aed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2039,7 +2039,8 @@ func skipAccessChecks(volume string) (ok bool) {
// RenameData - rename source path to destination path atomically, metadata and data directory. // RenameData - rename source path to destination path atomically, metadata and data directory.
func (s *xlStorage) RenameData(ctx context.Context, srcVolume, srcPath string, fi FileInfo, dstVolume, dstPath string) (err error) { func (s *xlStorage) RenameData(ctx context.Context, srcVolume, srcPath string, fi FileInfo, dstVolume, dstPath string) (err error) {
defer func() { defer func() {
if err != nil { if err != nil && !contextCanceled(ctx) {
// Only log these errors if context is not yet canceled.
logger.LogIf(ctx, fmt.Errorf("srcVolume: %s, srcPath: %s, dstVolume: %s:, dstPath: %s - error %v", logger.LogIf(ctx, fmt.Errorf("srcVolume: %s, srcPath: %s, dstVolume: %s:, dstPath: %s - error %v",
srcVolume, srcPath, srcVolume, srcPath,
dstVolume, dstPath, dstVolume, dstPath,