Skip to content

Commit 6d997ae

Browse files
authored
Merge pull request #13 from riptano/sync_unified_driver
Sync unified driver
2 parents fd4f6da + 2e8b621 commit 6d997ae

File tree

4 files changed

+71
-17
lines changed

4 files changed

+71
-17
lines changed

CHANGELOG.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,32 @@ Other
2525
--------
2626
* [CPP-220] Remove use of external Boost from unit and integration tests
2727

28+
2.14.1
29+
===========
30+
31+
Bug Fixes
32+
--------
33+
* [CPP-849] Error result doesn't allow access to keyspace, table, and function
34+
data
35+
* [CPP-851] Disable deprecated warnings for std::ptr_fun
36+
* [CPP-879] Allow remote hosts to come back up even if policy ignores down hosts
37+
(community PR from kw217)
38+
39+
Other
40+
--------
41+
* [CPP-220] Remove use of external Boost from unit and integration tests.
42+
* We ported all integration tests from Boost to Google test. This includes
43+
several JIRA issues included in the [CPP-220] epic.
44+
* [CPP-853] Correct linking libraries for unix based OS when using
45+
CASS_USE_STATIC_LIBS=On
46+
* [CPP-859] Remove vc_build.bat scripts and update building documentation
47+
* [CPP-872] Fix GCC 9.2+ build
48+
* [CPP-878] Correct compile flags for libraries and executable
49+
* [CPP-882] Correct pthread compiler flag for older CMake versions
50+
51+
Community
52+
--------
53+
* Fix build error when compiling without an SSL implementation (kmaragon)
2854

2955
2.14.0
3056
===========

src/request_processor.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -462,9 +462,7 @@ void RequestProcessor::internal_host_ready(const Host::Ptr& host) {
462462
LoadBalancingPolicy::Vec policies = load_balancing_policies();
463463
for (LoadBalancingPolicy::Vec::const_iterator it = policies.begin(); it != policies.end();
464464
++it) {
465-
if ((*it)->distance(host) != CASS_HOST_DISTANCE_IGNORE) {
466-
(*it)->on_host_up(host);
467-
}
465+
(*it)->on_host_up(host);
468466
}
469467
}
470468
}

tests/src/unit/tests/test_name_resolver.cpp

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@
1919
#include "callback.hpp"
2020
#include "name_resolver.hpp"
2121

22-
#ifdef WIN32
23-
#include "winsock.h"
24-
#endif
25-
2622
#define RESOLVE_TIMEOUT 2000
2723

2824
using namespace datastax;
@@ -54,21 +50,15 @@ class NameResolverUnitTest : public LoopTest {
5450
};
5551

5652
TEST_F(NameResolverUnitTest, Simple) {
57-
NameResolver::Ptr resolver(create(Address("127.0.0.1", 9042)));
53+
NameResolver::Ptr resolver(create(Address("127.254.254.254", 9042)));
5854
resolver->resolve(loop(), RESOLVE_TIMEOUT);
5955
run_loop();
6056
ASSERT_EQ(NameResolver::SUCCESS, status());
61-
#ifdef WIN32
62-
char win_hostname[64];
63-
gethostname(win_hostname, 64);
64-
EXPECT_EQ(String(win_hostname), hostname());
65-
#else
66-
EXPECT_EQ("localhost", hostname());
67-
#endif
57+
EXPECT_EQ("cpp-driver.hostname.", hostname());
6858
}
6959

7060
TEST_F(NameResolverUnitTest, Timeout) {
71-
NameResolver::Ptr resolver(create(Address("127.0.0.1", 9042)));
61+
NameResolver::Ptr resolver(create(Address("127.254.254.254", 9042)));
7262

7363
// Libuv's address resolver uses the uv_work thread pool to handle resolution
7464
// asynchronously. If we starve all the threads in the uv_work thread pool
@@ -91,7 +81,7 @@ TEST_F(NameResolverUnitTest, Invalid) {
9181
}
9282

9383
TEST_F(NameResolverUnitTest, Cancel) {
94-
NameResolver::Ptr resolver(create(Address("127.0.0.1", 9042)));
84+
NameResolver::Ptr resolver(create(Address("127.254.254.254", 9042)));
9585
resolver->resolve(loop(), RESOLVE_TIMEOUT);
9686
resolver->cancel();
9787
run_loop();

tests/src/unit/tests/test_session.cpp

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -923,6 +923,46 @@ TEST_F(SessionUnitTest, DefaultConsistencyExecutionProfileNotUpdated) {
923923
close(&session);
924924
}
925925

926+
TEST_F(SessionUnitTest, RemoteDCNodeRecovery) {
927+
mockssandra::SimpleCluster cluster(simple(), 1, 1); // 1 local DC node and 1 remote DC node
928+
ASSERT_EQ(cluster.start_all(), 0);
929+
930+
ExecutionProfile profile;
931+
Config config;
932+
config.set_constant_reconnect(100); // Faster reconnect time to handle node outages
933+
config.contact_points().push_back(Address("127.0.0.1", 9042));
934+
config.set_load_balancing_policy(new DCAwarePolicy("dc1", 1));
935+
936+
Session session;
937+
connect(config, &session);
938+
939+
cluster.stop(1); // Force using the remote node
940+
941+
cluster.stop(2); // Force the remote node down and up
942+
cluster.start(2);
943+
944+
bool remote_dc_node_recovered = false;
945+
946+
// Wait for the remote DC node to become available
947+
for (int i = 0; i < 20; ++i) { // Around 2 seconds
948+
QueryRequest::Ptr request(new QueryRequest("blah", 0));
949+
request->set_consistency(CASS_CONSISTENCY_ONE); // Don't use a LOCAL consistency
950+
request->set_record_attempted_addresses(true);
951+
ResponseFuture::Ptr future = session.execute(Request::ConstPtr(request));
952+
EXPECT_TRUE(future->wait_for(WAIT_FOR_TIME));
953+
if (!future->error() && !future->attempted_addresses().empty() &&
954+
Address("127.0.0.2", 9042) == future->attempted_addresses()[0]) {
955+
remote_dc_node_recovered = true;
956+
break;
957+
}
958+
test::Utils::msleep(100);
959+
}
960+
961+
EXPECT_TRUE(remote_dc_node_recovered);
962+
963+
close(&session);
964+
}
965+
926966
TEST_F(SessionUnitTest, DbaasDetectionUpdateDefaultConsistency) {
927967
mockssandra::SimpleRequestHandlerBuilder builder;
928968
builder.on(mockssandra::OPCODE_OPTIONS).execute(new SupportedDbaasOptions());

0 commit comments

Comments
 (0)