Skip to content

Commit

Permalink
Log conflicts with inode ID
Browse files Browse the repository at this point in the history
  • Loading branch information
vitalif committed Apr 5, 2023
1 parent b00985d commit e1302a1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions internal/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -1336,7 +1336,7 @@ func (inode *Inode) SendUpload() bool {
err = nil
notFoundIgnore = true
} else if mappedErr == fuse.ENOENT || mappedErr == syscall.ERANGE {
s3Log.Warnf("Conflict detected: failed to copy %v to %v: %v. File is removed remotely, dropping cache", from, key, err)
s3Log.Warnf("Conflict detected (inode %v): failed to copy %v to %v: %v. File is removed remotely, dropping cache", inode.Id, from, key, err)
inode.mu.Lock()
newParent := inode.Parent
oldParent := inode.oldParent
Expand Down Expand Up @@ -1482,7 +1482,7 @@ func (inode *Inode) SendUpload() bool {
inode.userMetadataDirty = 2
if mappedErr == fuse.ENOENT || mappedErr == syscall.ERANGE {
// Object is deleted or resized remotely (416). Discard local version
log.Warnf("Conflict detected: File %v is deleted or resized remotely, discarding local changes", inode.FullName())
s3Log.Warnf("Conflict detected (inode %v): File %v is deleted or resized remotely, discarding local changes", inode.Id, inode.FullName())
inode.resetCache()
}
log.Errorf("Error flushing metadata using COPY for %v: %v", key, err)
Expand Down Expand Up @@ -1726,7 +1726,7 @@ func (inode *Inode) FlushSmallObject() {
mappedErr := mapAwsError(err)
if mappedErr == fuse.ENOENT || mappedErr == syscall.ERANGE {
// Object is deleted or resized remotely (416). Discard local version
log.Warnf("Conflict detected: File %v is deleted or resized remotely, discarding local changes", inode.FullName())
s3Log.Warnf("Conflict detected (inode %v): File %v is deleted or resized remotely, discarding local changes", inode.Id, inode.FullName())
inode.resetCache()
inode.IsFlushing -= inode.fs.flags.MaxParallelParts
atomic.AddInt64(&inode.fs.activeFlushers, -1)
Expand Down Expand Up @@ -1780,7 +1780,7 @@ func (inode *Inode) FlushSmallObject() {
inode.userMetadataDirty = 2
}
} else {
log.Debugf("Flushed small file %v: etag=%v, size=%v", key, NilStr(resp.ETag), sz)
log.Debugf("Flushed small file %v (inode %v): etag=%v, size=%v", key, inode.Id, NilStr(resp.ETag), sz)
stillDirty := inode.userMetadataDirty != 0 || inode.oldParent != nil
for i := 0; i < len(inode.buffers); i++ {
b := inode.buffers[i]
Expand Down Expand Up @@ -1924,7 +1924,7 @@ func (inode *Inode) FlushPart(part uint64) {
mappedErr := mapAwsError(err)
if mappedErr == fuse.ENOENT || mappedErr == syscall.ERANGE {
// Object is deleted or resized remotely (416). Discard local version
log.Warnf("Conflict detected: File %v is deleted or resized remotely, discarding local changes", inode.FullName())
s3Log.Warnf("Conflict detected (inode %v): File %v is deleted or resized remotely, discarding local changes", inode.Id, inode.FullName())
inode.resetCache()
return
}
Expand Down Expand Up @@ -2008,7 +2008,7 @@ func (inode *Inode) completeMultipart() {
mappedErr := mapAwsError(err)
if mappedErr == fuse.ENOENT || mappedErr == syscall.ERANGE {
// Object is deleted or resized remotely (416). Discard local version
log.Warnf("Conflict detected: File %v is deleted or resized remotely, discarding local changes", inode.FullName())
s3Log.Warnf("Conflict detected (inode %v): File %v is deleted or resized remotely, discarding local changes", inode.Id, inode.FullName())
inode.resetCache()
return
}
Expand Down
4 changes: 2 additions & 2 deletions internal/handles.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,9 @@ func (inode *Inode) SetFromBlobItem(item *BlobItemOutput) {
// Otherwise we may not be able to make a correct object version
if item.ETag != nil && inode.knownETag != *item.ETag || item.Size != inode.knownSize {
if inode.CacheState != ST_CACHED && (inode.knownETag != "" || inode.knownSize > 0) {
s3Log.Warnf("Conflict detected: server-side ETag or size of %v"+
s3Log.Warnf("Conflict detected (inode %v): server-side ETag or size of %v"+
" (%v, %v) differs from local (%v, %v). File is changed remotely, dropping cache",
inode.FullName(), NilStr(item.ETag), item.Size, inode.knownETag, inode.knownSize)
inode.Id, inode.FullName(), NilStr(item.ETag), item.Size, inode.knownETag, inode.knownSize)
}
inode.resetCache()
inode.ResizeUnlocked(item.Size, false, false)
Expand Down

0 comments on commit e1302a1

Please sign in to comment.