merge -r 1365239:1365240 from trunk. FIXES: MAPREDUCE-4467
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1365241 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
99f87b520e
commit
dce4a7c765
|
@ -625,6 +625,9 @@ Release 0.23.3 - UNRELEASED
|
||||||
maximum-am-resource-percent configurable on a per queue basis (tgraves via
|
maximum-am-resource-percent configurable on a per queue basis (tgraves via
|
||||||
bobby)
|
bobby)
|
||||||
|
|
||||||
|
MAPREDUCE-4467. IndexCache failures due to missing synchronization
|
||||||
|
(Kihwal Lee via tgraves)
|
||||||
|
|
||||||
Release 0.23.2 - UNRELEASED
|
Release 0.23.2 - UNRELEASED
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -67,15 +67,15 @@ class IndexCache {
|
||||||
if (info == null) {
|
if (info == null) {
|
||||||
info = readIndexFileToCache(fileName, mapId, expectedIndexOwner);
|
info = readIndexFileToCache(fileName, mapId, expectedIndexOwner);
|
||||||
} else {
|
} else {
|
||||||
|
synchronized(info) {
|
||||||
while (isUnderConstruction(info)) {
|
while (isUnderConstruction(info)) {
|
||||||
try {
|
try {
|
||||||
// In case the entry is ready after the above check but
|
info.wait();
|
||||||
// before the following wait, we do timed wait.
|
|
||||||
info.wait(200);
|
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
throw new IOException("Interrupted waiting for construction", e);
|
throw new IOException("Interrupted waiting for construction", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
LOG.debug("IndexCache HIT: MapId " + mapId + " found");
|
LOG.debug("IndexCache HIT: MapId " + mapId + " found");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,15 +101,15 @@ class IndexCache {
|
||||||
IndexInformation info;
|
IndexInformation info;
|
||||||
IndexInformation newInd = new IndexInformation();
|
IndexInformation newInd = new IndexInformation();
|
||||||
if ((info = cache.putIfAbsent(mapId, newInd)) != null) {
|
if ((info = cache.putIfAbsent(mapId, newInd)) != null) {
|
||||||
|
synchronized(info) {
|
||||||
while (isUnderConstruction(info)) {
|
while (isUnderConstruction(info)) {
|
||||||
try {
|
try {
|
||||||
// In case the entry is ready after the above check but
|
info.wait();
|
||||||
// before the following wait, we do timed wait.
|
|
||||||
info.wait(200);
|
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
throw new IOException("Interrupted waiting for construction", e);
|
throw new IOException("Interrupted waiting for construction", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
LOG.debug("IndexCache HIT: MapId " + mapId + " found");
|
LOG.debug("IndexCache HIT: MapId " + mapId + " found");
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue