Skip to content

Commit b442f59

Browse files
author
Michael Fero
committed
Merge branch 'master' into unified_driver
2 parents 65d8539 + 912e23c commit b442f59

12 files changed

Lines changed: 45 additions & 34 deletions

File tree

cpp-driver/examples/dse/date_range/date_range.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,11 +228,8 @@ CassError insert_into_collections(CassSession* session, const char* key, const D
228228
const CassDataType* udt_type = NULL;
229229
CassUserType* udt = NULL;
230230

231-
const char** item = NULL;
232231
const char* query =
233232
"INSERT INTO examples.drcoll (key, coll_value, tuple_value, udt_value) VALUES (?, ?, ?, ?);";
234-
int ind = 0;
235-
236233
statement = cass_statement_new(query, 4);
237234

238235
cass_statement_bind_string(statement, 0, key);

cpp-driver/examples/dse/geotypes/geotypes.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -316,16 +316,13 @@ void select_line_string(CassSession* session, const char* key) {
316316
if (cass_future_error_code(future) == CASS_OK) {
317317
const CassResult* result = cass_future_get_result(future);
318318
if (result && cass_result_row_count(result) > 0) {
319-
cass_uint32_t i, num_points;
320319
const CassRow* row = cass_result_first_row(result);
321320
const CassValue* value = cass_row_get_column_by_name(row, "linestring");
322321

323322
DseLineStringIterator* iterator = dse_line_string_iterator_new();
324323

325324
dse_line_string_iterator_reset(iterator, value);
326325

327-
num_points = dse_line_string_iterator_num_points(iterator);
328-
329326
printf("%s: ", key);
330327
print_line_string(iterator);
331328
printf(")\n");

cpp-driver/examples/dse/gssapi/gssapi_proxy.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@ void connect_and_run(const char* hosts, const char* proxy_user) {
141141

142142
int main(int argc, char* argv[]) {
143143
/* Setup and connect to cluster */
144-
CassFuture* connect_future = NULL;
145144
char* hosts = "127.0.0.1";
146145
if (argc > 1) {
147146
hosts = argv[1];

cpp-driver/examples/dse/proxy_execution/proxy_execution.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ CassError connect_session(CassSession* session, const CassCluster* cluster) {
108108

109109
int main(int argc, char* argv[]) {
110110
/* Setup and connect to cluster */
111-
CassFuture* connect_future = NULL;
112111
CassCluster* cluster = cass_cluster_new();
113112
CassSession* session = cass_session_new();
114113
char* hosts = "127.0.0.1";

cpp-driver/examples/perf/perf.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,6 @@ CassCluster* create_cluster(const char* hosts) {
138138
cass_cluster_set_num_threads_io(cluster, NUM_IO_WORKER_THREADS);
139139
cass_cluster_set_queue_size_io(cluster, 10000);
140140
cass_cluster_set_core_connections_per_host(cluster, 1);
141-
cass_cluster_set_max_connections_per_host(cluster, 2);
142-
cass_cluster_set_max_requests_per_flush(cluster, 10000);
143141
return cluster;
144142
}
145143

cpp-driver/src/third_party/minizip/zip.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -516,16 +516,18 @@ local ZPOS64_T zip64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_f
516516
if (ZREAD64(*pzlib_filefunc_def,filestream,buf,uReadSize)!=uReadSize)
517517
break;
518518

519-
for (i=(int)uReadSize-3; (i--)>0;)
519+
for (i=(int)uReadSize-3; (i--)>0;) {
520520
if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) &&
521521
((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06))
522522
{
523523
uPosFound = uReadPos+i;
524524
break;
525525
}
526+
}
526527

527-
if (uPosFound!=0)
528-
break;
528+
if (uPosFound!=0) {
529+
break;
530+
}
529531
}
530532
TRYFREE(buf);
531533
return uPosFound;
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
Copyright (c) DataStax, Inc.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
#include "retry_policy.hpp"
18+
19+
using namespace test::driver;
20+
21+
DowngradingConsistencyRetryPolicy::DowngradingConsistencyRetryPolicy()
22+
: RetryPolicy(cass_retry_policy_downgrading_consistency_new()) {}

cpp-driver/tests/src/integration/objects/retry_policy.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,7 @@ class DowngradingConsistencyRetryPolicy : public RetryPolicy {
6666
* Create the downgrading consistency retry policy object from the native
6767
* driver downgrading consistency retry policy object
6868
*/
69-
DowngradingConsistencyRetryPolicy()
70-
: RetryPolicy(cass_retry_policy_downgrading_consistency_new()) {}
69+
DowngradingConsistencyRetryPolicy();
7170
};
7271

7372
/**

cpp-driver/tests/src/integration/strptime.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ char* strptime(const char* s, const char* f, struct tm* v) {
156156
*dest = 0;
157157
for (i = 1; i <= min + range && isdigit(*s); i *= 10)
158158
*dest = *dest * 10 + *s++ - '0';
159-
if (*dest - min >= (unsigned)range) return 0;
159+
if ((unsigned)(*dest - min) >= (unsigned)range) return 0;
160160
*dest -= adj;
161161
switch ((char*)dest - (char*)v) { case offsetof(struct tm, tm_yday):; }
162162
goto update;

cpp-driver/tests/src/integration/tests/test_metrics.cpp

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,10 @@ CASSANDRA_INTEGRATION_TEST_F(MetricsTests, ErrorsPendingRequestTimeouts) {
9090
session_.execute_async(SELECT_ALL_SYSTEM_LOCAL_CQL);
9191
}
9292

93-
CassMetrics metrics;
94-
start_timer();
95-
while (elapsed_time() < 10000 && metrics.errors.pending_request_timeouts == 0) {
96-
msleep(100);
93+
CassMetrics metrics = session_.metrics();
94+
for (int i = 0; i < 100 && metrics.errors.pending_request_timeouts == 0; ++i) {
9795
metrics = session_.metrics();
96+
msleep(100);
9897
}
9998
EXPECT_GT(metrics.errors.pending_request_timeouts, 0u);
10099
}
@@ -117,11 +116,10 @@ CASSANDRA_INTEGRATION_TEST_F(MetricsTests, ErrorsRequestTimeouts) {
117116
session.execute_async(SELECT_ALL_SYSTEM_LOCAL_CQL);
118117
}
119118

120-
CassMetrics metrics;
121-
start_timer();
122-
while (elapsed_time() < 10000 && metrics.errors.request_timeouts == 0) {
123-
msleep(100);
119+
CassMetrics metrics = session.metrics();
120+
for (int i = 0; i < 100 && metrics.errors.request_timeouts == 0; ++i) {
124121
metrics = session.metrics();
122+
msleep(100);
125123
}
126124
EXPECT_GT(metrics.errors.request_timeouts, 0u);
127125
}
@@ -138,11 +136,11 @@ CASSANDRA_INTEGRATION_TEST_F(MetricsTests, ErrorsRequestTimeouts) {
138136
CASSANDRA_INTEGRATION_TEST_F(MetricsTests, Requests) {
139137
CHECK_FAILURE;
140138

141-
CassMetrics metrics;
142-
start_timer();
143-
while (elapsed_time() < 60000 && metrics.requests.fifteen_minute_rate == 0.0) {
139+
CassMetrics metrics = session_.metrics();
140+
for (int i = 0; i < 600 && metrics.requests.fifteen_minute_rate == 0; ++i) {
144141
session_.execute_async(SELECT_ALL_SYSTEM_LOCAL_CQL);
145142
metrics = session_.metrics();
143+
msleep(100);
146144
}
147145

148146
EXPECT_LT(metrics.requests.min, CASS_UINT64_MAX);
@@ -187,11 +185,11 @@ CASSANDRA_INTEGRATION_TEST_F(MetricsTests, SpeculativeExecutionRequests) {
187185
statement.set_idempotent(true);
188186
statement.set_request_timeout(30000);
189187

190-
CassSpeculativeExecutionMetrics metrics;
191-
start_timer();
192-
while (elapsed_time() < 60000 && metrics.count < 1000u) {
188+
CassSpeculativeExecutionMetrics metrics = session.speculative_execution_metrics();
189+
for (int i = 0; i < 600 && metrics.count < 1000u; ++i) {
193190
session.execute_async(statement);
194191
metrics = session.speculative_execution_metrics();
192+
msleep(100);
195193
}
196194

197195
EXPECT_LT(metrics.min, CASS_UINT64_MAX);

0 commit comments

Comments
 (0)