YARN-2749. Fix some testcases from TestLogAggregationService fails in trunk. (Contributed by Xuan Gong)
This commit is contained in:
parent
3338f6d907
commit
ab0b958a52
@ -599,6 +599,9 @@ Release 2.7.0 - UNRELEASED
|
|||||||
YARN-2899. Run TestDockerContainerExecutorWithMocks on Linux only.
|
YARN-2899. Run TestDockerContainerExecutorWithMocks on Linux only.
|
||||||
(Ming Ma via cnauroth)
|
(Ming Ma via cnauroth)
|
||||||
|
|
||||||
|
YARN-2749. Fix some testcases from TestLogAggregationService fails in trunk.
|
||||||
|
(Xuan Gong via junping_du)
|
||||||
|
|
||||||
Release 2.6.0 - 2014-11-18
|
Release 2.6.0 - 2014-11-18
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
@ -117,6 +117,8 @@ public class AppLogAggregatorImpl implements AppLogAggregator {
|
|||||||
private final int retentionSize;
|
private final int retentionSize;
|
||||||
private final long rollingMonitorInterval;
|
private final long rollingMonitorInterval;
|
||||||
private final NodeId nodeId;
|
private final NodeId nodeId;
|
||||||
|
// This variable is only for testing
|
||||||
|
private final AtomicBoolean waiting = new AtomicBoolean(false);
|
||||||
|
|
||||||
private final Map<ContainerId, ContainerLogAggregator> containerLogAggregators =
|
private final Map<ContainerId, ContainerLogAggregator> containerLogAggregators =
|
||||||
new HashMap<ContainerId, ContainerLogAggregator>();
|
new HashMap<ContainerId, ContainerLogAggregator>();
|
||||||
@ -391,6 +393,7 @@ private void doAppLogAggregation() {
|
|||||||
while (!this.appFinishing.get() && !this.aborted.get()) {
|
while (!this.appFinishing.get() && !this.aborted.get()) {
|
||||||
synchronized(this) {
|
synchronized(this) {
|
||||||
try {
|
try {
|
||||||
|
waiting.set(true);
|
||||||
if (this.rollingMonitorInterval > 0) {
|
if (this.rollingMonitorInterval > 0) {
|
||||||
wait(this.rollingMonitorInterval * 1000);
|
wait(this.rollingMonitorInterval * 1000);
|
||||||
if (this.appFinishing.get() || this.aborted.get()) {
|
if (this.appFinishing.get() || this.aborted.get()) {
|
||||||
@ -507,7 +510,19 @@ public synchronized void abortLogAggregation() {
|
|||||||
|
|
||||||
@Private
|
@Private
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
|
// This is only used for testing.
|
||||||
|
// This will wake the log aggregation thread that is waiting for
|
||||||
|
// rollingMonitorInterval.
|
||||||
|
// To use this method, make sure the log aggregation thread is running
|
||||||
|
// and waiting for rollingMonitorInterval.
|
||||||
public synchronized void doLogAggregationOutOfBand() {
|
public synchronized void doLogAggregationOutOfBand() {
|
||||||
|
while(!waiting.get()) {
|
||||||
|
try {
|
||||||
|
wait(200);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
// Do Nothing
|
||||||
|
}
|
||||||
|
}
|
||||||
LOG.info("Do OutOfBand log aggregation");
|
LOG.info("Do OutOfBand log aggregation");
|
||||||
this.notifyAll();
|
this.notifyAll();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user