lib/fs: properly handle stale NFS file handle error during file deletion

This error can appear when -storageDataPath points to NFS volume and the given file has been already removed.
This commit is contained in:
Aliaksandr Valialkin 2021-02-26 23:21:59 +02:00
parent 50e74c439c
commit c1b8729bd8
2 changed files with 7 additions and 1 deletions

View file

@ -22,6 +22,7 @@
* BUGFIX: reduce the probability of `duplicate time series` errors when querying Kubernetes metrics.
* BUGFIX: properly calculate `histogram_quantile()` over time series with only a single non-zero bucket with `{le="+Inf"}`. Previously `NaN` was returned, now the value for the last bucket before `{le="+Inf"}` is returned like Prometheus does.
* BUGFIX: vmselect: do not cache partial query results on timeout when receiving data from `vmstorage` nodes. See https://github.com/VictoriaMetrics/VictoriaMetrics/pull/1085
* BUGFIX: properly handle `stale NFS file handle` error.
# [v1.54.1](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.54.1)

View file

@ -13,7 +13,7 @@ import (
func mustRemoveAll(path string, done func()) bool {
err := os.RemoveAll(path)
if err == nil {
if err == nil || isStaleNFSFileHandleError(err) {
// Make sure the parent directory doesn't contain references
// to the current directory.
mustSyncParentDirIfExists(path)
@ -87,6 +87,11 @@ func dirRemover() {
}
}
func isStaleNFSFileHandleError(err error) bool {
errStr := err.Error()
return strings.Contains(errStr, "stale NFS file handle")
}
func isTemporaryNFSError(err error) bool {
// See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/61 for details.
errStr := err.Error()