|
@@ -172,8 +172,6 @@ public class NNStorage extends Storage implements Closeable,
|
|
|
throws IOException {
|
|
|
super(NodeType.NAME_NODE);
|
|
|
|
|
|
- storageDirs = new CopyOnWriteArrayList<>();
|
|
|
-
|
|
|
// this may modify the editsDirs, so copy before passing in
|
|
|
setStorageDirectories(imageDirs,
|
|
|
Lists.newArrayList(editsDirs),
|
|
@@ -212,7 +210,7 @@ public class NNStorage extends Storage implements Closeable,
|
|
|
@Override // Closeable
|
|
|
public void close() throws IOException {
|
|
|
unlockAll();
|
|
|
- storageDirs.clear();
|
|
|
+ getStorageDirs().clear();
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -295,7 +293,7 @@ public class NNStorage extends Storage implements Closeable,
|
|
|
Collection<URI> fsEditsDirs,
|
|
|
Collection<URI> sharedEditsDirs)
|
|
|
throws IOException {
|
|
|
- this.storageDirs.clear();
|
|
|
+ getStorageDirs().clear();
|
|
|
this.removedStorageDirs.clear();
|
|
|
|
|
|
// Add all name dirs with appropriate NameNodeDirType
|
|
@@ -873,7 +871,7 @@ public class NNStorage extends Storage implements Closeable,
|
|
|
+ sd.getRoot().getPath(), e);
|
|
|
}
|
|
|
|
|
|
- if (this.storageDirs.remove(sd)) {
|
|
|
+ if (getStorageDirs().remove(sd)) {
|
|
|
this.removedStorageDirs.add(sd);
|
|
|
}
|
|
|
|
|
@@ -928,7 +926,7 @@ public class NNStorage extends Storage implements Closeable,
|
|
|
// getCanonicalPath may need to call stat() or readlink() and it's likely
|
|
|
// those calls would fail due to the same underlying IO problem.
|
|
|
String absPath = f.getAbsolutePath();
|
|
|
- for (StorageDirectory sd : storageDirs) {
|
|
|
+ for (StorageDirectory sd : getStorageDirs()) {
|
|
|
String dirPath = sd.getRoot().getAbsolutePath();
|
|
|
if (!dirPath.endsWith(File.separator)) {
|
|
|
dirPath += File.separator;
|
|
@@ -1140,14 +1138,14 @@ public class NNStorage extends Storage implements Closeable,
|
|
|
@Override
|
|
|
public void writeAll() throws IOException {
|
|
|
this.layoutVersion = getServiceLayoutVersion();
|
|
|
- for (StorageDirectory sd : storageDirs) {
|
|
|
+ for (StorageDirectory sd : getStorageDirs()) {
|
|
|
try {
|
|
|
writeProperties(sd);
|
|
|
} catch (Exception e) {
|
|
|
LOG.warn("Error during write properties to the VERSION file to " +
|
|
|
sd.toString(), e);
|
|
|
reportErrorsOnDirectory(sd);
|
|
|
- if (storageDirs.isEmpty()) {
|
|
|
+ if (getStorageDirs().isEmpty()) {
|
|
|
throw new IOException("All the storage failed while writing " +
|
|
|
"properties to VERSION file");
|
|
|
}
|