Author: hairong
Date: Tue Jan 26 22:57:46 2010
New Revision: 903474

URL: http://svn.apache.org/viewvc?rev=903474&view=rev
Log:
Merge -c 903471 to bring the change made by HADOOP-6498 from the trunk to 
branch 0.21.

Modified:
    hadoop/common/branches/branch-0.21/   (props changed)
    hadoop/common/branches/branch-0.21/CHANGES.txt   (contents, props changed)
    hadoop/common/branches/branch-0.21/src/contrib/ec2/   (props changed)
    hadoop/common/branches/branch-0.21/src/docs/   (props changed)
    hadoop/common/branches/branch-0.21/src/java/   (props changed)
    
hadoop/common/branches/branch-0.21/src/java/org/apache/hadoop/ipc/Client.java
    hadoop/common/branches/branch-0.21/src/test/core/   (props changed)
    
hadoop/common/branches/branch-0.21/src/test/core/org/apache/hadoop/ipc/TestIPC.java

Propchange: hadoop/common/branches/branch-0.21/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jan 26 22:57:46 2010
@@ -1,2 +1,2 @@
-/hadoop/common/trunk:818543,819670,824900-824942,831032,831070,832157,884428,885534,888565,889378,891132,901540
+/hadoop/common/trunk:818543,819670,824900-824942,831032,831070,832157,884428,885534,888565,889378,891132,901540,903471
 /hadoop/core/branches/branch-0.19/core:713112

Modified: hadoop/common/branches/branch-0.21/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.21/CHANGES.txt?rev=903474&r1=903473&r2=903474&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.21/CHANGES.txt (original)
+++ hadoop/common/branches/branch-0.21/CHANGES.txt Tue Jan 26 22:57:46 2010
@@ -1175,6 +1175,9 @@
     HADOOP-6315. Avoid incorrect use of BuiltInflater/BuiltInDeflater in
     GzipCodec. (Aaron Kimball via cdouglas)
 
+    HADOOP-6498. IPC client bug may cause rpc call hang. (Ruyue Ma and
+    hairong via hairong)
+
 Release 0.20.1 - 2009-09-01
 
   INCOMPATIBLE CHANGES

Propchange: hadoop/common/branches/branch-0.21/CHANGES.txt
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jan 26 22:57:46 2010
@@ -1,4 +1,4 @@
-/hadoop/common/trunk/CHANGES.txt:818543,819670,823756,824900-824942,831032,831070,832157,884428,888565,889378,891132,901540
+/hadoop/common/trunk/CHANGES.txt:818543,819670,823756,824900-824942,831032,831070,832157,884428,888565,889378,891132,901540,903471
 /hadoop/core/branches/branch-0.18/CHANGES.txt:727226
 /hadoop/core/branches/branch-0.19/CHANGES.txt:713112
 /hadoop/core/trunk/CHANGES.txt:776175-785643,785929-786278

Propchange: hadoop/common/branches/branch-0.21/src/contrib/ec2/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jan 26 22:57:46 2010
@@ -1,3 +1,3 @@
-/hadoop/common/trunk/src/contrib/ec2:818543,819670,831032,831070,832157,884428,885534,888565,889378,891132,901540
+/hadoop/common/trunk/src/contrib/ec2:818543,819670,831032,831070,832157,884428,885534,888565,889378,891132,901540,903471
 /hadoop/core/branches/branch-0.19/core/src/contrib/ec2:713112
 /hadoop/core/trunk/src/contrib/ec2:776175-784663

Propchange: hadoop/common/branches/branch-0.21/src/docs/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jan 26 22:57:46 2010
@@ -1,2 +1,2 @@
-/hadoop/common/trunk/src/docs:818543,819670,831032,831070,832157,884428,885534,888565,889378,891132,901540
+/hadoop/common/trunk/src/docs:818543,819670,831032,831070,832157,884428,885534,888565,889378,891132,901540,903471
 /hadoop/core/branches/branch-0.19/src/docs:713112

Propchange: hadoop/common/branches/branch-0.21/src/java/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jan 26 22:57:46 2010
@@ -1,3 +1,3 @@
-/hadoop/common/trunk/src/java:818543,819670,831032,831070,832157,884428,885534,888565,889378,891132,901540
+/hadoop/common/trunk/src/java:818543,819670,831032,831070,832157,884428,885534,888565,889378,891132,901540,903471
 /hadoop/core/branches/branch-0.19/core/src/java:713112
 /hadoop/core/trunk/src/core:776175-785643,785929-786278

