Skip to content
Permalink
Browse files

Add Cassandra SQL driver to be built by Jenkis (#2898)

* Add Cassandra SQL driver to be built by Jenkis

* rlm_sql_cassandra: Some functions were deprecated in lib 2.9
  • Loading branch information
jpereira authored and arr2036 committed Aug 16, 2019
1 parent 14a746e commit 77cfdbd196224dff56e3a9a4ce45e4afe8d1a363
@@ -119,6 +119,7 @@ services:
- redis-server
before_install:
- npm i -g @antora/cli@2.0 @antora/site-generator-default@2.0
- sudo ./scripts/travis/cassandra-install.sh
- rvm --install --default --binary use 2.4
- gem install asciidoctor
- wget -q -O /tmp/pandoc.deb https://github.com/jgm/pandoc/releases/download/2.7.3/pandoc-2.7.3-1-amd64.deb && sudo dpkg -i /tmp/pandoc.deb
@@ -0,0 +1,42 @@
#!/bin/sh -e

libuv_ver="1.29.1"
libuv_pkg="libuv1_${libuv_ver}-1_amd64.deb"

cassandra_ver="2.13.0"
cassandra_pkgs="cassandra-cpp-driver-dbg_${cassandra_ver}-1_amd64.deb
cassandra-cpp-driver-dev_${cassandra_ver}-1_amd64.deb
cassandra-cpp-driver_${cassandra_ver}-1_amd64.deb"

ubuntu_ver="$(lsb_release -rs)"
tmp_dir="/tmp/cassandra-$$"
mkdir -p $tmp_dir

do_exit() {
rm -rf $tmp_dir
exit $1
}

# Libuv
libuv_url="https://downloads.datastax.com/cpp-driver/ubuntu/${ubuntu_ver}/dependencies/libuv/v${libuv_ver}/${libuv_pkg}"
if ! wget -q -O "${tmp_dir}/${libuv_pkg}" "${libuv_url}"; then
echo "ERROR: Problems to fetch ${libuv_url}"
do_exit 1
fi

# Cassandra sdk
for _deb in ${cassandra_pkgs}; do
_url="https://downloads.datastax.com/cpp-driver/ubuntu/${ubuntu_ver}/cassandra/v${cassandra_ver}/${_deb}"

if ! wget -q -O "${tmp_dir}/${_deb}" "${_url}"; then
echo "ERROR: Problems to fetch ${_url}"
do_exit 1
fi
done

if ! dpkg -i ${tmp_dir}/*.deb; then
echo "ERROR: Problems to install ${tmp_dir}/*.deb"
do_exit 1
fi

do_exit 0
@@ -217,22 +217,42 @@ static const CONF_PARSER driver_config[] = {
{ FR_CONF_OFFSET("protocol_version", FR_TYPE_UINT32, rlm_sql_cassandra_t, protocol_version) },

{ FR_CONF_OFFSET("connections_per_host", FR_TYPE_UINT32, rlm_sql_cassandra_t, connections_per_host) },
{ FR_CONF_OFFSET("connections_per_host_max", FR_TYPE_UINT32, rlm_sql_cassandra_t, connections_per_host_max) },

{ FR_CONF_OFFSET("io_threads", FR_TYPE_UINT32, rlm_sql_cassandra_t, io_threads) },
{ FR_CONF_OFFSET("io_queue_size", FR_TYPE_UINT32, rlm_sql_cassandra_t, io_queue_size) },
/*
* The below functions was deprecated in 2.10
*/
#if (CASS_VERSION_MAJOR >= 2 && CASS_VERSION_MINOR >= 10)
{ FR_CONF_DEPRECATED("connections_per_host_max", FR_TYPE_UINT32, rlm_sql_cassandra_t, connections_per_host_max) },
{ FR_CONF_DEPRECATED("io_flush_requests_max", FR_TYPE_UINT32, rlm_sql_cassandra_t, io_flush_requests_max) },

{ FR_CONF_DEPRECATED("pending_requests_high", FR_TYPE_UINT32, rlm_sql_cassandra_t, pending_requests_high) },
{ FR_CONF_DEPRECATED("pending_requests_low", FR_TYPE_UINT32, rlm_sql_cassandra_t, pending_requests_low) },

{ FR_CONF_DEPRECATED("write_bytes_high", FR_TYPE_UINT32, rlm_sql_cassandra_t, write_bytes_high) },
{ FR_CONF_DEPRECATED("write_bytes_low", FR_TYPE_UINT32, rlm_sql_cassandra_t, write_bytes_low) },

{ FR_CONF_DEPRECATED("spawn_threshold", FR_TYPE_UINT32, rlm_sql_cassandra_t, spawn_threshold) },
{ FR_CONF_DEPRECATED("spawn_max", FR_TYPE_UINT32, rlm_sql_cassandra_t, spawn_max) },
{ FR_CONF_OFFSET_IS_SET("spawn_retry_delay", FR_TYPE_TIME_DELTA | FR_TYPE_DEPRECATED, rlm_sql_cassandra_t, spawn_retry_delay) },
#else
{ FR_CONF_OFFSET("connections_per_host_max", FR_TYPE_UINT32, rlm_sql_cassandra_t, connections_per_host_max) },
{ FR_CONF_OFFSET("io_flush_requests_max", FR_TYPE_UINT32, rlm_sql_cassandra_t, io_flush_requests_max) },

{ FR_CONF_OFFSET("pending_requests_high", FR_TYPE_UINT32, rlm_sql_cassandra_t, pending_requests_high) },
{ FR_CONF_OFFSET("pending_requests_low", FR_TYPE_UINT32, rlm_sql_cassandra_t, pending_requests_low) },

{ FR_CONF_OFFSET("write_bytes_high", FR_TYPE_UINT32, rlm_sql_cassandra_t, write_bytes_high) },
{ FR_CONF_OFFSET("write_bytes_low", FR_TYPE_UINT32, rlm_sql_cassandra_t, write_bytes_low) },

{ FR_CONF_OFFSET("event_queue_size", FR_TYPE_UINT32, rlm_sql_cassandra_t, event_queue_size) },

{ FR_CONF_OFFSET("spawn_threshold", FR_TYPE_UINT32, rlm_sql_cassandra_t, spawn_threshold) },
{ FR_CONF_OFFSET("spawn_max", FR_TYPE_UINT32, rlm_sql_cassandra_t, spawn_max) },
{ FR_CONF_OFFSET_IS_SET("spawn_retry_delay", FR_TYPE_TIME_DELTA, rlm_sql_cassandra_t, spawn_retry_delay) },
#endif

{ FR_CONF_OFFSET("io_threads", FR_TYPE_UINT32, rlm_sql_cassandra_t, io_threads) },
{ FR_CONF_OFFSET("io_queue_size", FR_TYPE_UINT32, rlm_sql_cassandra_t, io_queue_size) },

{ FR_CONF_OFFSET("event_queue_size", FR_TYPE_UINT32, rlm_sql_cassandra_t, event_queue_size) },

{ FR_CONF_POINTER("load_balance_dc_aware", FR_TYPE_SUBSECTION, NULL), .subcs = (void const *) load_balance_dc_aware_config },
{ FR_CONF_OFFSET("load_balance_round_robin", FR_TYPE_BOOL, rlm_sql_cassandra_t, load_balance_round_robin), .dflt = "no" },
@@ -758,21 +778,16 @@ do {\
inst->connections_per_host));
}

