Giter VIP home page Giter VIP logo

erlcass's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

erlcass's Issues

question about Synchronous API

Synchronous API will block os native thread ?

Or it only block erlang actor, the os native thread will use a event loop to handle io ?

Error running app

I compiled using rebar3.
All supported dependencies are installed

When I try to run the app, it gives following error

>>> lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.4 LTS
Release:	18.04
Codename:	bionic
>>> ./rebar3 shell --apps erlcass lager
===> Verifying dependencies...
===> Compiling erlcass
cpp-driver fork already exist. delete _build/deps for a fresh checkout.
make[1]: Entering directory '/home/ubuntu/data/erlcass/c_src'
make[1]: '/home/ubuntu/data/erlcass/c_src/../priv/erlcass_nif.so' is up to date.
make[1]: Leaving directory '/home/ubuntu/data/erlcass/c_src'
Erlang/OTP 22 [erts-10.7.2] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:1] [hipe]

Eshell V10.7.2  (abort with ^G)
1> ===> The rebar3 shell is a development tool; to deploy applications in production, consider using releases (http://www.rebar3.org/docs/releases)
08:00:21.852 [info] loading library: "/home/ubuntu/data/erlcass/_build/default/lib/erlcass/priv/erlcass_nif" 
Floating point exception (core dumped)

Any idea?

Compile failure with 2.8.1 driver

FYI nn Ubuntu 17.10:

===> Compiling erlcass
cpp-driver fork already exist. delete _build/deps for a fresh checkout.
make[1]: Entering directory 'XXXX/_build/default/lib/erlcass/c_src'
 LD     erlcass_nif.so
/usr/bin/ld: XXXXX/_build/default/lib/erlcass/_build/deps/cpp-driver/build/libcassandra_static.a(batch_request.cpp.o): relocation R_X86_64_PC32 against symbol `_ZGVN4cass12SpinlockPoolINS_4Host14LatencyTrackerEE10spinlocks_E' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
nif.mk:71: recipe for target 'XXXXX/_build/default/lib/erlcass/c_src/../priv/erlcass_nif.so' failed
make[1]: *** [XXXXX/_build/default/lib/erlcass/c_src/../priv/erlcass_nif.so] Error 1
make[1]: Leaving directory 'XXXX/_build/default/lib/erlcass/c_src'
Makefile:10: recipe for target 'nif_compile' failed
make: *** [nif_compile] Error 2
===> Hook for compile failed!

Segmentation fault

erlcass v2.8
OTP 19.3

CREATE TABLE channel.test (
    id text, 
    name text,
    PRIMARY KEY (id)
);
erlcass:add_prepare_statement(test, "SELECT * FROM channel.test WHERE id=?").
erlcass:execute(test, [<<"test">>, <<"test">>]).

After executed query, we get - Segmentation fault

Bind params to non-prepared statement

It's not work:

{ok, Stm1} = erlcass:query_new_statement(<<"UPDATE table2 set name =?">>)
ok = erlcass:bind_prepared_params_by_index(Stm1, [name])

Not able to build erlclass using rebar

Hello,
I am not able to build this dependency while using rebar.
I have following error:

Compiling` ${project_root}/deps/erlcass/c_src/nif_cass_statement.cc
In file included from deps/cpp-driver/src/buffer.hpp:20:0,
                 from deps/cpp-driver/src/abstract_data.hpp:20,
                 from deps/cpp-driver/src/statement.hpp:20,
                 from deps/cpp-driver/src/execute_request.hpp:23,
                 from 
${project_root}/deps/erlcass/c_src/nif_cass_statement.cc:15:
deps/cpp-driver/src/ref_counted.hpp:25:16: fatal error: uv.h: No such file or directory
 #include <uv.h>
                ^
compilation terminated.

I have same issue on master branch and tags v2.3 and v2.2
I am using E16B03.

Regards,
Szymon

How to add multiple key/value pair in map using prepare statement?

I have created table that contains map as follow. I am using v2.4 tag version of erlcass.

CREATE TABLE users ( user_id text PRIMARY KEY, first_name text, last_name text, todo map<text,text> );

I want to insert multiple key/value. So I created prepare statement as below.

erlcass:add_prepare_statement(test,<<"INSERT INTO users (user_id, todo) VALUES(?,?)">>).

and I am running execute statement as below.

erlcass:execute(test,1,[<<"user">>,<<"{ 'b' : 'birthday wishes to Bilbo', 'c': 'Check into Inn of Pracing Pony'}">>]).

But it throws below exception.

** exception error: bad argument in function erlcass_nif:cass_statement_bind_parameters/3 called as erlcass_nif:cass_statement_bind_parameters(<<>>,1, [<<"user">>, <<"{ 'b' : 'birthday wishes to Bilbo', 'c': 'Check into Inn of Pracing Pony'}">>]) in call from erlcass:async_execute/3 (src/erlcass.erl, line 162) in call from erlcass:execute/3 (src/erlcass.erl, line 187)

Let me know it's issue with erlcass or I am doing something wrong? If I am doing something wrong then please suggest correct way of doing it.

Thanks.

Xandra benchmark

Hey there 👋

I'm the co-maintainer of Xandra, a Cassandra driver for Elixir. I'm really interested in your benchmarks and would love to have Xandra there as well, but the benchmarking setup seemed a bit complex to reproduce myself. Is there any chance you could run the same benchmark with Xandra? I can help with all the Elixir-related bits if you want.

Can't build driver above v4.0.5

Hi, I have 24.3.4 erlang and I have tried to build drivers.

4.0.4 - OK
4.0.5 - OK
4.0.6 - ERROR

 LD     erlcass_nif.so

Undefined symbols for architecture x86_64:
  "_ERR_new", referenced from:
      datastax::internal::core::OpenSslContext::set_cert(char const*, unsigned long) in libcassandra_static.a(ssl_openssl_impl.cpp.o)
  "_ERR_set_debug", referenced from:
      datastax::internal::core::OpenSslContext::set_cert(char const*, unsigned long) in libcassandra_static.a(ssl_openssl_impl.cpp.o)
  "_ERR_set_error", referenced from:
      datastax::internal::core::OpenSslContext::set_cert(char const*, unsigned long) in libcassandra_static.a(ssl_openssl_impl.cpp.o)
  "_SSL_get1_peer_certificate", referenced from:
      datastax::internal::core::OpenSslSession::verify() in libcassandra_static.a(ssl_openssl_impl.cpp.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [nif.mk:78: /Users/vitalijkutovoj/Documents/counters/_build/default/lib/erlcass/priv/erlcass_nif.so] Error 1
make[2]: Leaving directory '/Users/vitalijkutovoj/Documents/counters/_build/default/lib/erlcass/c_src'
make[1]: *** [Makefile:44: nif_compile] Error 2
make[1]: Leaving directory '/Users/vitalijkutovoj/Documents/counters/_build/default/lib/erlcass'
===> Hook for compile failed!

Something with SSL if I have understood correct, can you recommend what should I do?
MacOS - 12.5.1 (21G83)
~openssl version
OpenSSL 3.2.0 23 Nov 2023 (Library: OpenSSL 3.2.0 23 Nov 2023)

~brew --prefix [email protected]
/usr/local/opt/[email protected]

Is it possible to connect to multiple clusters?

I was wondering if it was possible to connect to multiple logically distinct clusters. In my use case data is stored across multiple clusters and it would be convenient to be able to choose which cluster is targeted.

application:stop(erlcass) is blocked

start () ->
application:start(erlcass),
ok.

stop() ->
application:start(erlcass), %% block in there
ok. %% never run to here

I try erlcass in my app. start erlcass is ok and all fucntion work well. but when I try stop erlcass. it block and never finish. I used prepare statement to aync insert something. Should I need clean somthing before stop erlcass?

Hex package build failure because Makefile, build_deps.sh missing

Hi,

After seeing #26 was addressed, I just tried using erlcass in a mix project by adding it as a dependency like this:

{:erlcass, "~> 3.2"}

I could pull the dep just fine with mix deps.get, but when I tried to compile it I get the error:

erlcass_test $ mix compile
===> Compiling goldrush
===> Compiling lager
===> Fetching rebar3_hex ({pkg,<<"rebar3_hex">>,<<"4.1.0">>})
===> Version cached at /Users/dwhite/.cache/rebar3/hex/default/packages/rebar3_hex-4.1.0.tar is up to date, reusing it
===> Compiling rebar3_hex
===> Compiling erlcass
make: *** No rule to make target `nif_compile'.  Stop.
===> Hook for compile failed!

** (Mix) Could not compile dependency :erlcass, "/Users/dwhite/.asdf/installs/elixir/1.7.1/.mix/rebar3 bare compile --paths "/Users/dwhite/src/yieldbot/erlcass_test/_build/dev/lib/*/ebin"" command failed. You can recompile this dependency with "mix deps.compile erlcass", update it with "mix deps.update erlcass" or clean it with "mix deps.clean erlcass"

Looking into this more, it looks like in the deps/erlcass directory, the files: Makefile and build_deps.sh are missing which I believe is the root cause of this issue. If I specify the dependency as a git dep like this:

{:erlcass, git: "[email protected]:silviucpp/erlcass.git"}

Then it is pulled down and compiles just fine.

GCC9 support ?

Hello

I am trying to use erlcass driver with erlang23 (in docker container) and discovered that erlang image is fetching alpine-linux with GNU 9.3.0 by default

As I can see the latest version of erlcass is using cpp-driver 2.13.0vsn which doesn't support gcc9

is there anyway to update erlcass to the latest supported version ?
Seems like its supported since 2.14.0 https://github.com/datastax/cpp-driver/releases

thanx in advance

Connect/Reconnect to cassandra cluster

Hello there to everyone.
Could someone put me to the right direction

I am getting this warnings on MacOs Mojave 10.14.5 (18F132)::
<<"Connection pool was unable to reconnect to host ******** because of the following error: Connect error 'operation not permitted'">> on <<"virtual void cass::Pool::on_close(cass::Connection *)">> at file src/pool.cpp line 420

but I can make any queries to cassandra database through already started application

libuv 1.29.1
openssl 1.0.2r

is there any steps to resolve this issue ?


**Also I have another device with Ubuntu 18.04 (and there is no problem with cassandra)

process hangs when Timestamp is greater than 2^64.

I am using Code from Tag v2.4

Whenever I try to convert Timestamp to UUID as below, calling process hangs forever.

erlcass_uuid:gen_from_ts(67255124296721106952000).

In logs it is showing below error in my application.
CRASH REPORT Process erlcass_uuid_proc with 0 neighbours crashed with reason: bad argument in call to erlcass_nif:cass_uuid_gen_from_time(<<>>, 67255124296721106952000) in erlcass_uuid:loop/1 line 94

And when I tried same scenario from Erlang shell, it shows below error and stuck there.
driver received: {'EXIT',<0.66.0>,badarg}

When I checked code, I found that erlcass_uuid:gen_from_ts call never times out. So calling process is stuck always. And after process erlcass_uuid_proc crashed, it doesn't come up automatically through supervisor behaviour. Since it is not coming up subsequent calls from different process is failing to convert valid timestamp(value in range) as erlcass_uuid_proc is down.

-Thanks

Cassandra / CQL version compatibility status

Hi there, was wondering which version of cassandra/CQL that erlcass currently supports.

Also, are you using this in production for your own project? What sort of production load has erlcass handled so far?

Thanks!

Fails to compile on architectures where char is unsigned by default

Similar issue (maybe the same issue?) was fixed in the Datastax/cpp-driver here: datastax/cpp-driver#320

#19 128.4 /opt/app/deps/erlcass/c_src/uuid_serialization.cc:44:1: error: narrowing conversion of '-1' from 'int' to 'char' [-Wnarrowing]
#19 128.4 /opt/app/deps/erlcass/c_src/uuid_serialization.cc: In function 'CassError erlcass::cass_uuid_from_string_n(const char*, size_t, CassUuid*)':
#19 128.4 /opt/app/deps/erlcass/c_src/uuid_serialization.cc:81:60: error: comparison is always false due to limited range of data type [-Werror=type-limits]
#19 128.4    81 |         if (kHexaToByteTable[static_cast<uint8_t>(pos[0])] == -1 || kHexaToByteTable[static_cast<uint8_t>(pos[1])] == -1)
#19 128.4       |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
#19 128.4 /opt/app/deps/erlcass/c_src/uuid_serialization.cc:81:116: error: comparison is always false due to limited range of data type [-Werror=type-limits]
#19 128.4    81 |         if (kHexaToByteTable[static_cast<uint8_t>(pos[0])] == -1 || kHexaToByteTable[static_cast<uint8_t>(pos[1])] == -1)
#19 128.4       |                                                                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
#19 128.4  CPP    fun_bindings.cc
#19 128.5 cc1plus: all warnings being treated as errors
#19 128.5 make[1]: *** [nif.mk:84: /opt/app/deps/erlcass/c_src/uuid_serialization.o] Error 1
#19 128.5 make[1]: *** Waiting for unfinished jobs....
#19 130.3 make[1]: Leaving directory '/opt/app/deps/erlcass/c_src'
#19 130.3 make: *** [Makefile:44: nif_compile] Error 2
#19 130.3 ===> Hook for compile failed!

Can't start v4.1.2 - {stop,{error,connect_session_timeout}

Hi again!
After update to v4.1.2 driver doesn't connect to Cassandra with error
Supervisor erlcass_sup had child erlcass started with erlcass:start_link() at undefined exit with reason bad return value: {stop,{error,connect_session_timeout},shutdown,{state,undefined}} in context start_error
When I rollback to v4.1.1 - it's ok, I suppose something was changed in v4.1.2 about connection? My config

  {erlcass, [
    {log_level, 3},
    {keyspace, ?KEYSPACE},
    {cluster_options,[
      {contact_points, ?HOSTS},
     {port, 9042},
     {latency_aware_routing, true},
     {token_aware_routing, true},
     {number_threads_io, 4},
     {queue_size_io, 128000},
     {core_connections_host, 1},
     {tcp_nodelay, true},
     {tcp_keepalive, {true, 1800}},
     {default_consistency_level, 6}
   ]}
 ]}

I tried to add option
{connect_timeout, 60000},
And no result

Maybe problem because of new cpp-driver version?
v4.1.2 doesn't work on both MacOS (x64 and ARM) with the same reason.

Is it possible to run erlcass from .app.src file?

Hello,
I have a question like in the title.
I have app.src file as following:

%% -*- erlang -*-
{application, test_app,
 [
  {description, "Desc"},
  {vsn, "1.0"},
  {modules, [test_module]},
  {registered, [db_module]},
  {applications, [kernel, stdlib, crypto, erlcass]},
  {included_applications, [erlcass]}
]}.

In app config I have configuration:

{erlcass,
 [
 {
    cluster_options,
    [
        {contact_points, "127.0.0.1"},
        {port, 26742},
        {core_connections_host, 10},
        {max_connections_host, 10},
        {default_consistency_level, 1},
        {number_threads_io, 4},
        {queue_size_io, 128000},
        {pending_requests_high_watermark, 128000},
        {tcp_nodelay, true},
        {tcp_keepalive, {true, 1800}},
        {key_space, "test-key"}
     ]
 }
 ]
}

After running app I have following error:

09:31:41.925 [error] CRASH REPORT Process <0.92.0> with 2 neighbours exited with reason: bad argument in call to erlcass_nif:cass_cluster_set_options([{contact_points,"127.0.0.1"},{port,26742},{core_connections_host,10},{max_connections_host,10},...]) in erlcass:init/1 line 221
09:31:41.926 [error] Supervisor erlcass_sup had child erlcass started with erlcass:start_link() at undefined exit with reason bad argument in call to erlcass_nif:cass_cluster_set_options([{contact_points,"127.0.0.1"},{port,26742},{core_connections_host,10},{max_connections_host,10},...]) in erlcass:init/1 line 221 in context start_error
09:31:41.926 [error] CRASH REPORT Process <0.89.0> with 0 neighbours exited with reason: {{shutdown,{failed_to_start_child,erlcass,{badarg,[{erlcass_nif,cass_cluster_set_options,[[{contact_points,"127.0.0.1"},{port,26742},{core_connections_host,10},{max_connections_host,10},{default_consistency_level,1},{number_threads_io,4},{queue_size_io,128000},{pending_requests_high_watermark,128000},{tcp_nodelay,true},{tcp_keepalive,{true,1800}},{key_space,"test-key"}]],[]},{erlcass,init,1,[{file,"src/erlcass.erl"},{line,221}]},{gen_server,init_it,6,[{file,"gen_server.erl"},{line,304}]},{proc_lib,...}]}}},...} in application_master:init/4 line 133

I am using tag v2.3.

Regards,
Szymon

Can't build driver, fatal error: 'uv.h' file not found

Hi, I have:

  1. Apple M3 Pro
  2. 14.4.1 (23E224)

I can't build the driver because of error:

 CPP    nif_utils.cc
In file included from /Users/dn010992kvo1/Documents/antifraud-systems/_build/default/lib/erlcass/c_src/nif_cass_session.cc:8:
In file included from /Users/dn010992kvo1/Documents/antifraud-systems/_build/default/lib/erlcass/_build/deps/cpp-driver/src/logger.hpp:21:
/Users/dn010992kvo1/Documents/antifraud-systems/_build/default/lib/erlcass/_build/deps/cpp-driver/src/get_time.hpp:20:10: fatal error: 'uv.h' file not found
#include <uv.h>
         ^~~~~~

I figured out that uv.h is linked with libuv and I see this file into

MacBook-Pro-Kutovyi:libuv dn010992kvo1$ cd 1.48.0/include/
MacBook-Pro-Kutovyi:include dn010992kvo1$ pwd
/opt/homebrew/Cellar/libuv/1.48.0/include
MacBook-Pro-Kutovyi:include dn010992kvo1$ ls
uv	uv.h

I can't understand that is the problem, maybe do you have any ideas?

rebar compile breaks

Not able to compile on Debian bullseye x86_64

~/data/erlcass$ ./rebar3 compile
===> Fetching rebar3_hex v7.0.7
===> Fetching hex_core v0.8.4
===> Fetching verl v1.1.1
===> Analyzing applications...
===> Compiling hex_core
===> Compiling verl
===> Compiling rebar3_hex
===> Verifying dependencies...
bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
Your system debian is not supported
~/data/erlcass/_build/deps ~/data/erlcass
Cloning into 'cpp-driver'...
Note: switching to '90df2c9ca1aa184a746445698533c71f7f34a2e1'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

~/data/erlcass
~/data/erlcass/_build/deps/cpp-driver/build ~/data/erlcass
./build_deps.sh: line 98: cmake: command not found
make[1]: Entering directory '/home/pankaj/data/erlcass/_build/deps/cpp-driver/build'
make[1]: *** No targets specified and no makefile found.  Stop.
make[1]: Leaving directory '/home/pankaj/data/erlcass/_build/deps/cpp-driver/build'
~/data/erlcass
make[1]: Entering directory '/home/pankaj/data/erlcass/c_src'
 CPP    nif_cass_uuid.cc
 CPP    nif_utils.cc
 CPP    erlcass.cc
 CPP    nif_cass_prepared.cc
 CPP    constants.cc
 CPP    nif_cass_session.cc
 CPP    fun_bindings.cc
In file included from /home/pankaj/data/erlcass/_build/deps/cpp-driver/src/logger.hpp:22,
                 from /home/pankaj/data/erlcass/c_src/nif_cass_session.cc:8:
/home/pankaj/data/erlcass/_build/deps/cpp-driver/src/string.hpp:21:10: fatal error: driver_config.hpp: No such file or directory
   21 | #include "driver_config.hpp"
      |          ^~~~~~~~~~~~~~~~~~~
compilation terminated.
make[1]: *** [nif.mk:84: /home/pankaj/data/erlcass/c_src/nif_cass_session.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory '/home/pankaj/data/erlcass/c_src'
make: *** [Makefile:44: nif_compile] Error 2
===> Hook for compile failed!

How to profiling the write performance?

Hi,

I got a module that using erlcass 2.8 to save data to Cassandra. Currently I met a performance issue and I have no idea to profiling the performance. I try the

cassandra-stress write n=1000000

on the DB server and got the result :

Results:
Op rate : 16,139 op/s [WRITE: 16,139 op/s]
Partition rate : 16,139 pk/s [WRITE: 16,139 pk/s]
Row rate : 16,139 row/s [WRITE: 16,139 row/s]
Latency mean : 12.3 ms [WRITE: 12.3 ms]
Latency median : 9.7 ms [WRITE: 9.7 ms]
Latency 95th percentile : 28.0 ms [WRITE: 28.0 ms]
Latency 99th percentile : 73.6 ms [WRITE: 73.6 ms]
Latency 99.9th percentile : 120.2 ms [WRITE: 120.2 ms]
Latency max : 219.3 ms [WRITE: 219.3 ms]
Total partitions : 1,000,000 [WRITE: 1,000,000]
Total errors : 0 [WRITE: 0]
Total GC count : 0
Total GC memory : 0.000 KiB
Total GC time : 0.0 seconds
Avg GC time : NaN ms
StdDev GC time : 0.0 ms
Total operation time : 00:01:01

But in my module, I need 3~10+ ms to process 4 insert commands (only with less than 10 fields in a row). I have already make it into a batch command. The module's server and Cassandra server is in the same LAN. Dues to I just call function likes:

{ok, Stm1} = erlcass:bind_prepared_statement(insert_message), ok = erlcass:bind_prepared_params_by_index(Stm1, [UID, LUser, Peer, Timestamp, xml:element_to_binary(Xml), Body, jlib:atom_to_binary(Dir)]),

{ok, Stm2} = erlcass:bind_prepared_statement(insert_message_by_ts), ok = erlcass:bind_prepared_params_by_index(Stm2, [LUser, Timestamp, UID]),

{ok, Stm3} = erlcass:bind_prepared_statement(insert_message_by_peer_ts), ok = erlcass:bind_prepared_params_by_index(Stm3, [LUser, Peer, Timestamp, UID]),

{ok, Stm4} = erlcass:bind_prepared_statement(insert_peer_list_by_ts), ok = erlcass:bind_prepared_params_by_index(Stm4, [LUser, Peer, binary_to_integer(jlib:timestamp()), Timestamp]),

erlcass:batch_execute(?CASS_BATCH_TYPE_LOGGED, [Stm1, Stm2, Stm3, Stm4], [{consistency_level, ?CASS_CONSISTENCY_QUORUM}]),

Then I got really bad performance ( less than 1000 row/second), so I need to find out what happened inside the erlcass module.

Are there some debug helper functions can help me to profiling where is the bottleneck of my system?
Maybe it just caused by my error setting of erlcass?

Thank you~
Eric

build_deps.sh overriding libuv install in Ubuntu 16.04

Hi!

I'm updating my TravisCI config file, and I'm using the Xenial Ubuntu (16.04) environment. This environment already comes with the correct libuv version (v1 instead of v0), however, in my Travis executions, I see that upon running build_deps.sh my existing version is downgraded to v0 in some weird way. Is it possible that, like for the CentOS configuration, you could add a check that verifies if libuv is available and only proceed if it's not?

It would be invaluable for me to get this working without rough edges :)

Thanks,

Need help to integrate in ejabberd 17.08

Hi everyone,

I need to integrate erlacass in ejabberd as I am integrating new database. I have both thing installed and working separate but now I need to call erlcass from inside the ejabbed modules , can anyone please guide me how I can do it?

How to get current time by erlcass.

Hi,
I use following function in cql to generate timestamp of my data.

toTimeStamp(now())

Are there similar functions in erlcass that can generate the same data for me?

Thank you~~

Eric

Stream rows

Recently i worked with standard Node.JS Cassandra Driver,
that implements row streams that can call a callback whenever a row receives,

have your driver implements streams ? or you implement it as a feature ?

cpp-driver fails with g++ 8.3.0

I'm using Ubuntu 19.04, where the default g++ version is 8.3.0.
When trying to build a project depending on erlcass, it fails in it's cpp-compile-step:

.../deps/erlcass/_build/deps/cpp-driver/src/third_party/sparsehash/src/sparsehash/internal/libc_allocator_with_realloc.h:68:40: error: 'void* realloc(void*, size_t)' moving an object of non-trivially copyable type 'struct std::pair<const std::__cxx11::basic_string<char>, cass::SharedRefPtr<const cass::PreparedMetadata::Entry> >'; use 'new' and 'delete' instead [-Werror=class-memaccess]
     return static_cast<pointer>(realloc(p, n * sizeof(value_type)));
                                 ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/8/bits/stl_algobase.h:64,
                 from /usr/include/c++/8/bits/char_traits.h:39,
                 from /usr/include/c++/8/string:40

The problem was easily fixed by installing g++-7 from apt.

Hex package

Hi 👋

I want to publish a package on Hex that depends on erlcass, but this would require erlcass to be published as well. Do you have plans for publishing it on Hex?

Thanks,

How to connect to cluster with SSL?

Hi, I'm trying to connect to Amazon Keyspaces and I have to add sf-class2-root.crt certificate and can't understand how. I see

{ssl, [
        {trusted_certs, CertsList::list()},
        {cert, Cert::binary()},
        {private_key, {PrivateKey::binary(), KeyPassword::binary()}},
        {verify_flags, VerifyFlags::integer()}
       ]
}

but it doesn't work. How to do it?

AWS says that "Amazon Keyspaces requires the use of Transport Layer Security (TLS) to help secure connections with clients."
And in other examples like a GO driver it requires just add one param with certificate path.
https://docs.aws.amazon.com/keyspaces/latest/devguide/using_go_driver.html

Error is

{{badmatch,{error,<<"Unable to load certificate">>}},
 [{erlcass_cluster,set_options,1,

I made

{ssl,
       [
         {cert, <<"/Users/vitalijkutovoj/Documents/sf-class2-root.crt">>},
         {verify_flags, 1}
       ]
     },

And tried different schemes to add it.

Compilation failing on ubuntu 16.04 64 bit

compilation fails for master and v3.0 tag

steps I took

git clone repo
git checkout v3.0
make

error

connection.cpp fails to compile

connection.cpp:249:55: error: could not convert ‘local_address->cass::Address::addr()’ from ‘const sockaddr*’ to ‘sockaddr_in’
     int rc = uv_tcp_bind(&socket_, local_address->addr(), 0);

the logs are below

Linux, Ubuntu
gpg: keyring `/tmp/tmpyubf8w5p/secring.gpg' created
gpg: keyring `/tmp/tmpyubf8w5p/pubring.gpg' created
gpg: requesting key 1C99696E from hkp server keyserver.ubuntu.com
gpg: /tmp/tmpyubf8w5p/trustdb.gpg: trustdb created
gpg: key 1C99696E: public key "Launchpad PPA for Andrew Hutchings" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
OK
Hit:1 http://eu-west-1.ec2.archive.ubuntu.com/ubuntu xenial InRelease
Hit:2 http://eu-west-1.ec2.archive.ubuntu.com/ubuntu xenial-updates InRelease                          
Hit:3 http://eu-west-1.ec2.archive.ubuntu.com/ubuntu xenial-backports InRelease                        
Ign:4 http://ppa.launchpad.net/linuxjedi/ppa/ubuntu xenial InRelease                                                             
Hit:5 http://security.ubuntu.com/ubuntu xenial-security InRelease                                                                
Hit:6 http://ppa.launchpad.net/webupd8team/java/ubuntu xenial InRelease                            
Ign:7 http://ppa.launchpad.net/linuxjedi/ppa/ubuntu xenial Release           
Ign:8 http://ppa.launchpad.net/linuxjedi/ppa/ubuntu xenial/main amd64 Packages
Ign:9 http://ppa.launchpad.net/linuxjedi/ppa/ubuntu xenial/main all Packages
Ign:10 http://ppa.launchpad.net/linuxjedi/ppa/ubuntu xenial/main Translation-en_US
Ign:11 http://ppa.launchpad.net/linuxjedi/ppa/ubuntu xenial/main Translation-en
Ign:8 http://ppa.launchpad.net/linuxjedi/ppa/ubuntu xenial/main amd64 Packages
Ign:9 http://ppa.launchpad.net/linuxjedi/ppa/ubuntu xenial/main all Packages 
Ign:10 http://ppa.launchpad.net/linuxjedi/ppa/ubuntu xenial/main Translation-en_US
Ign:11 http://ppa.launchpad.net/linuxjedi/ppa/ubuntu xenial/main Translation-en
Ign:8 http://ppa.launchpad.net/linuxjedi/ppa/ubuntu xenial/main amd64 Packages
Ign:9 http://ppa.launchpad.net/linuxjedi/ppa/ubuntu xenial/main all Packages
Ign:10 http://ppa.launchpad.net/linuxjedi/ppa/ubuntu xenial/main Translation-en_US
Ign:11 http://ppa.launchpad.net/linuxjedi/ppa/ubuntu xenial/main Translation-en
Ign:8 http://ppa.launchpad.net/linuxjedi/ppa/ubuntu xenial/main amd64 Packages
Ign:9 http://ppa.launchpad.net/linuxjedi/ppa/ubuntu xenial/main all Packages
Ign:10 http://ppa.launchpad.net/linuxjedi/ppa/ubuntu xenial/main Translation-en_US
Ign:11 http://ppa.launchpad.net/linuxjedi/ppa/ubuntu xenial/main Translation-en
Ign:8 http://ppa.launchpad.net/linuxjedi/ppa/ubuntu xenial/main amd64 Packages
Ign:9 http://ppa.launchpad.net/linuxjedi/ppa/ubuntu xenial/main all Packages
Ign:10 http://ppa.launchpad.net/linuxjedi/ppa/ubuntu xenial/main Translation-en_US
Ign:11 http://ppa.launchpad.net/linuxjedi/ppa/ubuntu xenial/main Translation-en
Err:8 http://ppa.launchpad.net/linuxjedi/ppa/ubuntu xenial/main amd64 Packages
  404  Not Found
Ign:9 http://ppa.launchpad.net/linuxjedi/ppa/ubuntu xenial/main all Packages
Ign:10 http://ppa.launchpad.net/linuxjedi/ppa/ubuntu xenial/main Translation-en_US
Ign:11 http://ppa.launchpad.net/linuxjedi/ppa/ubuntu xenial/main Translation-en
Reading package lists... Done
W: The repository 'http://ppa.launchpad.net/linuxjedi/ppa/ubuntu xenial Release' does not have a Release file.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: Failed to fetch http://ppa.launchpad.net/linuxjedi/ppa/ubuntu/dists/xenial/main/binary-amd64/Packages  404  Not Found
E: Some index files failed to download. They have been ignored, or old ones used instead.
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'libuv0.10-dev' instead of 'libuv-dev'
g++ is already the newest version (4:5.3.1-1ubuntu1).
make is already the newest version (4.1-6).
libuv0.10-dev is already the newest version (0.10.36-3).
cmake is already the newest version (3.5.1-1ubuntu3).
libssl-dev is already the newest version (1.0.2g-1ubuntu4.12).
0 upgraded, 0 newly installed, 0 to remove and 10 not upgraded.
/home/ubuntu/data/erlcass/_build/deps /home/ubuntu/data/erlcass
Cloning into 'cpp-driver'...
remote: Counting objects: 24573, done.
remote: Compressing objects: 100% (35/35), done.
remote: Total 24573 (delta 14), reused 26 (delta 8), pack-reused 24527
Receiving objects: 100% (24573/24573), 71.19 MiB | 7.26 MiB/s, done.
Resolving deltas: 100% (16384/16384), done.
Checking connectivity... done.
/home/ubuntu/data/erlcass/_build/deps/cpp-driver /home/ubuntu/data/erlcass/_build/deps /home/ubuntu/data/erlcass
Your branch is up-to-date with 'origin/master'.
/home/ubuntu/data/erlcass/_build/deps /home/ubuntu/data/erlcass
/home/ubuntu/data/erlcass
/home/ubuntu/data/erlcass/_build/deps/cpp-driver/build /home/ubuntu/data/erlcass
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- PROJECT version: 2.9.0
-- Found Libuv: /usr/lib/x86_64-linux-gnu/libuv.so  
-- LIBUV version: 0.10
CMake Warning at cmake/modules/CppDriver.cmake:382 (message):
  Libuv version 0.10 does not support reverse name lookup.  Hostname
  resolution will not work (version 1.0 or greater required)
Call Stack (most recent call first):
  CMakeLists.txt:81 (CassUseLibuv)


CMake Warning at cmake/modules/CppDriver.cmake:388 (message):
  Libuv version 0.10 does not support custom memory allocators (version 1.6
  or greater required)
Call Stack (most recent call first):
  CMakeLists.txt:81 (CassUseLibuv)


-- Found OpenSSL: /usr/lib/x86_64-linux-gnu/libssl.so (found version "1.0.2g") 
-- Using std::atomic implementation for atomic operations
-- Checking to see if CXX compiler accepts flag -std=c++11
-- Checking to see if CXX compiler accepts flag -std=c++11 - yes
-- Using hash header <functional> and namespace "std"
-- Looking for inttypes.h
-- Looking for inttypes.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for memcpy
-- Looking for memcpy - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of long long
-- Check size of long long - done
-- Check size of uint16_t
-- Check size of uint16_t - done
-- Check size of u_int16_t
-- Check size of u_int16_t - done
-- Check size of __uint16_t
-- Check size of __uint16_t - done
-- Looking for GRND_NONBLOCK
-- Looking for GRND_NONBLOCK - found
-- Looking for SO_NOSIGPIPE
-- Looking for SO_NOSIGPIPE - not found
-- Looking for sigtimedwait
-- Looking for sigtimedwait - found
-- Performing Test HAVE_BUILTIN_BSWAP32
-- Performing Test HAVE_BUILTIN_BSWAP32 - Success
-- Performing Test HAVE_BUILTIN_BSWAP64
-- Performing Test HAVE_BUILTIN_BSWAP64 - Success
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1") 
-- Configuring done
-- Generating done
-- Build files have been written to: /home/ubuntu/data/erlcass/_build/deps/cpp-driver/build
make[1]: Entering directory '/home/ubuntu/data/erlcass/_build/deps/cpp-driver/build'
make[2]: Entering directory '/home/ubuntu/data/erlcass/_build/deps/cpp-driver/build'
make[3]: Entering directory '/home/ubuntu/data/erlcass/_build/deps/cpp-driver/build'
Scanning dependencies of target cassandra
make[3]: Leaving directory '/home/ubuntu/data/erlcass/_build/deps/cpp-driver/build'
make[3]: Entering directory '/home/ubuntu/data/erlcass/_build/deps/cpp-driver/build'
[  1%] Building CXX object CMakeFiles/cassandra.dir/src/map_iterator.cpp.o
[  2%] Building CXX object CMakeFiles/cassandra.dir/src/abstract_data.cpp.o
[  3%] Building CXX object CMakeFiles/cassandra.dir/src/batch_request.cpp.o
[  5%] Building CXX object CMakeFiles/cassandra.dir/src/logger.cpp.o
[  6%] Building CXX object CMakeFiles/cassandra.dir/src/round_robin_policy.cpp.o
[  7%] Building CXX object CMakeFiles/cassandra.dir/src/auth.cpp.o
[  9%] Building CXX object CMakeFiles/cassandra.dir/src/tuple.cpp.o
[ 10%] Building CXX object CMakeFiles/cassandra.dir/src/get_time-unix.cpp.o
[ 11%] Building CXX object CMakeFiles/cassandra.dir/src/result_response.cpp.o
[ 13%] Building CXX object CMakeFiles/cassandra.dir/src/statement.cpp.o
[ 14%] Building CXX object CMakeFiles/cassandra.dir/src/event_response.cpp.o
[ 15%] Building CXX object CMakeFiles/cassandra.dir/src/future.cpp.o
[ 17%] Building CXX object CMakeFiles/cassandra.dir/src/error_response.cpp.o
[ 18%] Building CXX object CMakeFiles/cassandra.dir/src/whitelist_dc_policy.cpp.o
[ 19%] Building CXX object CMakeFiles/cassandra.dir/src/token_map_impl.cpp.o
[ 21%] Building CXX object CMakeFiles/cassandra.dir/src/host.cpp.o
[ 22%] Building CXX object CMakeFiles/cassandra.dir/src/session.cpp.o
[ 23%] Building CXX object CMakeFiles/cassandra.dir/src/data_type.cpp.o
[ 25%] Building CXX object CMakeFiles/cassandra.dir/src/auth_responses.cpp.o
[ 26%] Building CXX object CMakeFiles/cassandra.dir/src/md5.cpp.o
[ 27%] Building CXX object CMakeFiles/cassandra.dir/src/blacklist_policy.cpp.o
[ 28%] Building CXX object CMakeFiles/cassandra.dir/src/prepare_host_handler.cpp.o
[ 30%] Building CXX object CMakeFiles/cassandra.dir/src/utils.cpp.o
[ 31%] Building CXX object CMakeFiles/cassandra.dir/src/supported_response.cpp.o
[ 32%] Building CXX object CMakeFiles/cassandra.dir/src/register_request.cpp.o
[ 34%] Building CXX object CMakeFiles/cassandra.dir/src/iterator.cpp.o
[ 35%] Building CXX object CMakeFiles/cassandra.dir/src/host_targeting_policy.cpp.o
[ 36%] Building CXX object CMakeFiles/cassandra.dir/src/collection.cpp.o
[ 38%] Building CXX object CMakeFiles/cassandra.dir/src/request_callback.cpp.o
[ 39%] Building CXX object CMakeFiles/cassandra.dir/src/random.cpp.o
[ 40%] Building CXX object CMakeFiles/cassandra.dir/src/murmur3.cpp.o
[ 42%] Building CXX object CMakeFiles/cassandra.dir/src/user_type_field_iterator.cpp.o
[ 43%] Building CXX object CMakeFiles/cassandra.dir/src/control_connection.cpp.o
[ 44%] Building CXX object CMakeFiles/cassandra.dir/src/request.cpp.o
[ 46%] Building CXX object CMakeFiles/cassandra.dir/src/io_worker.cpp.o
[ 47%] Building CXX object CMakeFiles/cassandra.dir/src/schema_change_callback.cpp.o
[ 48%] Building CXX object CMakeFiles/cassandra.dir/src/testing.cpp.o
[ 50%] Building CXX object CMakeFiles/cassandra.dir/src/user_type_value.cpp.o
[ 51%] Building CXX object CMakeFiles/cassandra.dir/src/auth_requests.cpp.o
[ 52%] Building CXX object CMakeFiles/cassandra.dir/src/dc_aware_policy.cpp.o
[ 53%] Building CXX object CMakeFiles/cassandra.dir/src/result_metadata.cpp.o
[ 55%] Building CXX object CMakeFiles/cassandra.dir/src/ring_buffer.cpp.o
[ 56%] Building CXX object CMakeFiles/cassandra.dir/src/query_request.cpp.o
[ 57%] Building CXX object CMakeFiles/cassandra.dir/src/request_handler.cpp.o
[ 59%] Building CXX object CMakeFiles/cassandra.dir/src/prepare_request.cpp.o
[ 60%] Building CXX object CMakeFiles/cassandra.dir/src/retry_policy.cpp.o
[ 61%] Building CXX object CMakeFiles/cassandra.dir/src/external.cpp.o
[ 63%] Building CXX object CMakeFiles/cassandra.dir/src/list_policy.cpp.o
[ 64%] Building CXX object CMakeFiles/cassandra.dir/src/token_aware_policy.cpp.o
[ 65%] Building CXX object CMakeFiles/cassandra.dir/src/timestamp_generator.cpp.o
[ 67%] Building CXX object CMakeFiles/cassandra.dir/src/ssl.cpp.o
[ 68%] Building CXX object CMakeFiles/cassandra.dir/src/token_map.cpp.o
[ 69%] Building CXX object CMakeFiles/cassandra.dir/src/row.cpp.o
[ 71%] Building CXX object CMakeFiles/cassandra.dir/src/prepared.cpp.o
[ 72%] Building CXX object CMakeFiles/cassandra.dir/src/data_type_parser.cpp.o
[ 73%] Building CXX object CMakeFiles/cassandra.dir/src/value.cpp.o
[ 75%] Building CXX object CMakeFiles/cassandra.dir/src/metadata.cpp.o
[ 76%] Building CXX object CMakeFiles/cassandra.dir/src/connection.cpp.o
[ 77%] Building CXX object CMakeFiles/cassandra.dir/src/pool.cpp.o
[ 78%] Building CXX object CMakeFiles/cassandra.dir/src/response.cpp.o
[ 80%] Building CXX object CMakeFiles/cassandra.dir/src/whitelist_policy.cpp.o
[ 81%] Building CXX object CMakeFiles/cassandra.dir/src/execute_request.cpp.o
[ 82%] Building CXX object CMakeFiles/cassandra.dir/src/startup_request.cpp.o
[ 84%] Building CXX object CMakeFiles/cassandra.dir/src/blacklist_dc_policy.cpp.o
[ 85%] Building CXX object CMakeFiles/cassandra.dir/src/encode.cpp.o
[ 86%] Building CXX object CMakeFiles/cassandra.dir/src/string_ref.cpp.o
[ 88%] Building CXX object CMakeFiles/cassandra.dir/src/cluster.cpp.o
/home/ubuntu/data/erlcass/_build/deps/cpp-driver/src/connection.cpp: In constructor ‘cass::Connection::Connection(uv_loop_t*, const cass::Config&, cass::Metrics*, const ConstPtr&, const string&, int, cass::Connection::Listener*)’:
/home/ubuntu/data/erlcass/_build/deps/cpp-driver/src/connection.cpp:249:55: error: could not convert ‘local_address->cass::Address::addr()’ from ‘const sockaddr*’ to ‘sockaddr_in’
     int rc = uv_tcp_bind(&socket_, local_address->addr(), 0);
                                                       ^
[ 89%] Building CXX object CMakeFiles/cassandra.dir/src/latency_aware_policy.cpp.o
[ 90%] Building CXX object CMakeFiles/cassandra.dir/src/collection_iterator.cpp.o
[ 92%] Building CXX object CMakeFiles/cassandra.dir/src/uuids.cpp.o
[ 93%] Building CXX object CMakeFiles/cassandra.dir/src/address.cpp.o
[ 94%] Building CXX object CMakeFiles/cassandra.dir/src/third_party/hdr_histogram/hdr_histogram.cpp.o
[ 96%] Building CXX object CMakeFiles/cassandra.dir/src/third_party/curl/hostcheck.cpp.o
[ 97%] Building CXX object CMakeFiles/cassandra.dir/src/ssl/ssl_openssl_impl.cpp.o
[ 98%] Building CXX object CMakeFiles/cassandra.dir/src/ssl/ring_buffer_bio.cpp.o
CMakeFiles/cassandra.dir/build.make:1430: recipe for target 'CMakeFiles/cassandra.dir/src/connection.cpp.o' failed
make[3]: *** [CMakeFiles/cassandra.dir/src/connection.cpp.o] Error 1
make[3]: *** Waiting for unfinished jobs....
make[3]: Leaving directory '/home/ubuntu/data/erlcass/_build/deps/cpp-driver/build'
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/cassandra.dir/all' failed
make[2]: *** [CMakeFiles/cassandra.dir/all] Error 2
make[2]: Leaving directory '/home/ubuntu/data/erlcass/_build/deps/cpp-driver/build'
Makefile:149: recipe for target 'all' failed
make[1]: *** [all] Error 2
make[1]: Leaving directory '/home/ubuntu/data/erlcass/_build/deps/cpp-driver/build'
/home/ubuntu/data/erlcass
make[1]: Entering directory '/home/ubuntu/data/erlcass/c_src'
 CPP    data_conversion.cc
 CPP    constants.cc
 CPP    nif_cass_uuid.cc
 CPP    nif_cass_prepared.cc
 CPP    nif_date_time.cc
 CPP    nif_utils.cc
 CPP    nif_cass_statement.cc
 CPP    nif_cass_cluster.cc
 CPP    cass_binding.cc
 CPP    erlcass.cc
 CPP    uuid_serialization.cc
 CPP    nif_cass_session.cc
 CPP    fun_bindings.cc
/home/ubuntu/data/erlcass/c_src/nif_cass_cluster.cc: In function ‘ERL_NIF_TERM apply_cluster_settings(ErlNifEnv*, ERL_NIF_TERM, ERL_NIF_TERM, ERL_NIF_TERM, cassandra_data*)’:
/home/ubuntu/data/erlcass/c_src/nif_cass_cluster.cc:385:75: error: ‘CassError cass_cluster_set_write_bytes_high_water_mark(CassCluster*, unsigned int)’ is deprecated [-Werror=deprecated-declarations]
     UNSIGNED_INT_SETTING(ATOMS.atomClusterSettingWriteBytesHighWaterMark, cass_cluster_set_write_bytes_high_water_mark);
                                                                           ^
/home/ubuntu/data/erlcass/c_src/nif_cass_cluster.cc:36:44: note: in definition of macro ‘UNSIGNED_INT_SETTING’
         return cass_error_to_nif_term(env, Func(data->cluster, value)); \
                                            ^
In file included from /home/ubuntu/data/erlcass/c_src/erlcass.h:5:0,
                 from /home/ubuntu/data/erlcass/c_src/nif_cass_cluster.cc:2:
/home/ubuntu/data/erlcass/_build/deps/cpp-driver/include/cassandra.h:1238:17: note: declared here
 CASS_DEPRECATED(cass_cluster_set_write_bytes_high_water_mark(CassCluster* cluster,
                 ^
/home/ubuntu/data/erlcass/_build/deps/cpp-driver/include/cassandra.h:41:33: note: in definition of macro ‘CASS_DEPRECATED’
 #  define CASS_DEPRECATED(func) func __attribute__((deprecated))
                                 ^
/home/ubuntu/data/erlcass/c_src/nif_cass_cluster.cc:385:75: error: ‘CassError cass_cluster_set_write_bytes_high_water_mark(CassCluster*, unsigned int)’ is deprecated [-Werror=deprecated-declarations]
     UNSIGNED_INT_SETTING(ATOMS.atomClusterSettingWriteBytesHighWaterMark, cass_cluster_set_write_bytes_high_water_mark);
                                                                           ^
/home/ubuntu/data/erlcass/c_src/nif_cass_cluster.cc:36:44: note: in definition of macro ‘UNSIGNED_INT_SETTING’
         return cass_error_to_nif_term(env, Func(data->cluster, value)); \
                                            ^
In file included from /home/ubuntu/data/erlcass/c_src/erlcass.h:5:0,
                 from /home/ubuntu/data/erlcass/c_src/nif_cass_cluster.cc:2:
/home/ubuntu/data/erlcass/_build/deps/cpp-driver/include/cassandra.h:1238:17: note: declared here
 CASS_DEPRECATED(cass_cluster_set_write_bytes_high_water_mark(CassCluster* cluster,
                 ^
/home/ubuntu/data/erlcass/_build/deps/cpp-driver/include/cassandra.h:41:33: note: in definition of macro ‘CASS_DEPRECATED’
 #  define CASS_DEPRECATED(func) func __attribute__((deprecated))
                                 ^
/home/ubuntu/data/erlcass/c_src/nif_cass_cluster.cc:36:69: error: ‘CassError cass_cluster_set_write_bytes_high_water_mark(CassCluster*, unsigned int)’ is deprecated [-Werror=deprecated-declarations]
         return cass_error_to_nif_term(env, Func(data->cluster, value)); \
                                                                     ^
/home/ubuntu/data/erlcass/c_src/nif_cass_cluster.cc:385:5: note: in expansion of macro ‘UNSIGNED_INT_SETTING’
     UNSIGNED_INT_SETTING(ATOMS.atomClusterSettingWriteBytesHighWaterMark, cass_cluster_set_write_bytes_high_water_mark);
     ^
In file included from /home/ubuntu/data/erlcass/c_src/erlcass.h:5:0,
                 from /home/ubuntu/data/erlcass/c_src/nif_cass_cluster.cc:2:
/home/ubuntu/data/erlcass/_build/deps/cpp-driver/include/cassandra.h:1238:17: note: declared here
 CASS_DEPRECATED(cass_cluster_set_write_bytes_high_water_mark(CassCluster* cluster,
                 ^
/home/ubuntu/data/erlcass/_build/deps/cpp-driver/include/cassandra.h:41:33: note: in definition of macro ‘CASS_DEPRECATED’
 #  define CASS_DEPRECATED(func) func __attribute__((deprecated))
                                 ^
/home/ubuntu/data/erlcass/c_src/nif_cass_cluster.cc:386:74: error: ‘CassError cass_cluster_set_write_bytes_low_water_mark(CassCluster*, unsigned int)’ is deprecated [-Werror=deprecated-declarations]
     UNSIGNED_INT_SETTING(ATOMS.atomClusterSettingWriteBytesLowWaterMark, cass_cluster_set_write_bytes_low_water_mark);
                                                                          ^
/home/ubuntu/data/erlcass/c_src/nif_cass_cluster.cc:36:44: note: in definition of macro ‘UNSIGNED_INT_SETTING’
         return cass_error_to_nif_term(env, Func(data->cluster, value)); \
                                            ^
In file included from /home/ubuntu/data/erlcass/c_src/erlcass.h:5:0,
                 from /home/ubuntu/data/erlcass/c_src/nif_cass_cluster.cc:2:
/home/ubuntu/data/erlcass/_build/deps/cpp-driver/include/cassandra.h:1258:17: note: declared here
 CASS_DEPRECATED(cass_cluster_set_write_bytes_low_water_mark(CassCluster* cluster,
                 ^
/home/ubuntu/data/erlcass/_build/deps/cpp-driver/include/cassandra.h:41:33: note: in definition of macro ‘CASS_DEPRECATED’
 #  define CASS_DEPRECATED(func) func __attribute__((deprecated))
                                 ^
/home/ubuntu/data/erlcass/c_src/nif_cass_cluster.cc:386:74: error: ‘CassError cass_cluster_set_write_bytes_low_water_mark(CassCluster*, unsigned int)’ is deprecated [-Werror=deprecated-declarations]
     UNSIGNED_INT_SETTING(ATOMS.atomClusterSettingWriteBytesLowWaterMark, cass_cluster_set_write_bytes_low_water_mark);
                                                                          ^
/home/ubuntu/data/erlcass/c_src/nif_cass_cluster.cc:36:44: note: in definition of macro ‘UNSIGNED_INT_SETTING’
         return cass_error_to_nif_term(env, Func(data->cluster, value)); \
                                            ^
In file included from /home/ubuntu/data/erlcass/c_src/erlcass.h:5:0,
                 from /home/ubuntu/data/erlcass/c_src/nif_cass_cluster.cc:2:
/home/ubuntu/data/erlcass/_build/deps/cpp-driver/include/cassandra.h:1258:17: note: declared here
 CASS_DEPRECATED(cass_cluster_set_write_bytes_low_water_mark(CassCluster* cluster,
                 ^
/home/ubuntu/data/erlcass/_build/deps/cpp-driver/include/cassandra.h:41:33: note: in definition of macro ‘CASS_DEPRECATED’
 #  define CASS_DEPRECATED(func) func __attribute__((deprecated))
                                 ^
/home/ubuntu/data/erlcass/c_src/nif_cass_cluster.cc:36:69: error: ‘CassError cass_cluster_set_write_bytes_low_water_mark(CassCluster*, unsigned int)’ is deprecated [-Werror=deprecated-declarations]
         return cass_error_to_nif_term(env, Func(data->cluster, value)); \
                                                                     ^
/home/ubuntu/data/erlcass/c_src/nif_cass_cluster.cc:386:5: note: in expansion of macro ‘UNSIGNED_INT_SETTING’
     UNSIGNED_INT_SETTING(ATOMS.atomClusterSettingWriteBytesLowWaterMark, cass_cluster_set_write_bytes_low_water_mark);
     ^
In file included from /home/ubuntu/data/erlcass/c_src/erlcass.h:5:0,
                 from /home/ubuntu/data/erlcass/c_src/nif_cass_cluster.cc:2:
/home/ubuntu/data/erlcass/_build/deps/cpp-driver/include/cassandra.h:1258:17: note: declared here
 CASS_DEPRECATED(cass_cluster_set_write_bytes_low_water_mark(CassCluster* cluster,
                 ^
/home/ubuntu/data/erlcass/_build/deps/cpp-driver/include/cassandra.h:41:33: note: in definition of macro ‘CASS_DEPRECATED’
 #  define CASS_DEPRECATED(func) func __attribute__((deprecated))
                                 ^
/home/ubuntu/data/erlcass/c_src/nif_cass_cluster.cc:387:80: error: ‘CassError cass_cluster_set_pending_requests_high_water_mark(CassCluster*, unsigned int)’ is deprecated [-Werror=deprecated-declarations]
     UNSIGNED_INT_SETTING(ATOMS.atomClusterSettingPendingRequestsHighWaterMark, cass_cluster_set_pending_requests_high_water_mark);
                                                                                ^
/home/ubuntu/data/erlcass/c_src/nif_cass_cluster.cc:36:44: note: in definition of macro ‘UNSIGNED_INT_SETTING’
         return cass_error_to_nif_term(env, Func(data->cluster, value)); \
                                            ^
In file included from /home/ubuntu/data/erlcass/c_src/erlcass.h:5:0,
                 from /home/ubuntu/data/erlcass/c_src/nif_cass_cluster.cc:2:
/home/ubuntu/data/erlcass/_build/deps/cpp-driver/include/cassandra.h:1279:17: note: declared here
 CASS_DEPRECATED(cass_cluster_set_pending_requests_high_water_mark(CassCluster* cluster,
                 ^
/home/ubuntu/data/erlcass/_build/deps/cpp-driver/include/cassandra.h:41:33: note: in definition of macro ‘CASS_DEPRECATED’
 #  define CASS_DEPRECATED(func) func __attribute__((deprecated))
                                 ^
/home/ubuntu/data/erlcass/c_src/nif_cass_cluster.cc:387:80: error: ‘CassError cass_cluster_set_pending_requests_high_water_mark(CassCluster*, unsigned int)’ is deprecated [-Werror=deprecated-declarations]
     UNSIGNED_INT_SETTING(ATOMS.atomClusterSettingPendingRequestsHighWaterMark, cass_cluster_set_pending_requests_high_water_mark);
                                                                                ^
/home/ubuntu/data/erlcass/c_src/nif_cass_cluster.cc:36:44: note: in definition of macro ‘UNSIGNED_INT_SETTING’
         return cass_error_to_nif_term(env, Func(data->cluster, value)); \
                                            ^
In file included from /home/ubuntu/data/erlcass/c_src/erlcass.h:5:0,
                 from /home/ubuntu/data/erlcass/c_src/nif_cass_cluster.cc:2:
/home/ubuntu/data/erlcass/_build/deps/cpp-driver/include/cassandra.h:1279:17: note: declared here
 CASS_DEPRECATED(cass_cluster_set_pending_requests_high_water_mark(CassCluster* cluster,
                 ^
/home/ubuntu/data/erlcass/_build/deps/cpp-driver/include/cassandra.h:41:33: note: in definition of macro ‘CASS_DEPRECATED’
 #  define CASS_DEPRECATED(func) func __attribute__((deprecated))
                                 ^
/home/ubuntu/data/erlcass/c_src/nif_cass_cluster.cc:36:69: error: ‘CassError cass_cluster_set_pending_requests_high_water_mark(CassCluster*, unsigned int)’ is deprecated [-Werror=deprecated-declarations]
         return cass_error_to_nif_term(env, Func(data->cluster, value)); \
                                                                     ^
/home/ubuntu/data/erlcass/c_src/nif_cass_cluster.cc:387:5: note: in expansion of macro ‘UNSIGNED_INT_SETTING’
     UNSIGNED_INT_SETTING(ATOMS.atomClusterSettingPendingRequestsHighWaterMark, cass_cluster_set_pending_requests_high_water_mark);
     ^
In file included from /home/ubuntu/data/erlcass/c_src/erlcass.h:5:0,
                 from /home/ubuntu/data/erlcass/c_src/nif_cass_cluster.cc:2:
/home/ubuntu/data/erlcass/_build/deps/cpp-driver/include/cassandra.h:1279:17: note: declared here
 CASS_DEPRECATED(cass_cluster_set_pending_requests_high_water_mark(CassCluster* cluster,
                 ^
/home/ubuntu/data/erlcass/_build/deps/cpp-driver/include/cassandra.h:41:33: note: in definition of macro ‘CASS_DEPRECATED’
 #  define CASS_DEPRECATED(func) func __attribute__((deprecated))
                                 ^
/home/ubuntu/data/erlcass/c_src/nif_cass_cluster.cc:388:79: error: ‘CassError cass_cluster_set_pending_requests_low_water_mark(CassCluster*, unsigned int)’ is deprecated [-Werror=deprecated-declarations]
     UNSIGNED_INT_SETTING(ATOMS.atomClusterSettingPendingRequestsLowWaterMark, cass_cluster_set_pending_requests_low_water_mark);
                                                                               ^
/home/ubuntu/data/erlcass/c_src/nif_cass_cluster.cc:36:44: note: in definition of macro ‘UNSIGNED_INT_SETTING’
         return cass_error_to_nif_term(env, Func(data->cluster, value)); \
                                            ^
In file included from /home/ubuntu/data/erlcass/c_src/erlcass.h:5:0,
                 from /home/ubuntu/data/erlcass/c_src/nif_cass_cluster.cc:2:
/home/ubuntu/data/erlcass/_build/deps/cpp-driver/include/cassandra.h:1300:17: note: declared here
 CASS_DEPRECATED(cass_cluster_set_pending_requests_low_water_mark(CassCluster* cluster,
                 ^
/home/ubuntu/data/erlcass/_build/deps/cpp-driver/include/cassandra.h:41:33: note: in definition of macro ‘CASS_DEPRECATED’
 #  define CASS_DEPRECATED(func) func __attribute__((deprecated))
                                 ^
/home/ubuntu/data/erlcass/c_src/nif_cass_cluster.cc:388:79: error: ‘CassError cass_cluster_set_pending_requests_low_water_mark(CassCluster*, unsigned int)’ is deprecated [-Werror=deprecated-declarations]
     UNSIGNED_INT_SETTING(ATOMS.atomClusterSettingPendingRequestsLowWaterMark, cass_cluster_set_pending_requests_low_water_mark);
                                                                               ^
/home/ubuntu/data/erlcass/c_src/nif_cass_cluster.cc:36:44: note: in definition of macro ‘UNSIGNED_INT_SETTING’
         return cass_error_to_nif_term(env, Func(data->cluster, value)); \
                                            ^
In file included from /home/ubuntu/data/erlcass/c_src/erlcass.h:5:0,
                 from /home/ubuntu/data/erlcass/c_src/nif_cass_cluster.cc:2:
/home/ubuntu/data/erlcass/_build/deps/cpp-driver/include/cassandra.h:1300:17: note: declared here
 CASS_DEPRECATED(cass_cluster_set_pending_requests_low_water_mark(CassCluster* cluster,
                 ^
/home/ubuntu/data/erlcass/_build/deps/cpp-driver/include/cassandra.h:41:33: note: in definition of macro ‘CASS_DEPRECATED’
 #  define CASS_DEPRECATED(func) func __attribute__((deprecated))
                                 ^
/home/ubuntu/data/erlcass/c_src/nif_cass_cluster.cc:36:69: error: ‘CassError cass_cluster_set_pending_requests_low_water_mark(CassCluster*, unsigned int)’ is deprecated [-Werror=deprecated-declarations]
         return cass_error_to_nif_term(env, Func(data->cluster, value)); \
                                                                     ^
/home/ubuntu/data/erlcass/c_src/nif_cass_cluster.cc:388:5: note: in expansion of macro ‘UNSIGNED_INT_SETTING’
     UNSIGNED_INT_SETTING(ATOMS.atomClusterSettingPendingRequestsLowWaterMark, cass_cluster_set_pending_requests_low_water_mark);
     ^
In file included from /home/ubuntu/data/erlcass/c_src/erlcass.h:5:0,
                 from /home/ubuntu/data/erlcass/c_src/nif_cass_cluster.cc:2:
/home/ubuntu/data/erlcass/_build/deps/cpp-driver/include/cassandra.h:1300:17: note: declared here
 CASS_DEPRECATED(cass_cluster_set_pending_requests_low_water_mark(CassCluster* cluster,
                 ^
/home/ubuntu/data/erlcass/_build/deps/cpp-driver/include/cassandra.h:41:33: note: in definition of macro ‘CASS_DEPRECATED’
 #  define CASS_DEPRECATED(func) func __attribute__((deprecated))
                                 ^
cc1plus: all warnings being treated as errors
nif.mk:78: recipe for target '/home/ubuntu/data/erlcass/c_src/nif_cass_cluster.o' failed
make[1]: *** [/home/ubuntu/data/erlcass/c_src/nif_cass_cluster.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory '/home/ubuntu/data/erlcass/c_src'
Makefile:10: recipe for target 'nif_compile' failed
make: *** [nif_compile] Error 2

Compile errors due to deprecated methods

Hello. I'm getting compile errors due to deprecated methods. Errors like this one:

error: ‘CassError cass_cluster_set_write_bytes_high_water_mark(CassCluster*, unsigned int)’ is deprecated [-Werror=deprecated-declarations]
UNSIGNED_INT_SETTING(ATOMS.atomClusterSettingWriteBytesHighWaterMark, cass_cluster_set_write_bytes_high_water_mark);

Please help thanks :)

Couldn't compile Cassandra

I have faced the issues (after updating packages on macos)

Undefined symbols for architecture x86_64:
  "_ERR_get_error_all", referenced from:
      datastax::internal::core::OpenSslSession::check_error(int) in libcassandra_static.a(ssl_openssl_impl.cpp.o)
      ssl_log_errors(char const*) in libcassandra_static.a(ssl_openssl_impl.cpp.o)
  "_ERR_new", referenced from:
      datastax::internal::core::OpenSslContext::set_cert(char const*, unsigned long) in libcassandra_static.a(ssl_openssl_impl.cpp.o)
  "_ERR_set_debug", referenced from:
      datastax::internal::core::OpenSslContext::set_cert(char const*, unsigned long) in libcassandra_static.a(ssl_openssl_impl.cpp.o)
  "_ERR_set_error", referenced from:
      datastax::internal::core::OpenSslContext::set_cert(char const*, unsigned long) in libcassandra_static.a(ssl_openssl_impl.cpp.o)
  "_SSL_get1_peer_certificate", referenced from:
      datastax::internal::core::OpenSslSession::verify() in libcassandra_static.a(ssl_openssl_impl.cpp.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [/Users/dn251287dea/Documents/projects/channelapi/_build/default/lib/erlcass/priv/erlcass_nif.so] Error 1
make[1]: *** [nif_compile] Error 2
===> Hook for compile failed!

make: *** [compile] Error 1

can someone point me to the right direction to fix this issue ?

tcp_nodelay should enable or disable?

Hi
I am checking the tcp_nodelay setting, I found that in sample, tcp_nodelay is setting to true ({tcp_nodelay, true}).
But in wiki page. The description of tcp_nodelay is {tcp_nodelay, false} and said
Default: true (disabled).
I am a little confusing about this setting. The ture means disable tcp_nodelay?
If I want tcp sent packet ASAP. Should I use {tcp_nodelay, false} or {tcp_nodelay, true}?

Thank you~~

Segmentation fault

Hello there.

I am trying to use prepared statements and I got such error

here is the details :

Process:               beam.smp [39416]
Path:                  /usr/local/Cellar/erlang/22.0.2/lib/erlang/erts-10.4.1/bin/beam.smp
Identifier:            beam.smp
Version:               0
Code Type:             X86-64 (Native)
Parent Process:        ??? [39412]
Responsible:           beam.smp [39416]
User ID:               501

Date/Time:             2019-06-25 09:42:03.471 +0300
OS Version:            Mac OS X 10.14.5 (18F132)
Report Version:        12
Anonymous UUID:        8A45D459-111E-8A3B-4060-6F29BD632111

Sleep/Wake UUID:       BB7D50C2-EB6F-47C2-ACBE-A39E64A0EFB5

Time Awake Since Boot: 100000 seconds
Time Since Wake:       2200 seconds

System Integrity Protection: enabled

Crashed Thread:        35

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x00007fb2a1e2b330
Exception Note:        EXC_CORPSE_NOTIFY

Termination Signal:    Segmentation fault: 11
Termination Reason:    Namespace SIGNAL, Code 0xb
Terminating Process:   exc handler [39416]

Thread 35 Crashed:
0   erlcass_nif.so                	0x000000005af371b0 cass::decode_int32(char*, int&) + 16
1   erlcass_nif.so                	0x000000005b02689b cass::UserTypeFieldIterator::decode_field(char*) + 43
2   erlcass_nif.so                	0x000000005b026847 cass::UserTypeFieldIterator::next() + 167
3   erlcass_nif.so                	0x000000005ae4a566 cass_iterator_next + 38
4   erlcass_nif.so                	0x000000005ada93a0 udt_to_erlang_term(enif_environment_t*, CassValue_ const*) + 128 (data_conversion.cc:390)
5   erlcass_nif.so                	0x000000005ada90a6 collection_to_erlang_term(enif_environment_t*, CassValue_ const*) + 198 (data_conversion.cc:346)
6   erlcass_nif.so                	0x000000005ada9cf6 cass_result_to_erlang_term(enif_environment_t*, CassResult_ const*) + 374 (data_conversion.cc:449)
7   erlcass_nif.so                	0x000000005ada4045 on_statement_executed(CassFuture_*, void*) + 261 (nif_cass_session.cc:166)
8   erlcass_nif.so                	0x000000005ae3a64b cass::Future::internal_set(cass::ScopedLock<cass::Mutex>&) + 107
9   erlcass_nif.so                	0x000000005af2818e cass::ResponseFuture::set_response(cass::Address, cass::SharedRefPtr<cass::Response> const&) + 190
10  erlcass_nif.so                	0x000000005af2807e cass::RequestHandler::set_response(cass::SharedRefPtr<cass::Host> const&, cass::SharedRefPtr<cass::Response> const&) + 142
11  erlcass_nif.so                	0x000000005af2afb8 cass::RequestExecution::set_response(cass::SharedRefPtr<cass::Response> const&) + 56
12  erlcass_nif.so                	0x000000005af296c5 cass::RequestExecution::on_result_response(cass::Connection*, cass::ResponseMessage*) + 677
13  erlcass_nif.so                	0x000000005af292cd cass::RequestExecution::on_set(cass::ResponseMessage*) + 301
14  erlcass_nif.so                	0x000000005add72c1 cass::Connection::consume(char*, unsigned long) + 2993
15  erlcass_nif.so                	0x000000005add8a5b cass::Connection::on_read(uv_stream_s*, long, uv_buf_t const*) + 1083
16  libuv.1.dylib                 	0x00000000146d7d32 uv__stream_io + 1231
17  libuv.1.dylib                 	0x00000000146df183 uv__io_poll + 1704
18  libuv.1.dylib                 	0x00000000146cfc37 uv_run + 320
19  erlcass_nif.so                	0x000000005af56db1 cass::LoopThread::on_run_internal(void*) + 49
20  libsystem_pthread.dylib       	0x00007fff7c3912eb _pthread_body + 126
21  libsystem_pthread.dylib       	0x00007fff7c394249 _pthread_start + 66
22  libsystem_pthread.dylib       	0x00007fff7c39040d thread_start + 13

Here is the table settings & prepared statement

CREATE TABLE test ( 
    companyId text,
    releaseId timeuuid,
    created timestamp,
    user frozen<user>,
    name text, 
    description text,
    release map<text, frozen<viewReleaseInfo>>,
    PRIMARY KEY (companyId, releaseId)
) WITH  
    comment='
        View releases
    ';
    ok = erlcass:add_prepare_statement(
        test,
        <<
            "SELECT "
                "releaseId, "
                "release "
            "FROM test "
            "WHERE "
                "companyId=? AND releaseId<? "
            "ORDER BY releaseId DESC LIMIT 1"
        >>
    ),

the query is working fine when I execute it from app console but crashing when I use it through the application api

btw:
erlcass v3.2.4
erlang 22

if you need additional information let me know

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.