public final class EphemeralFsFileSystemChecker extends Object
| Constructor and Description |
|---|
EphemeralFsFileSystemChecker() |
| Modifier and Type | Method and Description |
|---|---|
static void |
assertAllDirectoriesFsynced(Path dir,
boolean recursive)
Scans directories to make sure the directories have been fsycned.
|
static void |
assertAllFilesFsynced(Path path)
If path is a file, asserts that all changes to the file have been fsynced, if path is a directory,
recursively scans the directory and asserts that all changes to files found have been fsynced.
|
static void |
assertNoOpenResources(FileSystem fs)
Throw if there are any open resources for this file system.
|
public static void assertNoOpenResources(FileSystem fs) throws AssertionError, ClassCastException
fs - A FileSystem created with EphemeralFsFileSystemBuilder.build()AssertionError - if a resource is openClassCastException - if fs is of the wrong typeEphemeralFsFileSystemBuilder.setRecordStackTracesOnOpen(boolean)public static void assertAllFilesFsynced(Path path) throws AssertionError, ClassCastException, IllegalArgumentException
path - A Path whose FileSystemProvider is EphemeralFsFileSystemProviderAssertionError - if a file has not been fsyncedIllegalArgumentException - if path does not existClassCastException - if path is of the wrong typepublic static void assertAllDirectoriesFsynced(Path dir, boolean recursive) throws AssertionError, ClassCastException, IllegalArgumentException
This does not make sure that files have been fsynced, just the directories. In unix when adding/removing a file from a directory, the directory must be fsynced. Java inadvertently provides a way to do this on unix file systems by opening a FileChannel on a directory for reading and fsyncing that directory.
Fsyncing directories may not be supported in java 9, see LUCENE-6169
dir - A directory Path whose FileSystemProvider is EphemeralFsFileSystemProviderrecursive - if true recursively scans sub directories to find non fsycned directoriesAssertionError - if a directory has not been closedIllegalArgumentException - if path does not exist, or is not a directoryClassCastException - if path is of the wrong typeCopyright © 2015. All rights reserved.