You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@giraph.apache.org by ma...@apache.org on 2016/07/13 20:57:47 UTC

git commit: updated refs/heads/trunk to 8a2ec5e

Repository: giraph
Updated Branches:
  refs/heads/trunk 72562004c -> 8a2ec5ebd


[GIRAPH-1091] Fix SimpleRangePartitionFactoryTest

Summary: SimpleRangePartitionFactoryTest relied on old logic for calculating number of partitions and got broken with GIRAPH-1082.

Test Plan: Ran the test

Differential Revision: https://reviews.facebook.net/D60747


Project: http://git-wip-us.apache.org/repos/asf/giraph/repo
Commit: http://git-wip-us.apache.org/repos/asf/giraph/commit/8a2ec5eb
Tree: http://git-wip-us.apache.org/repos/asf/giraph/tree/8a2ec5eb
Diff: http://git-wip-us.apache.org/repos/asf/giraph/diff/8a2ec5eb

Branch: refs/heads/trunk
Commit: 8a2ec5ebd9afa8a299cfdd5d3cd359898346588a
Parents: 7256200
Author: Maja Kabiljo <ma...@fb.com>
Authored: Wed Jul 13 11:05:48 2016 -0700
Committer: Maja Kabiljo <ma...@fb.com>
Committed: Wed Jul 13 11:09:59 2016 -0700

----------------------------------------------------------------------
 .../partition/SimpleRangePartitionFactoryTest.java    | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/giraph/blob/8a2ec5eb/giraph-core/src/test/java/org/apache/giraph/partition/SimpleRangePartitionFactoryTest.java
----------------------------------------------------------------------
diff --git a/giraph-core/src/test/java/org/apache/giraph/partition/SimpleRangePartitionFactoryTest.java b/giraph-core/src/test/java/org/apache/giraph/partition/SimpleRangePartitionFactoryTest.java
index 4bb132b..67863dc 100644
--- a/giraph-core/src/test/java/org/apache/giraph/partition/SimpleRangePartitionFactoryTest.java
+++ b/giraph-core/src/test/java/org/apache/giraph/partition/SimpleRangePartitionFactoryTest.java
@@ -38,9 +38,11 @@ import static org.junit.Assert.assertEquals;
 /** Test {@link org.apache.giraph.partition.SimpleLongRangePartitionerFactory}. */
 public class SimpleRangePartitionFactoryTest {
 
-  private void testRange(int numWorkers, int keySpaceSize, int allowedWorkerDiff, boolean emptyWorkers) {
+  private void testRange(int numWorkers, int numPartitions, int keySpaceSize,
+      int allowedWorkerDiff, boolean emptyWorkers) {
     Configuration conf = new Configuration();
     conf.setLong(GiraphConstants.PARTITION_VERTEX_KEY_SPACE_SIZE, keySpaceSize);
+    GiraphConstants.USER_PARTITION_COUNT.set(conf, numPartitions);
     SimpleLongRangePartitionerFactory<Writable, Writable> factory =
         new SimpleLongRangePartitionerFactory<Writable, Writable>();
     factory.setConf(new ImmutableClassesGiraphConfiguration(conf));
@@ -106,14 +108,14 @@ public class SimpleRangePartitionFactoryTest {
   @Test
   public void testLongRangePartitionerFactory() {
     // perfect distribution
-    testRange(10, 100000, 0, false);
-    testRange(1000, 100000, 0, false);
+    testRange(10, 1000, 100000, 0, false);
+    testRange(1000, 50000, 100000, 0, false);
 
     // perfect distribution even when max is hit, and max is not divisible by #workers
-    testRange(8949, 100023, 0, false);
-    testRange(1949, 211111, 0, false);
+    testRange(8949, (50000 / 8949) * 8949, 100023, 0, false);
+    testRange(1949, (50000 / 1949) * 1949, 211111, 0, false);
 
     // imperfect distribution - because there are more workers than max partitions.
-    testRange(194942, 211111, 1, true);
+    testRange(194942, 50000, 211111, 1, true);
   }
 }