Skip to content
This repository
Browse code

take min of new count and count for next job

  • Loading branch information...
commit babea193ea0efabef39890dac904a2c254aa7cc0 1 parent 2c5cc32
Ning Liang authored August 17, 2010
4  src/main/scala/com/twitter/flockdb/jobs/Copy.scala
@@ -84,7 +84,7 @@ class Copy(sourceShardId: ShardId, destinationShardId: ShardId, cursor: Copy.Cur
84 84
     } else {
85 85
       val (items, nextCursor) = sourceShard.selectAll(cursor, count)  
86 86
       destinationShard.writeCopies(items)
87  
-      val newCount = (count * 1.01).toInt + 1      // Upward pressure on page size
  87
+      val newCount = Math.min((count * 1.01).toInt + 1, Copy.COUNT)     // Upward pressure on page size
88 88
       Stats.incr("edges-copy", items.size)
89 89
       nextCursor match {
90 90
         case Copy.END => None
@@ -144,7 +144,7 @@ class MetadataCopy(sourceShardId: ShardId, destinationShardId: ShardId, cursor:
144 144
     } else {
145 145
       val (items, nextCursor) = sourceShard.selectAllMetadata(cursor, count)
146 146
       items.foreach { item => destinationShard.writeMetadata(item) }
147  
-      val newCount = (count * 1.01).toInt + 1      // Upward pressure on page size
  147
+      val newCount = Math.min((count * 1.01).toInt + 1, Copy.COUNT)  // Upward pressure on page size
148 148
       Stats.incr("metadata-copy", items.size)
149 149
       nextCursor match {
150 150
         case MetadataCopy.END => {

0 notes on commit babea19

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