Skip to content

Commit

Permalink
CompleteRequestProto set FileId to fix call failed
Browse files Browse the repository at this point in the history
  • Loading branch information
982945902 authored Aug 9, 2022
1 parent 1dee011 commit 545c98f
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion file_writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,14 +233,23 @@ func (f *FileWriter) Close() error {
}
}

getFileInfoReq := &hdfs.GetFileInfoRequestProto{Src: proto.String(f.name)}
getFileInfoResp := &hdfs.GetFileInfoResponseProto{}

err := f.client.namenode.Execute("getFileInfo", getFileInfoReq, getFileInfoResp)
if err != nil {
return &os.PathError{"getFileInfo", f.name, err}
}

completeReq := &hdfs.CompleteRequestProto{
Src: proto.String(f.name),
ClientName: proto.String(f.client.namenode.ClientName),
Last: lastBlock,
FileId: getFileInfoResp.Fs.FileId,
}
completeResp := &hdfs.CompleteResponseProto{}

err := f.client.namenode.Execute("complete", completeReq, completeResp)
err = f.client.namenode.Execute("complete", completeReq, completeResp)
if err != nil {
return &os.PathError{"create", f.name, err}
} else if completeResp.GetResult() == false {
Expand Down

0 comments on commit 545c98f

Please sign in to comment.