hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cdoug...@apache.org
Subject svn commit: r768037 - in /hadoop/core/trunk: CHANGES.txt src/mapred/org/apache/hadoop/mapred/MapTask.java src/test/findbugsExcludeFile.xml
Date Thu, 23 Apr 2009 20:20:28 GMT
Author: cdouglas
Date: Thu Apr 23 20:20:28 2009
New Revision: 768037

URL: http://svn.apache.org/viewvc?rev=768037&view=rev
Log:
HADOOP-5709. Remove redundant synchronization added in HADOOP-5661. Contributed by Jothi Padmanabhan.

Modified:
    hadoop/core/trunk/CHANGES.txt
    hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/MapTask.java
    hadoop/core/trunk/src/test/findbugsExcludeFile.xml

Modified: hadoop/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/CHANGES.txt?rev=768037&r1=768036&r2=768037&view=diff
==============================================================================
--- hadoop/core/trunk/CHANGES.txt (original)
+++ hadoop/core/trunk/CHANGES.txt Thu Apr 23 20:20:28 2009
@@ -434,6 +434,9 @@
 
     HADOOP-5658. Fix Eclipse templates. (Philip Zeyliger via shv)
 
+    HADOOP-5709. Remove redundant synchronization added in HADOOP-5661. (Jothi
+    Padmanabhan via cdouglas)
+
 Release 0.20.1 - Unreleased
 
   INCOMPATIBLE CHANGES

Modified: hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/MapTask.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/MapTask.java?rev=768037&r1=768036&r2=768037&view=diff
==============================================================================
--- hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/MapTask.java (original)
+++ hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/MapTask.java Thu Apr 23 20:20:28
2009
@@ -936,67 +936,65 @@
           throws IOException {
         boolean buffull = false;
         boolean wrap = false;
-        synchronized(MapOutputBuffer.this) { 
-	        spillLock.lock();
-	        try {
-	          do {
-	            if (sortSpillException != null) {
-	              throw (IOException)new IOException("Spill failed"
-	                  ).initCause(sortSpillException);
-	            }
-	
-	            // sufficient buffer space?
-	            if (bufstart <= bufend && bufend <= bufindex) {
-	              buffull = bufindex + len > bufvoid;
-	              wrap = (bufvoid - bufindex) + bufstart > len;
-	            } else {
-	              // bufindex <= bufstart <= bufend
-	              // bufend <= bufindex <= bufstart
-	              wrap = false;
-	              buffull = bufindex + len > bufstart;
-	            }
-	
-	            if (kvstart == kvend) {
-	              // spill thread not running
-	              if (kvend != kvindex) {
-	                // we have records we can spill
-	                final boolean bufsoftlimit = (bufindex > bufend)
-	                  ? bufindex - bufend > softBufferLimit
-	                  : bufend - bufindex < bufvoid - softBufferLimit;
-	                if (bufsoftlimit || (buffull && !wrap)) {
-	                  LOG.info("Spilling map output: buffer full= " + bufsoftlimit);
-	                  startSpill();
-	                }
-	              } else if (buffull && !wrap) {
-	                // We have no buffered records, and this record is too large
-	                // to write into kvbuffer. We must spill it directly from
-	                // collect
-	                final int size = ((bufend <= bufindex)
-	                  ? bufindex - bufend
-	                  : (bufvoid - bufend) + bufindex) + len;
-	                bufstart = bufend = bufindex = bufmark = 0;
-	                kvstart = kvend = kvindex = 0;
-	                bufvoid = kvbuffer.length;
-	                throw new MapBufferTooSmallException(size + " bytes");
-	              }
-	            }
-	
-	            if (buffull && !wrap) {
-	              try {
-	                while (kvstart != kvend) {
-	                  reporter.progress();
-	                  spillDone.await();
-	                }
-	              } catch (InterruptedException e) {
-	                  throw (IOException)new IOException(
-	                      "Buffer interrupted while waiting for the writer"
-	                      ).initCause(e);
-	              }
-	            }
-	          } while (buffull && !wrap);
-	        } finally {
-	          spillLock.unlock();
-	        }
+        spillLock.lock();
+        try {
+          do {
+            if (sortSpillException != null) {
+              throw (IOException)new IOException("Spill failed"
+                  ).initCause(sortSpillException);
+            }
+
+            // sufficient buffer space?
+            if (bufstart <= bufend && bufend <= bufindex) {
+              buffull = bufindex + len > bufvoid;
+              wrap = (bufvoid - bufindex) + bufstart > len;
+            } else {
+              // bufindex <= bufstart <= bufend
+              // bufend <= bufindex <= bufstart
+              wrap = false;
+              buffull = bufindex + len > bufstart;
+            }
+
+            if (kvstart == kvend) {
+              // spill thread not running
+              if (kvend != kvindex) {
+                // we have records we can spill
+                final boolean bufsoftlimit = (bufindex > bufend)
+                  ? bufindex - bufend > softBufferLimit
+                  : bufend - bufindex < bufvoid - softBufferLimit;
+                if (bufsoftlimit || (buffull && !wrap)) {
+                  LOG.info("Spilling map output: buffer full= " + bufsoftlimit);
+                  startSpill();
+                }
+              } else if (buffull && !wrap) {
+                // We have no buffered records, and this record is too large
+                // to write into kvbuffer. We must spill it directly from
+                // collect
+                final int size = ((bufend <= bufindex)
+                  ? bufindex - bufend
+                  : (bufvoid - bufend) + bufindex) + len;
+                bufstart = bufend = bufindex = bufmark = 0;
+                kvstart = kvend = kvindex = 0;
+                bufvoid = kvbuffer.length;
+                throw new MapBufferTooSmallException(size + " bytes");
+              }
+            }
+
+            if (buffull && !wrap) {
+              try {
+                while (kvstart != kvend) {
+                  reporter.progress();
+                  spillDone.await();
+                }
+              } catch (InterruptedException e) {
+                  throw (IOException)new IOException(
+                      "Buffer interrupted while waiting for the writer"
+                      ).initCause(e);
+              }
+            }
+          } while (buffull && !wrap);
+        } finally {
+          spillLock.unlock();
         }
         // here, we know that we have sufficient space to write
         if (buffull) {

Modified: hadoop/core/trunk/src/test/findbugsExcludeFile.xml
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/findbugsExcludeFile.xml?rev=768037&r1=768036&r2=768037&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/findbugsExcludeFile.xml (original)
+++ hadoop/core/trunk/src/test/findbugsExcludeFile.xml Thu Apr 23 20:20:28 2009
@@ -128,4 +128,12 @@
        <Method name="getSplits" />
        <Bug pattern="DLS_DEAD_LOCAL_STORE" />
      </Match>
+    <!--
+      This is a spurious warning. Just ignore
+    -->
+     <Match>
+       <Class name="org.apache.hadoop.mapred.MapTask$MapOutputBuffer" />
+       <Field name="kvindex" />
+       <Bug pattern="IS2_INCONSISTENT_SYNC" />
+     </Match>
 </FindBugsFilter>



Mime
View raw message