Skip to content

Commit

Permalink
BUGFIX: db::system_keyspace::load_peers
Browse files Browse the repository at this point in the history
  • Loading branch information
fastio committed Apr 26, 2019
1 parent bf85991 commit e01aef9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion db/system_keyspace.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1356,7 +1356,7 @@ future<std::unordered_map<gms::inet_address, std::unordered_set<dht::token>>> lo
}

future<std::vector<gms::inet_address>> load_peers() {
sstring req = sprint("SELECT peer FROM system.%s", PEERS);
sstring req = sprint("SELECT peer, tokens FROM system.%s", PEERS);
return execute_cql(req).then([] (::shared_ptr<cql3::untyped_result_set> cql_result) {
std::vector<gms::inet_address> ret;
for (auto& row : *cql_result) {
Expand Down
4 changes: 2 additions & 2 deletions redis/commands/cluster_slots.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ future<redis_message> cluster_slots::execute(service::storage_proxy& proxy, db::
peers.emplace_back(local);
auto slots_per_peer = REDIS_CLUSTER_SLOTS / peers.size();
std::vector<std::tuple<size_t, size_t, bytes, uint16_t>> ret;
auto port = proxy.get_db().local().get_config().redis_transport_port();
size_t start = 0;
for (auto& peer : peers) {
auto end = start + slots_per_peer - 1;
if (end >= REDIS_CLUSTER_SLOTS) {
if (end >= (REDIS_CLUSTER_SLOTS - slots_per_peer)) {
end = REDIS_CLUSTER_SLOTS - 1;
}
auto port = proxy.get_db().local().get_config().redis_transport_port();
ret.emplace_back(std::tuple<size_t, size_t, bytes, uint16_t> (start, end, to_bytes(peer.to_sstring()), uint16_t { port }));
start = end + 1;
}
Expand Down

0 comments on commit e01aef9

Please sign in to comment.