Skip to content

Commit d06c873

Browse files
authored
Merge pull request #358 from riptano/sync_unified_driver
Sync unified driver branch
2 parents 23d6a2d + 307743b commit d06c873

File tree

6 files changed

+107
-20
lines changed

6 files changed

+107
-20
lines changed

CHANGELOG.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,30 @@
1+
1.10.1
2+
===========
3+
4+
Bug Fixes
5+
--------
6+
* [CPP-849] Error result doesn't allow access to keyspace, table, and function
7+
data
8+
* [CPP-851] Disable deprecated warnings for std::ptr_fun
9+
* [CPP-879] Allow remote hosts to come back up even if policy ignores down hosts
10+
(community PR from kw217)
11+
12+
Other
13+
--------
14+
* [CPP-220] Remove use of external Boost from unit and integration tests.
15+
* We ported all integration tests from Boost to Google test. This includes
16+
several JIRA issues included in the [CPP-220] epic.
17+
* [CPP-853] Correct linking libraries for unix based OS when using
18+
CASS_USE_STATIC_LIBS=On
19+
* [CPP-859] Remove vc_build.bat scripts and update building documentation
20+
* [CPP-872] Fix GCC 9.2+ build
21+
* [CPP-878] Correct compile flags for libraries and executable
22+
* [CPP-882] Correct pthread compiler flag for older CMake versions
23+
24+
Community
25+
--------
26+
* Fix build error when compiling without an SSL implementation (kmaragon)
27+
128
1.10.0
229
===========
330

cpp-driver/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
===========

cpp-driver/cmake/modules/CppDriver.cmake

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -425,13 +425,13 @@ macro(CassUseLibuv)
425425
message(FATAL_ERROR "Unable to Locate libuv: libuv v1.0.0+ is required")
426426
endif()
427427

428-
if (LIBUV_VERSION VERSION_LESS "1.0")
428+
if(LIBUV_VERSION VERSION_LESS "1.0")
429429
message(FATAL_ERROR "Libuv version ${LIBUV_VERSION} is not "
430430
" supported. Please updgrade to libuv version 1.0 or greater in order to "
431431
"utilize the driver.")
432432
endif()
433433

434-
if (LIBUV_VERSION VERSION_LESS "1.6")
434+
if(LIBUV_VERSION VERSION_LESS "1.6")
435435
message(WARNING "Libuv version ${LIBUV_VERSION} does not support custom "
436436
"memory allocators (version 1.6 or greater required)")
437437
endif()
@@ -441,10 +441,16 @@ macro(CassUseLibuv)
441441
set(CASS_LIBS ${CASS_LIBS} ${LIBUV_LIBRARIES})
442442

443443
# libuv and gtests require thread library
444-
set (THREADS_PREFER_PTHREAD_FLAG 1)
444+
set(CMAKE_THREAD_PREFER_PTHREAD 1)
445+
set(THREADS_PREFER_PTHREAD_FLAG 1)
445446
find_package(Threads REQUIRED)
446447
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_THREAD_LIBS_INIT}")
447448
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_THREAD_LIBS_INIT}")
449+
if(NOT WIN32 AND ${CMAKE_VERSION} VERSION_LESS "3.1.0")
450+
# FindThreads in CMake versions < v3.1.0 do not have the THREADS_PREFER_PTHREAD_FLAG to prefer -pthread
451+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
452+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread")
453+
endif()
448454
endmacro()
449455

450456
#------------------------

cpp-driver/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
}

cpp-driver/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();

cpp-driver/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)