From 959957c9578b65f9ed299a8936684afbfdf02672 Mon Sep 17 00:00:00 2001 From: Stu Hood Date: Thu, 12 Jan 2012 11:03:05 -0800 Subject: [PATCH] Update for gizzard-3.0.0-beta29 --- test/test_server/project/build/Project.scala | 2 +- .../src/main/scala/TestServer.scala | 20 +++++++++++-------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/test/test_server/project/build/Project.scala b/test/test_server/project/build/Project.scala index b916e9f..3925593 100644 --- a/test/test_server/project/build/Project.scala +++ b/test/test_server/project/build/Project.scala @@ -7,7 +7,7 @@ class GizzmoServerProject(info: ProjectInfo) extends StandardProject(info) { override def filterScalaJars = false val scalaTools = "org.scala-lang" % "scala-compiler" % "2.7.7" - val gizzard = "com.twitter" % "gizzard" % "3.0.0-beta28" + val gizzard = "com.twitter" % "gizzard" % "3.0.0-beta29" val querulous = "com.twitter" % "querulous" % "2.6.5" val specs = "org.scala-tools.testing" % "specs" % "1.6.2.1" % "test" diff --git a/test/test_server/src/main/scala/TestServer.scala b/test/test_server/src/main/scala/TestServer.scala index cecfa12..cfbc519 100644 --- a/test/test_server/src/main/scala/TestServer.scala +++ b/test/test_server/src/main/scala/TestServer.scala @@ -223,35 +223,39 @@ class PutJob(key: Int, value: String, forwarding: Long => RoutingNode[TestShard] class TestCopyFactory(ns: NameServer, s: JobScheduler) extends CopyJobFactory[TestShard] { - def apply(src: ShardId, dest: ShardId) = new TestCopy(src, dest, 0, 500, ns, s) + def apply(shardIds: Seq[ShardId]) = new TestCopy(shardIds, 0, 500, ns, s) } class TestCopyParser(ns: NameServer, s: JobScheduler) extends CopyJobParser[TestShard] { - def deserialize(m: Map[String, Any], src: ShardId, dest: ShardId, count: Int) = { + def deserialize(m: Map[String, Any], shardIds: Seq[ShardId], count: Int) = { val cursor = m("cursor").asInstanceOf[Int] val count = m("count").asInstanceOf[Int] - new TestCopy(src, dest, cursor, count, ns, s) + new TestCopy(shardIds, cursor, count, ns, s) } } class TestCopy( - srcId: ShardId, - destId: ShardId, + shardIds: Seq[ShardId], cursor: Int, count: Int, ns: NameServer, s: JobScheduler) -extends CopyJob[TestShard](srcId, destId, count, ns, s) { +extends CopyJob[TestShard](shardIds, count, ns, s) { + + def copyPage(nodes: Seq[RoutingNode[TestShard]], count: Int) = { + val (src, dest) = nodes match { + case Seq(src, dest) => (src, dest) + case _ => throw new AssertionError("Server does not support complex copies (yet): " + nodes) + } - def copyPage(src: RoutingNode[TestShard], dest: RoutingNode[TestShard], count: Int) = { val rows = src.read.any(_.getAll(cursor, count)) map { case (k,v,c) => (k,v) } if (rows.isEmpty) { None } else { dest.write.foreach(_.putAll(rows)) - Some(new TestCopy(srcId, destId, rows.last._1, count, ns, s)) + Some(new TestCopy(nodes.map(_.shardInfo.id), rows.last._1, count, ns, s)) } }