Remove pack from list when file handle is stale
This error happens on nfs file system when you try to read a file that was deleted or replaced. When the error happens because the file was deleted, removing it from the list is the proper way to handle the error, same use case as FileNotFoundException. When the error happens because the file was replaced, removing the file from the list will cause the file to be re-read so it will get the latest version of the file. Bug: 462868 Change-Id: I368af61a6cf73706601a3e4df4ef24f0aa0465c5 Signed-off-by: Hugo Arès <hugo.ares@ericsson.com>
This commit is contained in:
parent
d3a73c1407
commit
ae4b72d50e
|
@ -394,6 +394,7 @@ packfileCorruptionDetected=Packfile corruption detected: {0}
|
||||||
packFileInvalid=Pack file invalid: {0}
|
packFileInvalid=Pack file invalid: {0}
|
||||||
packfileIsTruncated=Packfile {0} is truncated.
|
packfileIsTruncated=Packfile {0} is truncated.
|
||||||
packfileIsTruncatedNoParam=Packfile is truncated.
|
packfileIsTruncatedNoParam=Packfile is truncated.
|
||||||
|
packHandleIsStale=Pack file {0} handle is stale, removing it from pack list
|
||||||
packHasUnresolvedDeltas=pack has unresolved deltas
|
packHasUnresolvedDeltas=pack has unresolved deltas
|
||||||
packingCancelledDuringObjectsWriting=Packing cancelled during objects writing
|
packingCancelledDuringObjectsWriting=Packing cancelled during objects writing
|
||||||
packObjectCountMismatch=Pack object count mismatch: pack {0} index {1}: {2}
|
packObjectCountMismatch=Pack object count mismatch: pack {0} index {1}: {2}
|
||||||
|
|
|
@ -453,6 +453,7 @@ public static JGitText get() {
|
||||||
/***/ public String packFileInvalid;
|
/***/ public String packFileInvalid;
|
||||||
/***/ public String packfileIsTruncated;
|
/***/ public String packfileIsTruncated;
|
||||||
/***/ public String packfileIsTruncatedNoParam;
|
/***/ public String packfileIsTruncatedNoParam;
|
||||||
|
/***/ public String packHandleIsStale;
|
||||||
/***/ public String packHasUnresolvedDeltas;
|
/***/ public String packHasUnresolvedDeltas;
|
||||||
/***/ public String packingCancelledDuringObjectsWriting;
|
/***/ public String packingCancelledDuringObjectsWriting;
|
||||||
/***/ public String packObjectCountMismatch;
|
/***/ public String packObjectCountMismatch;
|
||||||
|
|
|
@ -114,6 +114,8 @@ public class ObjectDirectory extends FileObjectDatabase {
|
||||||
/** Maximum number of candidates offered as resolutions of abbreviation. */
|
/** Maximum number of candidates offered as resolutions of abbreviation. */
|
||||||
private static final int RESOLVE_ABBREV_LIMIT = 256;
|
private static final int RESOLVE_ABBREV_LIMIT = 256;
|
||||||
|
|
||||||
|
private static final String STALE_FILE_HANDLE_MSG = "stale file handle"; //$NON-NLS-1$
|
||||||
|
|
||||||
private final Config config;
|
private final Config config;
|
||||||
|
|
||||||
private final File objects;
|
private final File objects;
|
||||||
|
@ -563,6 +565,10 @@ private void handlePackError(IOException e, PackFile p) {
|
||||||
} else if (e instanceof FileNotFoundException) {
|
} else if (e instanceof FileNotFoundException) {
|
||||||
warnTmpl = JGitText.get().packWasDeleted;
|
warnTmpl = JGitText.get().packWasDeleted;
|
||||||
removePack(p);
|
removePack(p);
|
||||||
|
} else if (e.getMessage() != null
|
||||||
|
&& e.getMessage().toLowerCase().contains(STALE_FILE_HANDLE_MSG)) {
|
||||||
|
warnTmpl = JGitText.get().packHandleIsStale;
|
||||||
|
removePack(p);
|
||||||
}
|
}
|
||||||
if (warnTmpl != null) {
|
if (warnTmpl != null) {
|
||||||
if (LOG.isDebugEnabled()) {
|
if (LOG.isDebugEnabled()) {
|
||||||
|
|
Loading…
Reference in New Issue