Skip to content

Commit f19754a

Browse files
committed
HOPSFS-330: Translate raw RPC errors via interpretException for all namenode calls
getBlocks(), StatFs(), fetchDefaults(), and fetchDataEncryptionKey() returned raw RPC errors without interpretException(), causing Java exceptions like AccessControlException to propagate as unrecognized errors. The mount then mapped them to EIO instead of the correct errno (e.g., EPERM). Generated with Claude Code
1 parent 2787198 commit f19754a

4 files changed

Lines changed: 4 additions & 4 deletions

File tree

client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ func (c *Client) fetchDataEncryptionKey() (*hdfs.DataEncryptionKeyProto, error)
417417

418418
err := c.namenode.Execute("getDataEncryptionKey", req, resp)
419419
if err != nil {
420-
return nil, err
420+
return nil, interpretException(err)
421421
}
422422

423423
c.encryptionKey = resp.GetDataEncryptionKey()

defaults.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func (c *Client) fetchDefaults() (*hdfs.FsServerDefaultsProto, error) {
4949

5050
err := c.namenode.Execute("getServerDefaults", req, resp)
5151
if err != nil {
52-
return nil, err
52+
return nil, interpretException(err)
5353
}
5454

5555
c.defaults = resp.GetServerDefaults()

file_reader.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ func (f *FileReader) getBlocks() error {
454454

455455
err := f.client.namenode.Execute("getBlockLocations", req, resp)
456456
if err != nil {
457-
return err
457+
return &os.PathError{"open", f.name, interpretException(err)}
458458
}
459459

460460
f.blocks = resp.GetLocations().GetBlocks()

stat_fs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ func (c *Client) StatFs() (FsInfo, error) {
2323

2424
err := c.namenode.Execute("getFsStats", req, resp)
2525
if err != nil {
26-
return FsInfo{}, err
26+
return FsInfo{}, interpretException(err)
2727
}
2828

2929
var fs FsInfo

0 commit comments

Comments
 (0)