Skip to content

Commit

Permalink
[split] Merge branch 'master' into ds-126
Browse files Browse the repository at this point in the history
  • Loading branch information
Stu Hood committed Apr 12, 2012
2 parents c5730d7 + 4270656 commit 2fd7db0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/scala/com/twitter/gizzard/nameserver/SqlShard.scala
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ class SqlShardManagerSource(queryEvaluator: QueryEvaluator) extends ShardManager
def removeForwarding(f: Forwarding) { insertOrUpdateForwarding(queryEvaluator, f, true) }

def replaceForwarding(oldId: ShardId, newId: ShardId) {
val query = "SELECT * FROM forwardings WHERE shard_hostname = ? AND shard_table_prefix = ?"
val query = "SELECT * FROM forwardings WHERE shard_hostname = ? AND shard_table_prefix = ? AND deleted = false"

queryEvaluator.transaction { t =>
val forwardings = t.select(query, oldId.hostname, oldId.tablePrefix)(rowToForwarding)
Expand Down Expand Up @@ -269,7 +269,7 @@ class SqlShardManagerSource(queryEvaluator: QueryEvaluator) extends ShardManager
}

def listTables() = {
queryEvaluator.select("SELECT DISTINCT table_id FROM forwardings")(_.getInt("table_id")).toList.sortWith((a,b) => a < b)
queryEvaluator.select("SELECT DISTINCT table_id FROM forwardings WHERE deleted = false")(_.getInt("table_id")).toList.sortWith((a,b) => a < b)
}

def listHostnames() = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ class SqlShardSpec extends ConfiguredSpecification with JMocker with ClassMocker
nsShard.removeForwarding(Forwarding(0, 0, a.id))
nsShard.removeForwarding(Forwarding(0, 0, a.id))
nsShard.getForwardings.size mustEqual 0
nsShard.listTables.size mustEqual 0
}

}
Expand Down

0 comments on commit 2fd7db0

Please sign in to comment.