Modified: 
hadoop/common/branches/branch-0.21/src/java/org/apache/hadoop/ipc/Client.java
URL: 
http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.21/src/java/org/apache/hadoop/ipc/Client.java?rev=903474&r1=903473&r2=903474&view=diff
==============================================================================
--- 
hadoop/common/branches/branch-0.21/src/java/org/apache/hadoop/ipc/Client.java 
(original)
+++ 
hadoop/common/branches/branch-0.21/src/java/org/apache/hadoop/ipc/Client.java 
Tue Jan 26 22:57:46 2010
@@ -529,13 +529,14 @@
         if (LOG.isDebugEnabled())
           LOG.debug(getName() + " got value #" + id);
 
-        Call call = calls.remove(id);
+        Call call = calls.get(id);
 
         int state = in.readInt();     // read call status
         if (state == Status.SUCCESS.state) {
           Writable value = ReflectionUtils.newInstance(valueClass, conf);
           value.readFields(in);                 // read value
           call.setValue(value);
+          calls.remove(id);
         } else if (state == Status.ERROR.state) {
           call.setException(new RemoteException(WritableUtils.readString(in),
                                                 WritableUtils.readString(in)));

Propchange: hadoop/common/branches/branch-0.21/src/test/core/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jan 26 22:57:46 2010
@@ -1,3 +1,3 @@
-/hadoop/common/trunk/src/test/core:818543,819670,831032,831070,832157,884428,885534,888565,889378,891132,901540
+/hadoop/common/trunk/src/test/core:818543,819670,831032,831070,832157,884428,885534,888565,889378,891132,901540,903471
 /hadoop/core/branches/branch-0.19/core/src/test/core:713112
 /hadoop/core/trunk/src/test/core:776175-785643,785929-786278

Modified: 
hadoop/common/branches/branch-0.21/src/test/core/org/apache/hadoop/ipc/TestIPC.java
URL: 
http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.21/src/test/core/org/apache/hadoop/ipc/TestIPC.java?rev=903474&r1=903473&r2=903474&view=diff
==============================================================================
--- 
hadoop/common/branches/branch-0.21/src/test/core/org/apache/hadoop/ipc/TestIPC.java
 (original)
+++ 
hadoop/common/branches/branch-0.21/src/test/core/org/apache/hadoop/ipc/TestIPC.java
 Tue Jan 26 22:57:46 2010
@@ -26,6 +26,7 @@
 import org.apache.hadoop.net.NetUtils;
 
 import java.util.Random;
+import java.io.DataInput;
 import java.io.IOException;
 import java.net.InetSocketAddress;
 
@@ -88,7 +89,7 @@
         try {
           LongWritable param = new LongWritable(RANDOM.nextLong());
           LongWritable value =
-            (LongWritable)client.call(param, server);
+            (LongWritable)client.call(param, server, null, null);
           if (!param.equals(value)) {
             LOG.fatal("Call failed!");
             failed = true;
@@ -121,7 +122,7 @@
           Writable[] params = new Writable[addresses.length];
           for (int j = 0; j < addresses.length; j++)
             params[j] = new LongWritable(RANDOM.nextLong());
-          Writable[] values = client.call(params, addresses);
+          Writable[] values = client.call(params, addresses, null, null);
           for (int j = 0; j < addresses.length; j++) {
             if (!params[j].equals(values[j])) {
               LOG.fatal("Call failed!");
@@ -216,7 +217,7 @@
     InetSocketAddress address = new InetSocketAddress("127.0.0.1", 10);
     try {
       client.call(new LongWritable(RANDOM.nextLong()),
-              address);
+              address, null, null);
       fail("Expected an exception to have been thrown");
     } catch (IOException e) {
       String message = e.getMessage();
@@ -231,6 +232,41 @@
     }
   }
 
+  private static class LongErrorWritable extends LongWritable {
+    private final static String ERR_MSG = 
+      "Come across an exception while reading";
+    
+    LongErrorWritable() {}
+    
+    LongErrorWritable(long longValue) {
+      super(longValue);
+    }
+    
+    public void readFields(DataInput in) throws IOException {
+      super.readFields(in);
+      throw new IOException(ERR_MSG);
+    }
+  }
+  public void testErrorClient() throws Exception {
+    // start server
+    Server server = new TestServer(1, false);
+    InetSocketAddress addr = NetUtils.getConnectAddress(server);
+    server.start();
+
+    // start client
+    Client client = new Client(LongErrorWritable.class, conf);
+    try {
+      client.call(new LongErrorWritable(RANDOM.nextLong()),
+              addr, null, null);
+      fail("Expected an exception to have been thrown");
+    } catch (IOException e) {
+      // check error
+      Throwable cause = e.getCause();
+      assertTrue(cause instanceof IOException);
+      assertEquals(LongErrorWritable.ERR_MSG, cause.getMessage());
+    }
+  }
+
 
   public static void main(String[] args) throws Exception {
 


Reply via email to