Skip to content

CPP-687 - Fix recovery of remote DC host#427

Merged
mpenick merged 7 commits into2.10.0from
CPP-687
Oct 4, 2018
Merged

CPP-687 - Fix recovery of remote DC host#427
mpenick merged 7 commits into2.10.0from
CPP-687

Conversation

@mpenick
Copy link
Copy Markdown
Contributor

@mpenick mpenick commented Oct 3, 2018

The DC-aware load balancing policy depends on an internal host map to determine host distance. The problem was the host distance was being checked to determine whether a node should be added or marked as up. This fix always adds and marks hosts up even if they're ignored. The distance is only used to determine if a host should have a connection pool.

The DC-aware load balancing policy depends on an internal host map to determine host distance. The problem was the host distance was being checked to determine whether a node should be added or marked as up.  This fix always adds and marks hosts up even if they're ignored. The distance is only used to determine if a host should have a connection pool.
@mpenick mpenick added the wip label Oct 3, 2018
@mpenick
Copy link
Copy Markdown
Contributor Author

mpenick commented Oct 3, 2018

This is only wip because I haven't fully tested or added a test. Feel free to assess the fix.

@mpenick mpenick removed the wip label Oct 3, 2018
Copy link
Copy Markdown
Contributor

@mikefero mikefero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great ... just a couple of nits; feel free to merge at will.

Seems like TravisCI fails from time to time; wonder if we should increase timeouts and things due to the fact that this machine is slower than a normal Mac. That can be done separate from this ticket.

Comment thread gtests/src/unit/mockssandra.cpp Outdated
void Cluster::init(AddressGenerator& generator,
ClientConnectionFactory& factory,
size_t num_nodes) {
size_t num_nodes_dc1, size_t num_nodes_dc2) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: size_t num_nodes_dc1, size_t num_nodes_dc2) { =>

size_t num_nodes_dc1,
size_t num_nodes_dc2) {

Comment thread gtests/src/unit/mockssandra.hpp Outdated
void init(AddressGenerator& generator,
ClientConnectionFactory& factory,
size_t num_nodes);
size_t num_nodes_dc1, size_t num_nodes_dc2);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: same

Comment thread gtests/src/unit/tests/test_cluster.cpp Outdated
ASSERT_TRUE(up_future->wait_for(WAIT_FOR_TIME));
EXPECT_EQ(remote_address, listener->address());

cluster.stop(1); // Stop local node to very that remote host is tried for reconnection.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very => verify

Comment thread gtests/src/unit/tests/test_cluster.cpp Outdated
bind_callback(on_connection_connected, connect_future.get())));

ClusterSettings settings;
settings.load_balancing_policy.reset(Memory::allocate<DCAwarePolicy>("dc3", 0, false)); // Invalid DC and no using remote hosts
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know dc3 is not valid, but dc2 is also invalid. What do you think about changing this to just invalid_dc?

no using => not using

Comment thread src/cluster_connector.cpp
ScopedPtr<QueryPlan> query_plan(default_policy->new_query_plan("", NULL, NULL));
if (!query_plan->compute_next()) { // No hosts in the query plan
const char* message;
if (dynamic_cast<DCAwarePolicy::DCAwareQueryPlan*>(query_plan.get()) != NULL) { // Check if DC-aware
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice ... thanks for taking care of that TODO

@mpenick mpenick merged commit dfb7495 into 2.10.0 Oct 4, 2018
@mpenick mpenick deleted the CPP-687 branch October 10, 2018 12:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants