Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

replication

  • Loading branch information...
commit a52761515d07c592e70eb555535ad638e3e36f01 1 parent 8f21049
authored April 05, 2010
22  src/test/scala/com/twitter/rowz/integration/RowzSpec.scala
@@ -17,10 +17,20 @@ object RowzSpec extends Specification with Eventually {
17 17
 
18 18
     doBefore {
19 19
       state.nameServer.rebuildSchema()
20  
-      val shard1 = new ShardInfo("com.twitter.rowz.SqlShard", "shard_1", "localhost")
21  
-      val shardId = state.nameServer.createShard(shard1)
22  
-      state.nameServer.setForwarding(new Forwarding(0, Math.MIN_LONG, shardId))
23  
-      // state.nameServer.createShard(shard2)
  20
+      val partitions = 2
  21
+      (0 until partitions) foreach { i =>
  22
+        val shardInfoA = new ShardInfo("com.twitter.rowz.SqlShard", "shard_a" + i, "localhost")
  23
+        val shardInfoB = new ShardInfo("com.twitter.rowz.SqlShard", "shard_b" + i, "localhost")
  24
+        val replicatingShardInfo = new ShardInfo("com.twitter.gizzard.shards.ReplicatingShard", "replicating_" + i, "localhost")
  25
+        val shardIdA = state.nameServer.createShard(shardInfoA)
  26
+        val shardIdB = state.nameServer.createShard(shardInfoB)
  27
+        val replicatingShardId = state.nameServer.createShard(replicatingShardInfo)
  28
+
  29
+        val weight = 1
  30
+        state.nameServer.addChildShard(replicatingShardId, shardIdA, weight)
  31
+        state.nameServer.addChildShard(replicatingShardId, shardIdB, weight)
  32
+        state.nameServer.setForwarding(new Forwarding(0, Math.MIN_LONG, replicatingShardId))
  33
+      }
24 34
       state.start()
25 35
     }
26 36
 
@@ -32,5 +42,9 @@ object RowzSpec extends Specification with Eventually {
32 42
       rowzService.destroy(row, 1.second.fromNow.inSeconds)
33 43
       rowzService.read(id) must eventually(throwA[Exception])
34 44
     }
  45
+
  46
+    "shard migration" in {
  47
+      
  48
+    }
35 49
   }
36 50
 }

0 notes on commit a527615

Please sign in to comment.
Something went wrong with that request. Please try again.