|
@@ -167,8 +167,6 @@ public class NNStorage extends Storage implements Closeable,
|
|
|
throws IOException {
|
|
|
super(NodeType.NAME_NODE);
|
|
|
|
|
|
- storageDirs = new CopyOnWriteArrayList<StorageDirectory>();
|
|
|
-
|
|
|
// this may modify the editsDirs, so copy before passing in
|
|
|
setStorageDirectories(imageDirs,
|
|
|
Lists.newArrayList(editsDirs),
|
|
@@ -206,7 +204,7 @@ public class NNStorage extends Storage implements Closeable,
|
|
|
@Override // Closeable
|
|
|
public void close() throws IOException {
|
|
|
unlockAll();
|
|
|
- storageDirs.clear();
|
|
|
+ getStorageDirs().clear();
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -291,7 +289,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
|
|
@@ -863,7 +861,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);
|
|
|
}
|
|
|
|
|
@@ -917,7 +915,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;
|
|
@@ -1125,14 +1123,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");
|
|
|
}
|