Skip to content
This repository was archived by the owner on Jul 15, 2023. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions Attrs.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ func (this *Attrs) Attr(a *fuse.Attr) error {
func (this *Attrs) FuseNodeType() fuse.DirentType {
if (this.Mode & os.ModeDir) == os.ModeDir {
return fuse.DT_Dir
} else {
return fuse.DT_File
}
return fuse.DT_File
}
4 changes: 1 addition & 3 deletions Dir.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,8 @@ var _ fs.NodeRenamer = (*Dir)(nil)
func (this *Dir) AbsolutePath() string {
if this.Parent == nil {
return "/"
} else {
return path.Join(this.Parent.AbsolutePath(), this.Attrs.Name)
}
return path.Join(this.Parent.AbsolutePath(), this.Attrs.Name)
}

// Returns absolute path of the child item of this directory
Expand Down Expand Up @@ -79,7 +78,6 @@ func (this *Dir) EntriesSet(name string, node fs.Node) {
if this.Entries == nil {
this.Entries = make(map[string]fs.Node)
}

this.Entries[name] = node
}

Expand Down
28 changes: 13 additions & 15 deletions FaultTolerantHdfsAccessor.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func (this *FaultTolerantHdfsAccessor) EnsureConnected() error {
op := this.RetryPolicy.StartOperation()
for {
err := this.Impl.EnsureConnected()
if IsSuccessOrBenignError(err) || !op.ShouldRetry("Connect: %s", err) {
if IsSuccessOrBenignError(err) || !op.ShouldRetry("Connect: %v", err) {
return err
}
}
Expand All @@ -41,7 +41,7 @@ func (this *FaultTolerantHdfsAccessor) OpenRead(path string) (ReadSeekCloser, er
// wrapping returned HdfsReader with FaultTolerantHdfsReader
return NewFaultTolerantHdfsReader(path, result, this.Impl, this.RetryPolicy), nil
}
if IsSuccessOrBenignError(err) || !op.ShouldRetry("[%s] OpenRead: %s", path, err) {
if IsSuccessOrBenignError(err) || !op.ShouldRetry("[%s] OpenRead: %v", path, err) {
return nil, err
} else {
// Clean up the bad connection, to let underline connection to get automatic refresh
Expand All @@ -61,7 +61,7 @@ func (this *FaultTolerantHdfsAccessor) ReadDir(path string) ([]Attrs, error) {
op := this.RetryPolicy.StartOperation()
for {
result, err := this.Impl.ReadDir(path)
if IsSuccessOrBenignError(err) || !op.ShouldRetry("[%s] ReadDir: %s", path, err) {
if IsSuccessOrBenignError(err) || !op.ShouldRetry("[%s] ReadDir: %v", path, err) {
return result, err
} else {
// Clean up the bad connection, to let underline connection to get automatic refresh
Expand All @@ -75,7 +75,7 @@ func (this *FaultTolerantHdfsAccessor) Stat(path string) (Attrs, error) {
op := this.RetryPolicy.StartOperation()
for {
result, err := this.Impl.Stat(path)
if IsSuccessOrBenignError(err) || !op.ShouldRetry("[%s] Stat: %s", path, err) {
if IsSuccessOrBenignError(err) || !op.ShouldRetry("[%s] Stat: %v", path, err) {
return result, err
} else {
// Clean up the bad connection, to let underline connection to get automatic refresh
Expand All @@ -89,7 +89,7 @@ func (this *FaultTolerantHdfsAccessor) StatFs() (FsInfo, error) {
op := this.RetryPolicy.StartOperation()
for {
result, err := this.Impl.StatFs()
if IsSuccessOrBenignError(err) || !op.ShouldRetry("StatFs: %s", err) {
if IsSuccessOrBenignError(err) || !op.ShouldRetry("StatFs: %v", err) {
return result, err
} else {
// Clean up the bad connection, to let underline connection to get automatic refresh
Expand All @@ -103,7 +103,7 @@ func (this *FaultTolerantHdfsAccessor) Mkdir(path string, mode os.FileMode) erro
op := this.RetryPolicy.StartOperation()
for {
err := this.Impl.Mkdir(path, mode)
if IsSuccessOrBenignError(err) || !op.ShouldRetry("[%s] Mkdir %s: %s", path, mode, err) {
if IsSuccessOrBenignError(err) || !op.ShouldRetry("[%s] Mkdir %s: %v", path, mode, err) {
return err
} else {
// Clean up the bad connection, to let underline connection to get automatic refresh
Expand All @@ -117,7 +117,7 @@ func (this *FaultTolerantHdfsAccessor) Remove(path string) error {
op := this.RetryPolicy.StartOperation()
for {
err := this.Impl.Remove(path)
if IsSuccessOrBenignError(err) || !op.ShouldRetry("[%s] Remove: %s", path, err) {
if IsSuccessOrBenignError(err) || !op.ShouldRetry("[%s] Remove: %v", path, err) {
return err
} else {
// Clean up the bad connection, to let underline connection to get automatic refresh
Expand All @@ -131,7 +131,7 @@ func (this *FaultTolerantHdfsAccessor) Rename(oldPath string, newPath string) er
op := this.RetryPolicy.StartOperation()
for {
err := this.Impl.Rename(oldPath, newPath)
if IsSuccessOrBenignError(err) || !op.ShouldRetry("[%s] Rename to %s: %s", oldPath, newPath, err) {
if IsSuccessOrBenignError(err) || !op.ShouldRetry("[%s] Rename to %s: %v", oldPath, newPath, err) {
return err
} else {
// Clean up the bad connection, to let underline connection to get automatic refresh
Expand All @@ -145,12 +145,11 @@ func (this *FaultTolerantHdfsAccessor) Chmod(path string, mode os.FileMode) erro
op := this.RetryPolicy.StartOperation()
for {
err := this.Impl.Chmod(path, mode)
if IsSuccessOrBenignError(err) || !op.ShouldRetry("Chmod [%s] to [%d]: %s", path, mode, err) {
if IsSuccessOrBenignError(err) || !op.ShouldRetry("Chmod [%s] to [%d]: %v", path, mode, err) {
return err
} else {
// Clean up the bad connection, to let underline connection to get automatic refresh
this.Impl.Close()
}
// Clean up the bad connection, to let underline connection to get automatic refresh
this.Impl.Close()
}
}

Expand All @@ -161,10 +160,9 @@ func (this *FaultTolerantHdfsAccessor) Chown(path string, user, group string) er
err := this.Impl.Chown(path, user, group)
if IsSuccessOrBenignError(err) || !op.ShouldRetry("Chown [%s] to [%s:%s]: %s", path, user, group, err) {
return err
} else {
// Clean up the bad connection, to let underline connection to get automatic refresh
this.Impl.Close()
}
// Clean up the bad connection, to let underline connection to get automatic refresh
this.Impl.Close()
}
}

Expand Down