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
db5b804238
commit
b80ff6ea57
@ -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.
|
||||
@ -277,7 +278,7 @@ void deregisterDirsChangeListener(
|
||||
List<String> getGoodDirs() {
|
||||
this.readLock.lock();
|
||||
try {
|
||||
return Collections.unmodifiableList(localDirs);
|
||||
return ImmutableList.copyOf(localDirs);
|
||||
} finally {
|
||||
this.readLock.unlock();
|
||||
}
|
||||
@ -289,7 +290,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();
|
||||
@ -302,7 +303,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