Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty file after CopyToRemote #327

Open
NickYadance opened this issue Jul 28, 2023 · 1 comment
Open

Empty file after CopyToRemote #327

NickYadance opened this issue Jul 28, 2023 · 1 comment

Comments

@NickYadance
Copy link

from #221

I found the file in hdfs is empty, but there is no error log. This problem has troubled me for a long time.

Same issue with hdfs file being "empty", after calling CopyToRemote api which reports no error.

The content of the file is complete, same as the local file if we hdfs get or hdfs cat it. The file is actually not empty but being under construction.

$ hdfs dfs -checksum /path/to/empty/file
checksum: Fail to get checksum, since file /path/to/empty/file is under construction.

The workaround is to recover file lease manually.

$ hdfs debug recoverLease -path /path/to/empty/file
recoverLease SUCCEEDED on /path/to/empty/file

Unfortunately no stable reproduce method found yet, the guess is that remote.Close have missed some errors.

hdfs/client.go

Lines 289 to 307 in d5784c3

func (c *Client) CopyToRemote(src string, dst string) error {
local, err := os.Open(src)
if err != nil {
return err
}
defer local.Close()
remote, err := c.Create(dst)
if err != nil {
return err
}
_, err = io.Copy(remote, local)
if err != nil {
remote.Close()
return err
}
return remote.Close()

@4LL3N51147
Copy link

I hava encoutered the same problem. In my case a call to the copyToRemote returns the error: read tcp 172.16.202.36:49256->172.18.122.161:50010: read: connection reset by peer
this error seems to happen only with hdfs clusters with kerberos turned on.

After checking the logs for hdfs namenode, I found this log snippet
企业微信截图_9b8e6c32-f2b7-4036-a1da-4b01551cac21

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants