Permalink
Browse files

fixed fiber db resharding

  • Loading branch information...
1 parent a403b6a commit 4d26abfc6b8f3c103684e7d20efc62362ff63569 @funny-falcon funny-falcon committed Aug 4, 2012
Showing with 5 additions and 31 deletions.
  1. +5 −31 lib/tarantool/em_db.rb
View
@@ -41,9 +41,11 @@ def _send_request(shard_numbers, read_write, request_type, body, response)
end
def _send_to_one_shard(shard_number, read_write, request_type, body, response, feed)
- if (replicas = _shard(shard_number)).size == 1
- replicas[0].send_request(request_type, body, response)
- elsif read_write == :read
+ #if (replicas = _shard(shard_number)).size == 1
+ # replicas[0].send_request(request_type, body, response)
+ #elsif read_write == :read
+ replicas = _shard(shard_number)
+ if read_write == :read
replicas = replicas.shuffle if @replica_strategy == :round_robin
EM.next_tick OneShardRead.new(replicas, request_type, body, response, feed)
else
@@ -159,34 +161,6 @@ def call(array)
case array
when Array
@result.concat array
- when Exception
- @result = array
- @count = 1
- else
- @result << array
- end
- if (@count -= 1) == 0
- if Array === @result && Integer === @result.first
- @feed.call @result.inject(0){|s, i| s + i}
- else
- @feed.call @result
- end
- end
- end
- end
- end
-
- class ConcatterReplace
- def initialize(count, feed)
- @result = []
- @count = count
- @feed = feed
- end
- def call(array)
- if @count > 0
- case array
- when Array
- @result.concat array
when ::Tarantool::TupleDoesntExists
@result << array
when Exception

0 comments on commit 4d26abf

Please sign in to comment.