VoltDB C++ wireprotocol and client implementation
C C++ Other
Latest commit 8cfaa64 Mar 20, 2017 @hhakimi53 hhakimi53 committed on GitHub Eng 10955 ssl (#51)
* WIP: update libevent and add initial ssl support

* wip: updates to bev ssl logic

* wip: updates for md hash n openssl thread-safe

* rebase with master

* add libevent tar file

* copied libevent 2.0.22 libs for Mac from ENG-10955 branch

* mac support

* fixes

* client fixes and single ssl ctx

* libevent 2.1.7.rc

* wip - try without ssl locks n ctx per client

* refactor n more udpates

* update libevent lib

* wip: package openssl-1.0.2k - linux at present

* clean up n tweaks

* update for MAC

* add comments

* update connection SSL settings

* address review comment

* rename secure voter example to be more intuitive as per review feedback

* address Ning's review feedback

* update readme file for SSL support

* incorporate Andrew's feedback for readme

* remove redundant check


VoltDB CPP Client Library

The VoltDB client library implements the native VoltDB wire protocol. You can use the library to connect to a VoltDB cluster, invoke stored procedures and read responses.

The Using VoltDB Guide explains how to use the CPP library in [Chapter 15.1: C++ Client Interface.] (http://docs.voltdb.com/UsingVoltDB/ChapOtherClientAPI.php)

Binaries for 64-bit Linux and 64-bit OSX are provided. The linking instructions below apply to the Linux binaries.

The Linux binary was compiled with GCC 4.4.7 on Centos 6.7. The OSX binary was compiled with Xcode 7.2 on OSX 10.11.

The source code is available in the [VoltDB Github repository] (https://github.com/VoltDB/voltdb-client-cpp).

New Features in 7.1

  • Add SSL support to C++ client to enable communication between VoltDB server and C++ client over SSL transport. To enable communication between a VoltDB server with SSL enabled for the external ports and a C++ client, the client needs to be instantiated using client config (voltdb::ClientConfig) with the ssl field (m_useSSL) set to true. Code snippet:
voltdb::ClientConfig config;
config.m_useSSL = true;
voltdb::Client client = voltdb::Client::create(config);

New Features in 7.0

  • Support for Table (synomous to VoltTable on server side) in parameter set. How to construct table: initialize table with column schema. Generate row to be inserted - initialize the row with same column schema as that of table, populate the row and add the row to the table. After inserting the populated row to the table, the row instance can be reused to populate it row with new values and push it table.
std::vector<voltdb::Column> columns;
columns.push_back(voltdb::Column("col1", voltdb::WIRE_TYPE_BIGINT));
columns.push_back(voltdb::Column("col2", voltdb::WIRE_TYPE_STRING));

voltdb::Table table (columns);
voltdb::RowBuilder row(columns);

New Features in V6.9

  • Support for timing out outstanding/pending invocation requests. By default the monitoring of the pending requests for timeout is disabled. To exercise feature, timeout has to be enabled using client config. Default timeout is 10 seconds and can be tweaked through client config.
bool enableQueryTimeout = true;
int queryTimeout = 10;
voltdb::ClientConfig config("myusername", "mypassword", voltdb::HASH_SHA256, true, enableQueryTimeout, queryTimeout);
voltdb::Client client = voltdb::Client::create(config);

New Features in V6.8

  • Update backpressure notification to notify when backpressure on client transitions from on to off
  • Fix handling of pending connection logic where client gets disconnected and tries to reconnect, if socket timeout is longer than 10 seconds, it can potentially crash the client
  • Update setaffinity logic to not drop the set affinity request in case of backpresure with client configured with enable abandon set to true.

New Features in V6.0

Support for new geospatial datatypes: GEOGRAPHY and GEOGRAPHY_POINT. The client can fetch columns using getGeography() and getGeographyPoint().

New Features in V5.2

You can now use SHA-256 to hash password for authentication request. V5.2 onward server is required. The default is SHA-1. To use SHA-256 create client config as

voltdb::ClientConfig config("myusername", "mypassword", voltdb::HASH_SHA256);
voltdb::Client client = voltdb::Client::create(config);

New Features in V4

When connected to multiple nodes in the cluster, the client library will enable client affinity and can auto-reconnect to restarted nodes.


Boost C++ Library 1.53 if using the downloaded client library. If building from source, you may use 1.53 or above.


This does not apply if you have downloaded the kit from voltdb.com

Simply type make in the unpacked directory to build the client library. It will generate a shared library and a static library for linking your program against.

Building the kit samples

In terminal go to the examples directory then run:


This will build the HelloWorld, AsyncHelloWorld and Voter applications that you can then run against a locally running HelloWorld or Voter database.

You can additionally view the source code of the c++ client library and the examples online at:


Linking against libvoltdbcpp.a

Only applies for linux distribution

The following command will compile and link an example client (clientvoter.cpp) libvoltdb.a.

Note that -lrt and -pthread must appear after the object files being compiled/linked in more recent Linux distributions.

Directory structure for this example:

./clientvoter.cpp        # Example client
./include                # Directory containing client library headers
./                       # Directory containing client library archive
g++ -I./include/                 \
clientvoter.cpp                  \
./libvoltdbcpp.a                 \
./libevent.a                     \
./libevent_pthread.a             \
-lrt                             \
-pthread                         \
-lboost_system                   \
-lboost_thread                   \
-o voter

Note that -lrt should not be included for the mac edition. See the example makefile for more detail.