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

fix: extend snapshot copy to filesystems that cannot link #22703

Merged
merged 3 commits into from
Oct 21, 2021

Conversation

davidby-influx
Copy link
Contributor

@davidby-influx davidby-influx commented Oct 19, 2021

If os.Link fails with syscall.ENOTSUP, then the file
system does not support links, and we must make copies
of snapshot files for backup. We also automatically make
copies instead of link on Windows, because although it
makes links, their semantics are different from Linux.

closes #16739

If os.Link fails with syscall.ENOTSUP, then the file
system does not support links, and we must make copies
to snapshot files for backup. We also automatically make
copies instead of link on Windows, because although it
makes links, their semantics are different from Linux.

closes #16739
// Windows does not permit deleting a file with open file handles
// Azure does not support hard links in its default file system

func (f *FileStore) copyNotLink(oldPath, newPath string) (returnErr error) {
Copy link
Contributor

@lesam lesam Oct 21, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

function comment should follow godoc format (I don't think the extra whitespace line is correct?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's the sort of thing I expect go fmt to catch, but clearly not the case....

} else {
return fmt.Errorf("error creating hard link for backup from %s to %s: %w", oldPath, newPath, err)
}
} else {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the else? Just return nil at the end of the function would be clearer I think.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because I am an old C coder with damaged neurons.

@davidby-influx davidby-influx requested a review from lesam October 21, 2021 19:24
Copy link
Contributor

@lesam lesam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - godoc comment is the only blocker.

@davidby-influx davidby-influx merged commit d9b9e86 into master-1.x Oct 21, 2021
@davidby-influx davidby-influx deleted the DSB_copy_link branch October 21, 2021 19:54
davidby-influx added a commit that referenced this pull request Oct 21, 2021
If os.Link fails with syscall.ENOTSUP, then the file
system does not support links, and we must make copies
to snapshot files for backup. We also automatically make
copies instead of link on Windows, because although it
makes links, their semantics are different from Linux.

closes #16739

(cherry picked from commit d9b9e86)

closes #22700
davidby-influx added a commit that referenced this pull request Oct 21, 2021
…22730)

If os.Link fails with syscall.ENOTSUP, then the file
system does not support links, and we must make copies
to snapshot files for backup. We also automatically make
copies instead of link on Windows, because although it
makes links, their semantics are different from Linux.

closes #16739

(cherry picked from commit d9b9e86)

closes #22700
davidby-influx added a commit that referenced this pull request Oct 21, 2021
If os.Link fails with syscall.ENOTSUP, then the file
system does not support links, and we must make copies
to snapshot files for backup. We also automatically make
copies instead of link on Windows, because although it
makes links, their semantics are different from Linux.

closes #16739

(cherry picked from commit d9b9e86)

closes #22701
davidby-influx added a commit that referenced this pull request Oct 22, 2021
…22732)

If os.Link fails with syscall.ENOTSUP, then the file
system does not support links, and we must make copies
to snapshot files for backup. We also automatically make
copies instead of link on Windows, because although it
makes links, their semantics are different from Linux.

closes #16739

(cherry picked from commit d9b9e86)

closes #22701
chengshiwen pushed a commit to chengshiwen/influxdb that referenced this pull request Aug 27, 2024
…#22703)

If os.Link fails with syscall.ENOTSUP, then the file
system does not support links, and we must make copies
to snapshot files for backup. We also automatically make
copies instead of link on Windows, because although it
makes links, their semantics are different from Linux.

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

Successfully merging this pull request may close these issues.

Backup failure: Download shard n failed copy backup to file
2 participants