You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@giraph.apache.org by jg...@apache.org on 2012/08/07 02:47:22 UTC

svn commit: r1370085 - in /giraph/trunk: CHANGELOG src/main/java/org/apache/giraph/comm/BasicRPCCommunications.java src/main/java/org/apache/giraph/comm/CommunicationsInterface.java src/test/java/org/apache/giraph/TestGraphPartitioner.java

Author: jghoman
Date: Tue Aug  7 00:47:21 2012
New Revision: 1370085

URL: http://svn.apache.org/viewvc?rev=1370085&view=rev
Log:
GIRAPH-276. Fix broken tests in pseudo-distributed mode. Contributed by Alessandro Presta

Modified:
    giraph/trunk/CHANGELOG
    giraph/trunk/src/main/java/org/apache/giraph/comm/BasicRPCCommunications.java
    giraph/trunk/src/main/java/org/apache/giraph/comm/CommunicationsInterface.java
    giraph/trunk/src/test/java/org/apache/giraph/TestGraphPartitioner.java

Modified: giraph/trunk/CHANGELOG
URL: http://svn.apache.org/viewvc/giraph/trunk/CHANGELOG?rev=1370085&r1=1370084&r2=1370085&view=diff
==============================================================================
--- giraph/trunk/CHANGELOG (original)
+++ giraph/trunk/CHANGELOG Tue Aug  7 00:47:21 2012
@@ -2,6 +2,9 @@ Giraph Change Log
 
 Release 0.2.0 - unreleased
 
+  GIRAPH-276: Fix broken tests in pseudo-distributed mode.
+  (Alessandro Presta via jghoman)
+
   GIRAPH-281: Add options to control Netty's per-channel receive and
   send buffer sizes (ekoontz via aching).
 

Modified: giraph/trunk/src/main/java/org/apache/giraph/comm/BasicRPCCommunications.java
URL: http://svn.apache.org/viewvc/giraph/trunk/src/main/java/org/apache/giraph/comm/BasicRPCCommunications.java?rev=1370085&r1=1370084&r2=1370085&view=diff
==============================================================================
--- giraph/trunk/src/main/java/org/apache/giraph/comm/BasicRPCCommunications.java (original)
+++ giraph/trunk/src/main/java/org/apache/giraph/comm/BasicRPCCommunications.java Tue Aug  7 00:47:21 2012
@@ -828,17 +828,18 @@ public abstract class BasicRPCCommunicat
   }
 
   @Override
-  public final void addEdge(I vertexIndex, Edge<I, E> edge) {
+  public final void addEdge(I sourceVertexId, I targetVertexId, E edgeValue) {
+    Edge<I, E> edge = new Edge<I, E>(targetVertexId, edgeValue);
     if (LOG.isDebugEnabled()) {
       LOG.debug("addEdge: Adding edge " + edge);
     }
     synchronized (inVertexMutationsMap) {
       VertexMutations<I, V, E, M> vertexMutations = null;
-      if (!inVertexMutationsMap.containsKey(vertexIndex)) {
+      if (!inVertexMutationsMap.containsKey(sourceVertexId)) {
         vertexMutations = new VertexMutations<I, V, E, M>();
-        inVertexMutationsMap.put(vertexIndex, vertexMutations);
+        inVertexMutationsMap.put(sourceVertexId, vertexMutations);
       } else {
-        vertexMutations = inVertexMutationsMap.get(vertexIndex);
+        vertexMutations = inVertexMutationsMap.get(sourceVertexId);
       }
       vertexMutations.addEdge(edge);
     }
@@ -1023,7 +1024,7 @@ public abstract class BasicRPCCommunicat
     }
     CommunicationsInterface<I, V, E, M> rpcProxy =
         peerConnections.get(addr).getRPCProxy();
-    rpcProxy.addEdge(destVertex, edge);
+    rpcProxy.addEdge(destVertex, edge.getTargetVertexId(), edge.getValue());
   }
 
   @Override

Modified: giraph/trunk/src/main/java/org/apache/giraph/comm/CommunicationsInterface.java
URL: http://svn.apache.org/viewvc/giraph/trunk/src/main/java/org/apache/giraph/comm/CommunicationsInterface.java?rev=1370085&r1=1370084&r2=1370085&view=diff
==============================================================================
--- giraph/trunk/src/main/java/org/apache/giraph/comm/CommunicationsInterface.java (original)
+++ giraph/trunk/src/main/java/org/apache/giraph/comm/CommunicationsInterface.java Tue Aug  7 00:47:21 2012
@@ -18,7 +18,6 @@
 
 package org.apache.giraph.comm;
 
-import org.apache.giraph.graph.Edge;
 import org.apache.giraph.graph.Vertex;
 /*if[HADOOP_NON_SECURE]
  else[HADOOP_NON_SECURE]*/
@@ -94,11 +93,13 @@ public interface CommunicationsInterface
   /**
    * Add an edge to a remote vertex
    *
-   * @param vertexIndex Vertex index where the edge is added
-   * @param edge Edge to be added
+   * @param sourceVertexId Source vertex id
+   * @param targetVertexId Target vertex id
+   * @param edgeValue Edge value
    * @throws IOException
    */
-  void addEdge(I vertexIndex, Edge<I, E> edge) throws IOException;
+  void addEdge(I sourceVertexId, I targetVertexId,
+               E edgeValue) throws IOException;
 
   /**
    * Remove an edge on a remote vertex

Modified: giraph/trunk/src/test/java/org/apache/giraph/TestGraphPartitioner.java
URL: http://svn.apache.org/viewvc/giraph/trunk/src/test/java/org/apache/giraph/TestGraphPartitioner.java?rev=1370085&r1=1370084&r2=1370085&view=diff
==============================================================================
--- giraph/trunk/src/test/java/org/apache/giraph/TestGraphPartitioner.java (original)
+++ giraph/trunk/src/test/java/org/apache/giraph/TestGraphPartitioner.java Tue Aug  7 00:47:21 2012
@@ -47,7 +47,8 @@ public class TestGraphPartitioner extend
 
     private void verifyOutput(FileSystem fs, Path outputPath)
         throws IOException {
-      final int correctLen = 123;
+      // TODO: this is fragile (breaks with legit serialization changes)
+      final int correctLen = 120;
       if (runningInDistributedMode()) {
         FileStatus [] fileStatusArr = fs.listStatus(outputPath);
         int totalLen = 0;