YARN-9833. Race condition when DirectoryCollection.checkDirs() runs during container launch. Contributed by Peter Bacsko.
(cherry picked from commit c474e24c0b73c0f52a7d5af2495355f4a0799344)
This commit is contained in:
parent
1978317068
commit
45cf3de2e9
@ -50,6 +50,7 @@
|
||||
import org.apache.hadoop.yarn.exceptions.YarnRuntimeException;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
/**
|
||||
* Manages a list of local storage directories.
|
||||
@ -230,7 +231,7 @@ void deregisterDirsChangeListener(
|
||||
List<String> getGoodDirs() {
|
||||
this.readLock.lock();
|
||||
try {
|
||||
return Collections.unmodifiableList(localDirs);
|
||||
return ImmutableList.copyOf(localDirs);
|
||||
} finally {
|
||||
this.readLock.unlock();
|
||||
}
|
||||
@ -242,7 +243,7 @@ List<String> getGoodDirs() {
|
||||
List<String> getFailedDirs() {
|
||||
this.readLock.lock();
|
||||
try {
|
||||
return Collections.unmodifiableList(
|
||||
return ImmutableList.copyOf(
|
||||
DirectoryCollection.concat(errorDirs, fullDirs));
|
||||
} finally {
|
||||
this.readLock.unlock();
|
||||
@ -255,7 +256,7 @@ List<String> getFailedDirs() {
|
||||
List<String> getFullDirs() {
|
||||
this.readLock.lock();
|
||||
try {
|
||||
return Collections.unmodifiableList(fullDirs);
|
||||
return ImmutableList.copyOf(fullDirs);
|
||||
} finally {
|
||||
this.readLock.unlock();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user