You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by om...@apache.org on 2011/03/04 05:45:18 UTC
svn commit: r1077694 - in
/hadoop/common/branches/branch-0.20-security-patches/src:
mapred/org/apache/hadoop/filecache/TrackerDistributedCacheManager.java
test/org/apache/hadoop/filecache/TestTrackerDistributedCacheManager.java
Author: omalley
Date: Fri Mar 4 04:45:18 2011
New Revision: 1077694
URL: http://svn.apache.org/viewvc?rev=1077694&view=rev
Log:
commit 66342093c9511328e08d51fe722e171cd49e2a86
Author: Owen O'Malley <om...@apache.org>
Date: Sat Sep 18 09:59:38 2010 -0700
fix refcounts for distributed cache when errors occur during initialization
Modified:
hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/filecache/TrackerDistributedCacheManager.java
hadoop/common/branches/branch-0.20-security-patches/src/test/org/apache/hadoop/filecache/TestTrackerDistributedCacheManager.java
Modified: hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/filecache/TrackerDistributedCacheManager.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/filecache/TrackerDistributedCacheManager.java?rev=1077694&r1=1077693&r2=1077694&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/filecache/TrackerDistributedCacheManager.java (original)
+++ hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/filecache/TrackerDistributedCacheManager.java Fri Mar 4 04:45:18 2011
@@ -179,17 +179,17 @@ public class TrackerDistributedCacheMana
if (!lcacheStatus.isInited()) {
if (isPublic) {
localizedPath = localizePublicCacheObject(conf,
- cache,
- confFileStamp,
- lcacheStatus, fileStatus,
- isArchive);
+ cache,
+ confFileStamp,
+ lcacheStatus, fileStatus,
+ isArchive);
} else {
localizedPath = localPath;
}
lcacheStatus.initComplete();
} else {
localizedPath = checkCacheStatusValidity(conf, cache, confFileStamp,
- lcacheStatus, fileStatus, isArchive);
+ lcacheStatus, fileStatus, isArchive);
}
}
@@ -214,14 +214,14 @@ public class TrackerDistributedCacheMana
compactCache(conf);
}
initSuccessful = true;
- return localizedPath;
- } finally {
- if (!initSuccessful) {
- synchronized (cachedArchives) {
- lcacheStatus.refcount--;
- }
+ } catch (IOException ie) {
+ synchronized (lcacheStatus) {
+ // release this cache
+ lcacheStatus.refcount -= 1;
+ throw ie;
}
}
+ return localizedPath;
}
/**
Modified: hadoop/common/branches/branch-0.20-security-patches/src/test/org/apache/hadoop/filecache/TestTrackerDistributedCacheManager.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-patches/src/test/org/apache/hadoop/filecache/TestTrackerDistributedCacheManager.java?rev=1077694&r1=1077693&r2=1077694&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security-patches/src/test/org/apache/hadoop/filecache/TestTrackerDistributedCacheManager.java (original)
+++ hadoop/common/branches/branch-0.20-security-patches/src/test/org/apache/hadoop/filecache/TestTrackerDistributedCacheManager.java Fri Mar 4 04:45:18 2011
@@ -294,8 +294,10 @@ public class TestTrackerDistributedCache
th = null;
for (TaskDistributedCacheManager.CacheFile c : handle.getCacheFiles()) {
try {
- assertEquals(0, manager.getReferenceCount(c.uri, conf2, c.timestamp,
- c.owner));
+ int refcount = manager.getReferenceCount(c.uri, conf2, c.timestamp,
+ c.owner);
+ LOG.info("checking refcount " + c.uri + " of " + refcount);
+ assertEquals(0, refcount);
} catch (IOException ie) {
th = ie;
LOG.info("Exception getting reference count for " + c.uri, ie);