Rebuild routing table after Graph.reverse

GraphImpl.reverse used to reverse edges in each partition of the edge RDD but preserve the routing table and replicated vertex view, since reversing should not affect partitioning.

However, the old routing table would then have incorrect information for srcAttrOnly and dstAttrOnly. These RDDs should be switched.

A simple fix is for Graph.reverse to rebuild the routing table and replicated vertex view.

Thanks to Bogdan Ghidireac for reporting this issue on the [mailing list](http://apache-spark-user-list.1001560.n3.nabble.com/graph-reverse-amp-Pregel-API-td4338.html).

Author: Ankur Dave <ankurdave@gmail.com>

Closes #431 from ankurdave/fix-reverse-bug and squashes the following commits:

75d63cb [Ankur Dave] Rebuild routing table after Graph.reverse

(cherry picked from commit 235a47ce14b3c7523e79ce671355dea7ee06f4b7)
Signed-off-by: Reynold Xin <rxin@apache.org>
SPARK-1329: Create pid2vid with correct number of partitions

Each vertex partition is co-located with a pid2vid array created in RoutingTable.scala. This array maps edge partition IDs to the list of vertices in the current vertex partition that are mentioned by edges in that partition. Therefore the pid2vid array should have one entry per edge partition.

GraphX currently creates one entry per *vertex* partition, which is a bug that leads to an ArrayIndexOutOfBoundsException when there are more edge partitions than vertex partitions. This commit fixes the bug and adds a test for this case.

Resolves SPARK-1329. Thanks to Daniel Darabos for reporting this bug.

Author: Ankur Dave <ankurdave@gmail.com>

Closes #368 from ankurdave/fix-pid2vid-size and squashes the following commits:

5a5c52a [Ankur Dave] SPARK-1329: Create pid2vid with correct number of partitions

(cherry picked from commit 17d323455a9c8b640f149be4a81139ed638765b5)
Signed-off-by: Reynold Xin <rxin@apache.org>
remove unnecessary brace and semicolon in 'putBlockInfo.synchronize'  block

delete semicolon

Author: Chen Chao <crazyjvm@gmail.com>

Closes #411 from CrazyJvm/patch-5 and squashes the following commits:

72333a3 [Chen Chao] remove unnecessary brace
de5d9a7 [Chen Chao] style fix

(cherry picked from commit 016a87764a7eb1092b6489e5f411d9e67c56e027)
Signed-off-by: Reynold Xin <rxin@apache.org>
Fixing a race condition in event listener unit test

Author: Kan Zhang <kzhang@apache.org>

Closes #401 from kanzhang/fix-1475 and squashes the following commits:

c6058bd [Kan Zhang] Fixing a race condition in event listener unit test

(cherry picked from commit 38877ccf394a50bfd37c8433d4aafaa91683d3b8)
Signed-off-by: Reynold Xin <rxin@apache.org>