mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-27 20:05:10 +00:00
give preference to local data during query
Until dynamic snitch is implemented this is better than nothing. Fixes #322
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
#include "db/consistency_level.hh"
|
||||
|
||||
#include <boost/range/algorithm/partition.hpp>
|
||||
#include <boost/range/algorithm/find.hpp>
|
||||
#include "exceptions/exceptions.hh"
|
||||
#include "core/sstring.hh"
|
||||
#include "schema.hh"
|
||||
@@ -171,6 +172,11 @@ filter_for_query(consistency_level cl,
|
||||
* replica gets the data read) or not (since we'll take the block_for first
|
||||
* ones).
|
||||
*/
|
||||
// FIXME: before dynamic snitch is implement put local address (if present) at the beginning
|
||||
auto it = boost::range::find(live_endpoints, utils::fb_utilities::get_broadcast_address());
|
||||
if (it != live_endpoints.end() && it != live_endpoints.begin()) {
|
||||
std::iter_swap(it, live_endpoints.begin());
|
||||
}
|
||||
if (is_datacenter_local(cl)) {
|
||||
boost::range::partition(live_endpoints, is_local);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user