cpp-driver | DataStax C/C++ Driver for Apache Cassandra

 by   datastax C++ Version: 2.16.2 License: Apache-2.0

kandi X-RAY | cpp-driver Summary

kandi X-RAY | cpp-driver Summary

cpp-driver is a C++ library typically used in Big Data applications. cpp-driver has no bugs, it has no vulnerabilities, it has a Permissive License and it has low support. You can download it from GitHub.

A modern, feature-rich and highly tunable C/C++ client library for Apache Cassandra 2.1+ using exclusively Cassandra's binary protocol and Cassandra Query Language v3. This driver can also be used with other DataStax products:.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              cpp-driver has a low active ecosystem.
              It has 384 star(s) with 286 fork(s). There are 72 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              cpp-driver has no issues reported. There are 17 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of cpp-driver is 2.16.2

            kandi-Quality Quality

              cpp-driver has no bugs reported.

            kandi-Security Security

              cpp-driver has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.

            kandi-License License

              cpp-driver is licensed under the Apache-2.0 License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              cpp-driver releases are available to install and integrate.
              Installation instructions are not available. Examples and code snippets are available.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of cpp-driver
            Get all kandi verified functions for this library.

            cpp-driver Key Features

            No Key Features are available at this moment for cpp-driver.

            cpp-driver Examples and Code Snippets

            No Code Snippets are available at this moment for cpp-driver.

            Community Discussions

            QUESTION

            Cassandra session data corruption from multithreaded read
            Asked 2021-Jan-11 at 22:27

            I am having an issue with the cassandra api and select queries. In a single threaded context it works just fine. However, when multiple threads use the same object and call the function, even with just two threads, cassandra is returning it's futures with bad data(sometimes appears to be overwritten with data from other select queries, other times it is just garbage). I have a singleton object handling my calls to cassandra, and a byte buffer struct to hold the data returned. I have determined that, on a single thread, it all works as intended, but when I have added more threads using the same object and calling the same function, erroneous data is introduced into the data returned from cassandra.

            The values sizes are ~1kb in size, and the keys are 32 bytes.

            You can see the 2 lines surrounded by commented out mutex locks. If uncommented, this prevents the incorrect data issue, but also negates any performance gains from increasing the number of threads.

            Additionally, the percentage of corrupted queries is about ~33%.

            The cassandra api is supposed to be able to handle multiple threads and connections to the session without any issues(as per http://datastax.github.io/cpp-driver/topics/), so why am I getting back bad data?

            I am using Centos7, c++14 and cassandra api 2.15 with cassandra 3.11.4

            ...

            ANSWER

            Answered 2021-Jan-11 at 22:27

            It looks like you're freeing the results before a copy is made from the value pointers into the byteBuf. In single-threaded version, you may be getting lucky that the dereferenced memory is still intact. Multithreaded, you're likely to overwrite.

            Source https://stackoverflow.com/questions/65673813

            QUESTION

            Creating Custom Buildpack with binary-builder
            Asked 2019-Jun-20 at 14:44

            currently I'm trying to connect a PHP App in Cloud Foundry with an Oracle Database. For this I need to build the binaries for php with the oci8 driver in order to use pdo_oci in my application. For this I'm using

            https://github.com/cloudfoundry/binary-builder

            with docker. This seems to work fine. However after this, I don't know how to move on.

            I've read the Cloud Foundry Docs about custom Buildpacks ( https://docs.cloudfoundry.org/buildpacks/custom.html ). There they describe the creation of custom Buildpacks in three steps:

            1. Ensure that you have installed the buildpack-packager.

            2. Create a manifest.yml in your buildpack.

            3. Run the packager in cached mode (...)

            I've installed the buildpack-manager on my local machine and simply tried to run in against the binaries I've got from the binary builder. I thought it could working since there is a sources.yml file which looks similar to a manifest.yml

            ...

            ANSWER

            Answered 2019-Jun-20 at 14:44

            To build a custom PHP buildpack, typically done to include proprietary dependencies like Oracle or SQL Server drivers you can do the following.

            1. Build PHP. This is done with binary-builder. Follow the instructions here. Build as many versions of PHP as you require. This will produce tgz files that contain the binaries.

            2. Host your custom binaries on a web server. This could be local or public, it depends on your needs (see step #5) below.

            3. Clone the PHP Buildpack and checkout one of the stable release tags. Do not build from master as that makes it really hard to know what you're getting or recreate your build. When in doubt, pick the latest tagged release.

            4. Edit the manifest.yml file. If it already has entries for the versions of PHP that you built, you can just modify the uri, sha256 hash and modules. You need to add in the additional extensions you compiled to the modules list. For example, append oci8 or pdo_oci to that list. If you're compiling a version of PHP that doesn't existing in the manifest, copy an existing entry and edit all the properties. You can also adjust the manifest to change default versions of PHP or to remove versions you don't want and slim down the buildpack.

            5. At this point, you can either commit your changes, push to a fork of the PHP buildpack and set cf push -b to point to your fork, or alternatively, you can run the build pack packager and create a buildpack file. You can then take that and cf create-buildpack or cf update-buildpack in your foundation (requires admin permissions).

              If you use cf push -b then the binaries you are hosting in step #2 must be accessible from the CF foundation where you are running your application. If you create and upload a buildpack, then the binaries only need to be accessible from the VM where you run build pack packager.

            Hope that helps!

            Source https://stackoverflow.com/questions/56667634

            QUESTION

            How to safely use unique_ptr with functions which can return NULL?
            Asked 2019-Jun-11 at 00:27

            I've noticed that this compiles:

            ...

            ANSWER

            Answered 2019-Jun-10 at 03:50

            That's fine. It's just the NULL macro (which expands to just 0 on most compilers) that's causing the problem. 0 matches both the nullptr_t and T* constructors of unique_ptr, so it's ambiguous and won't compile.

            When initializing a unique_ptr with a pointer variable or the return value of a function, it doesn't matter whether nullptr, NULL or 0 was used. They all have the same effect: a null pointer:

            This is perfectly fine, for example

            Source https://stackoverflow.com/questions/56520134

            QUESTION

            Cassandra driver querying with multiple keys
            Asked 2019-May-17 at 06:57

            I'm trying to query cassandra from a c++ application, and return the values for a set of keys. I am using the datastax driver described here: http://datastax.github.io/cpp-driver/api/

            The cassandra query string is something like this:

            ...

            ANSWER

            Answered 2019-May-17 at 06:57

            There are several things here:

            1. the syntax IN (?) means that you are always asking only for one item - your list has only one entry;
            2. if you want to query multiple items, you need to change syntax to IN ? and bind it using ass_statement_bind_collection_by_name to the value has LIST type. See doc on how you can create collection types;
            3. Using IN for query on partition key is really anti-pattern - it adds load to the node that is performing the query, and makes your queries slower as coordinating node will need to send requests to other nodes, and wait for results, collect them, and send back. It's will be faster if you issue separate requests for each partition key, and collect answer in your application.

            Source https://stackoverflow.com/questions/56178687

            QUESTION

            How does the Cassandra C++ Driver use the zlib library?
            Asked 2019-Apr-23 at 13:12

            The Cassandra C++ Driver has an option used to enable the zlib library:

            ...

            ANSWER

            Answered 2019-Apr-23 at 13:12

            The driver does not currently use zlib; it is there for future work. CPP-103 will add compression support to the driver which will utilize zlib at that time. It remained in the build system due to legacy implementation and can safely be ignored.

            If you would like to see this feature implemented please vote or comment on the JIRA issue.

            Source https://stackoverflow.com/questions/55803736

            QUESTION

            Unable to connect to Cassandra db using php driver in laravel project
            Asked 2018-Jun-05 at 22:33

            I really need some help with this, spent the last two days trying to figure it out.

            I am attempting to migrate a laravel project from Mongo to Cassandra. I use docker containers for my local setup, here is the docker-compose.yml file with the relevant information

            ...

            ANSWER

            Answered 2018-May-10 at 13:18

            Port 7199 is the JMX monitoring port; you should change the port from 7199 => 9042.

            https://docs.datastax.com/en/cassandra/3.0/cassandra/configuration/secureFireWall.html

            If you are still having issues connecting to Apache Cassandra try executing the following to ensure the driver is being properly loaded via CLI:

            Source https://stackoverflow.com/questions/50262112

            QUESTION

            Correct way of passing pointer to another thread
            Asked 2018-Jun-04 at 09:35

            I've got 2 functions, func1() and func2(). func2 takes a character array as input. Both functions run on different threads. I call func2 from func1. When I passed a stack allocated array to func2, I got garbage values when I printed the array from inside func2(). However, when I passed a heap allocated array to func2, I got the correct string inside func2() i.e.

            ...

            ANSWER

            Answered 2018-Jun-04 at 08:17

            Does this mean that in multi-threaded programs, whenever some pointer has to be passed between different threads, the pointer should always be pointing at a heap-allocated memory?

            No. This means that you must keep track of the lifetimes of your objects properly. When thread 1 finishes execution, the stack will be automatically cleaned up, thus spoiling the results that thread 2 is working with. Heap memory on the other hand stays if not explicitely freed. You have to check in thread 1 whether thread 2 is still executing and wait until it is finished, e.g. by using the join function.

            Source https://stackoverflow.com/questions/50676057

            QUESTION

            Number of connections per host in Datastax C++ driver
            Asked 2018-May-08 at 12:54

            I've not been able to understand the role of a 'connection' in the execution of a query on a host.

            cass_cluster_set_core_connections_per_host sets the number of connections made to each server in each IO thread. Why is this parameter configurable? What's the benefit of having more than 1 connection per IO thread? What decides the optimum value for this parameter?

            ...

            ANSWER

            Answered 2018-May-08 at 12:54

            This function sets the initial number of connections per host, and it could be increased up to value set by cass_cluster_set_max_connections_per_host function (by default it's 2). New connection is created when the number of in-flight request is greater than set by cass_cluster_set_max_concurrent_requests_threshold (default 100). You can set higher value with cass_cluster_set_core_connections_per_host if you know that you'll generate the big number of in-flight request from the beginning - in this case you won't spend time opening an additional connection when you're executing requests.

            Source https://stackoverflow.com/questions/50233992

            QUESTION

            Why does cass_future_get_result() return NULL?
            Asked 2018-Apr-11 at 23:11

            I'm using Datastax C++ driver. Intermittently I've noticed that cass_future_get_result() will return a NULL pointer.

            The documentation says that NULL will be returned in case of an error. (http://datastax.github.io/cpp-driver/api/struct.CassFuture/) That's ambiguous to the point of being unhelpful.

            What are the errors that will cause it to return NULL?

            ...

            ANSWER

            Answered 2018-Apr-11 at 23:11

            To get more information about the error you can perform the following:

            Source https://stackoverflow.com/questions/49781243

            QUESTION

            Primary Local DC in Cassandra
            Asked 2018-Feb-23 at 08:39

            Which one is the primary local datacenter in cassandra as mentioned in the description of "cass_cluster_set_load_balance_dc_aware" in https://datastax.github.io/cpp-driver/api/struct.CassCluster/

            ...

            ANSWER

            Answered 2018-Feb-23 at 08:39

            You set it as 2nd parameter (local_dc) of the cass_cluster_set_load_balance_dc_aware function. You need to specify correct DC name from your cluster.

            Source https://stackoverflow.com/questions/48943300

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install cpp-driver

            You can download it from GitHub.

            Support

            HomeAPIGetting StartedBuilding
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/datastax/cpp-driver.git

          • CLI

            gh repo clone datastax/cpp-driver

          • sshUrl

            git@github.com:datastax/cpp-driver.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link