/*
* The below functions was deprecated in 2.10
*/
#if (CASS_VERSION_MAJOR <= 2 && CASS_VERSION_MINOR < 10)
if (inst->connections_per_host_max) {
DO_CASS_OPTION("connections_per_host_max",
cass_cluster_set_max_connections_per_host(inst->cluster,
inst->connections_per_host_max));
}

if (inst->io_threads) {
DO_CASS_OPTION("io_threads", cass_cluster_set_num_threads_io(inst->cluster, inst->io_threads));
}

if (inst->io_queue_size) {
DO_CASS_OPTION("io_queue_size",
cass_cluster_set_num_threads_io(inst->cluster, inst->io_queue_size));
}

if (inst->io_flush_requests_max) {
DO_CASS_OPTION("io_flush_requests_max",
cass_cluster_set_max_requests_per_flush(inst->cluster,
@@ -803,11 +818,6 @@ do {\
inst->write_bytes_low));
}

if (inst->event_queue_size) {
DO_CASS_OPTION("event_queue_size",
cass_cluster_set_num_threads_io(inst->cluster, inst->event_queue_size));
}

if (inst->spawn_threshold) {
DO_CASS_OPTION("spawn_threshold",
cass_cluster_set_max_concurrent_requests_threshold(inst->cluster,
@@ -822,6 +832,21 @@ do {\
if (inst->spawn_retry_delay_is_set) {
cass_cluster_set_reconnect_wait_time(inst->cluster, fr_time_delta_to_msec(inst->spawn_retry_delay));
}
#endif

if (inst->event_queue_size) {
DO_CASS_OPTION("event_queue_size",
cass_cluster_set_num_threads_io(inst->cluster, inst->event_queue_size));
}

if (inst->io_queue_size) {
DO_CASS_OPTION("io_queue_size",
cass_cluster_set_num_threads_io(inst->cluster, inst->io_queue_size));
}

if (inst->io_threads) {
DO_CASS_OPTION("io_threads", cass_cluster_set_num_threads_io(inst->cluster, inst->io_threads));
}

if (inst->load_balance_round_robin) cass_cluster_set_load_balance_round_robin(inst->cluster);

0 comments on commit 77cfdbd

Please sign in to comment.
You can’t perform that action at this time.