Git Product home page Git Product logo

cassandra-rs's People

Contributors

davideagen avatar djquan avatar ernestas-poskus avatar fluffels avatar gwicke avatar lakret avatar phact avatar rustyrazorblade avatar tupshin avatar

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

Watchers

 avatar  avatar  avatar  avatar

cassandra-rs's Issues

Can't complete the build of the crate

I’m not sure if this is user error or something going on in the crates but I have 18+ errors expecting cassandra::error::Error that all look like:

= note:  expected type 'std::result::Result<std::vec::Vec<u8>, cassandra::error::Error>' 
= note:  found type 'std::result::Result<std::vec::Vec<u8>, errors::Error>'

Pretty much all of the errors are looking for cassandra::error:Error. I suspect the error_chain! macro is not modifying the errors quite right. I was curious if you’ve heard about this problem before.

println in get_column_by_name

Hi,
I'm using get_column_by_name() function and since there is a println macro in it, it prints every row I get from DB. Can you please remove the println macro from that function?

Consider splitting into two crates

Ideally, crates that provide C-to-Rust bindings have the suffix -sys, but that doesn't appear to be the case here. This allows multiple nice user-facing interfaces to be built on top of shared code, and avoids an issue where you try to link to the same native library multiple times.

r2d2 Connection Pool

hey @tupshin I wonder if I could get some help I have implemented r2d2 connection pool for this crate. In the final step I need to fix

error: cannot borrow immutable field `self.cluster` as mutable
  --> src/lib.rs:54:9
   |
54 |         self.cluster.connect().map_err(Error::Other)
   |         ^^^^^^^^^^^^

error: aborting due to previous error

Since Rust does not have mutable fields maybe you could suggest any workaround ?

extern crate r2d2;
extern crate cassandra;
use std::error;
use std::error::Error as _StdError;
use std::fmt;

#[derive(Debug)]
pub enum Error {Other(cassandra::CassError)
}

impl error::Error for Error {
    fn description(&self) -> &str {
        match *self {
            Error::Other(ref err) => err.description()
        }
    }

    fn cause(&self) -> Option<&error::Error> {
        match *self {
            Error::Other(ref err) => err.cause()
        }
    }
}

impl fmt::Display for Error {
    fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
        match self.cause() {
            Some(cause) => write!(fmt, "{}: {}", self.description(), cause),
            None => write!(fmt, "{}", self.description())
        }
    }
}

pub struct CassandraConnectionManager {
    cluster: cassandra::Cluster
}

impl CassandraConnectionManager {
    /// Creates a new `CassandraConnectionManager`.
    pub fn new(cluster: cassandra::Cluster) -> CassandraConnectionManager {
        CassandraConnectionManager {
            cluster: cluster
        }
    }
}

impl r2d2::ManageConnection for CassandraConnectionManager {
    type Connection = cassandra::Session;
    type Error = Error;

    fn connect(&self) -> Result<cassandra::Session, Error> {
        // self.cluster.borrow_mut().connect()
        // self.cluster.connect().map_err(Error::Other)
        self.cluster.connect().map_err(Error::Other)
    }

    fn is_valid(&self, conn: &mut cassandra::Session) -> Result<(), Error> {
        // conn.execute(&'static"SELECT keyspace_name FROM system.schema_keyspaces;").wait().map(|_| () )
        Ok(())
    }

    fn has_broken(&self, _conn: &mut cassandra::Session) -> bool {
        false
    }
}

setting protocol version errors out

There's no tests in the repo for setting the protocol.

thread '<main>' panicked at 'called `Result::unwrap()` on an `Err` value: "Bad parameters"', 
../src/libcore/result.rs:736

Change are really breakin.. for 0.8.0

I get

thread '::test_find_one' panicked at 'called `Result::unwrap()` on an `Err` value: Error(LIB_NULL_VALUE(CASS_ERROR_LIB_NULL_VALUE), State { next_error: None, backtrace: None })', ../src/libcore/result.rs:837

2c57a82

This is related to to_result("").unwrap().into()

Use futures crate

Many of the async clients/servers are moving towards the common futures/tokio stuff, might be worth integrating cassandra-rs to use the rust futures crate

Unexpected panic/unwrap when retrieving null value from database

When retrieving data from the database I get this error if there is a null – tried with bool, i32, i64m double and worked fine – issue only with string.

RUST_BACKTRACE=1 cargo run
    Finished debug [unoptimized + debuginfo] target(s) in 0.0 secs
     Running `target/debug/cassandra-connector`
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error(LIB_NULL_VALUE(CASS_ERROR_LIB_NULL_VALUE), State { next_error: None, backtrace: Some(stack backtrace:
   0:     0x7fe28e3f0401 - backtrace::backtrace::libunwind::trace
                        at /opt/rust/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.0/src/backtrace/mod.rs:90
                         - backtrace::backtrace::trace<closure>
                        at /opt/rust/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.0/src/backtrace/mod.rs:42
   1:     0x7fe28e3f1408 - backtrace::capture::{{impl}}::new
                        at /opt/rust/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.0/src/lib.rs:101
   2:     0x7fe28e3e82c1 - error_chain::make_backtrace
                        at /opt/rust/.cargo/registry/src/github.com-1ecc6299db9ec823/error-chain-0.7.2/src/lib.rs:411
   3:     0x7fe28e3e8377 - error_chain::{{impl}}::default
                        at /opt/rust/.cargo/registry/src/github.com-1ecc6299db9ec823/error-chain-0.7.2/src/lib.rs:462
   4:     0x7fe28e2b464b - cassandra_sys::error::{{impl}}::from_kind
                        at /opt/rust/.cargo/registry/src/github.com-1ecc6299db9ec823/cassandra-sys-0.8.7/src/error.rs:6
   5:     0x7fe28e2b4841 - cassandra_sys::error::{{impl}}::from
                        at /opt/rust/.cargo/registry/src/github.com-1ecc6299db9ec823/cassandra-sys-0.8.7/src/error.rs:6
   6:     0x7fe28e2aaf51 - core::convert::{{impl}}::into<cassandra_sys::error::ErrorKind,cassandra_sys::error::Error>
                        at /buildslave/rust-buildbot/slave/stable-dist-rustc-linux/build/src/libcore/convert.rs:271
   7:     0x7fe28e2a0be9 - cassandra_sys::error::{{impl}}::to_result<&str>
                        at /opt/rust/.cargo/registry/src/github.com-1ecc6299db9ec823/cassandra-sys-0.8.7/src/error.rs:133
   8:     0x7fe28e2b17c9 - cassandra::cassandra::column::{{impl}}::get_string
                        at /opt/rust/.cargo/registry/src/github.com-1ecc6299db9ec823/cassandra-0.8.1/src/cassandra/column.rs:270
   9:     0x7fe28e299e65 - cassandra_connector::show
                        at /home/proj/cassandra-connector/src/main.rs:38
  10:     0x7fe28e29ab19 - cassandra_connector::main
                        at /home/proj/cassandra-connector/src/main.rs:76
  11:     0x7fe28e4095ca - panic_unwind::__rust_maybe_catch_panic
                        at /buildslave/rust-buildbot/slave/stable-dist-rustc-linux/build/src/libpanic_unwind/lib.rs:98
  12:     0x7fe28e4031b6 - std::panicking::try<(),fn()>
                        at /buildslave/rust-buildbot/slave/stable-dist-rustc-linux/build/src/libstd/panicking.rs:434
                         - std::panic::catch_unwind<fn(),()>
                        at /buildslave/rust-buildbot/slave/stable-dist-rustc-linux/build/src/libstd/panic.rs:351
                         - std::rt::lang_start
                        at /buildslave/rust-buildbot/slave/stable-dist-rustc-linux/build/src/libstd/rt.rs:57
  13:     0x7fe28e29b042 - main
  14:     0x7fe28c8f0b34 - __libc_start_main
  15:     0x7fe28e28d3e8 - <unknown>
  16:                0x0 - <unknown>) })', /buildslave/rust-buildbot/slave/stable-dist-rustc-linux/build/src/libcore/result.rs:837
stack backtrace:
   1:     0x7fe28e4008fa - std::sys::imp::backtrace::tracing::imp::write::h3188f035833a2635
                        at /buildslave/rust-buildbot/slave/stable-dist-rustc-linux/build/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:42
   2:     0x7fe28e40286f - std::panicking::default_hook::{{closure}}::h6385b6959a2dd25b
                        at /buildslave/rust-buildbot/slave/stable-dist-rustc-linux/build/src/libstd/panicking.rs:349
   3:     0x7fe28e40246e - std::panicking::default_hook::he4f3b61755d7fa95
                        at /buildslave/rust-buildbot/slave/stable-dist-rustc-linux/build/src/libstd/panicking.rs:365
   4:     0x7fe28e402cb7 - std::panicking::rust_panic_with_hook::hf00b8130f73095ec
                        at /buildslave/rust-buildbot/slave/stable-dist-rustc-linux/build/src/libstd/panicking.rs:553
   5:     0x7fe28e402af4 - std::panicking::begin_panic::h6227f62cb2cdaeb4
                        at /buildslave/rust-buildbot/slave/stable-dist-rustc-linux/build/src/libstd/panicking.rs:515
   6:     0x7fe28e402a69 - std::panicking::begin_panic_fmt::h173eadd80ae64bec
                        at /buildslave/rust-buildbot/slave/stable-dist-rustc-linux/build/src/libstd/panicking.rs:499
   7:     0x7fe28e4029f7 - rust_begin_unwind
                        at /buildslave/rust-buildbot/slave/stable-dist-rustc-linux/build/src/libstd/panicking.rs:475
   8:     0x7fe28e4331ed - core::panicking::panic_fmt::h3b2d1e30090844ff
                        at /buildslave/rust-buildbot/slave/stable-dist-rustc-linux/build/src/libcore/panicking.rs:69
   9:     0x7fe28e2aa215 - core::result::unwrap_failed::h6f1089a4164b68db
                        at /buildslave/rust-buildbot/slave/stable-dist-rustc-linux/build/src/libcore/macros.rs:29
  10:     0x7fe28e2a58bb - <core::result::Result<T, E>>::unwrap::hddf0ca9c49ea9914
                        at /buildslave/rust-buildbot/slave/stable-dist-rustc-linux/build/src/libcore/result.rs:737
  11:     0x7fe28e2b187a - cassandra::cassandra::column::Column::get_string::he370ca9df985f0ee
                        at /opt/rust/.cargo/registry/src/github.com-1ecc6299db9ec823/cassandra-0.8.1/src/cassandra/column.rs:270
  12:     0x7fe28e299e65 - cassandra_connector::show::hb977a687937c57f0
                        at /home/proj/cassandra-connector/src/main.rs:38
  13:     0x7fe28e29ab19 - cassandra_connector::main::h0159580624f528ae
                        at /home/proj/cassandra-connector/src/main.rs:76
  14:     0x7fe28e4095ca - __rust_maybe_catch_panic
                        at /buildslave/rust-buildbot/slave/stable-dist-rustc-linux/build/src/libpanic_unwind/lib.rs:98
  15:     0x7fe28e4031b6 - std::rt::lang_start::h65647f6e36cffdae
                        at /buildslave/rust-buildbot/slave/stable-dist-rustc-linux/build/src/libstd/panicking.rs:434
                        at /buildslave/rust-buildbot/slave/stable-dist-rustc-linux/build/src/libstd/panic.rs:351
                        at /buildslave/rust-buildbot/slave/stable-dist-rustc-linux/build/src/libstd/rt.rs:57
  16:     0x7fe28e29b042 - main
  17:     0x7fe28c8f0b34 - __libc_start_main
  18:     0x7fe28e28d3e8 - <unknown>
  19:                0x0 - <unknown>

I was hoping that the program would panic with the message “Bad string value! Error message….” As it does with other data types. (for the other types in the database it worked as expected: bool, i32, i62, double)

#[macro_use(stmt)]

extern crate cassandra;
use cassandra::*;
use std::str::FromStr;
#[derive(Debug,PartialEq,Clone,Copy)]
struct Basic {
    bln: bool,
    flt: f32,
    dbl: f64,
    i32: i32,
    i64: i64,
}
fn insert_into_basic(session: &mut Session, key: &str, basic: Basic) -> CassResult {
    let mut statement = stmt!("INSERT INTO examples.basic (key, bln, flt, dbl, i32, i64) VALUES \
                               (?, ?, ?, ?, ?, ?);");
    statement.bind(0, key);
    statement.bind(1, basic.bln);
    statement.bind(2, basic.flt);
    statement.bind(3, basic.dbl);
    statement.bind(4, basic.i32);
    statement.bind(5, basic.i64);
    let res = session.execute(&statement).wait().unwrap();
    res
}
fn select_all(session: &mut Session) -> CassResult {
    let stmt = stmt!("SELECT * FROM examples.basic");
    let result = match session.execute(&stmt).wait() {
        Result::Ok(val) => val,
        Result::Err(err) => panic!("Bad select! {}", err),
    };
    result
}
fn show(data: &CassResult) {
    for i in data.iter() {
        match i.get_column(5) {
            Result::Ok(val) => {
                match val.get_string() {
                    Result::Ok(s) => println!("{:?}", s),
                    Result::Err(err) => {
                        panic!("Bad string value! {}", err);
                    }
               }
            }
            Result::Err(err) => panic!("Bad column! {}", err),
        };
    }
}
fn main() {
    let input = Basic {
        bln: true,
        flt: 0.001f32,
        dbl: 0.0002f64,
        i32: 1,
        i64: 2,
    };
    let contact_points = match ContactPoints::from_str("127.0.0.1") {
        Result::Ok(val) => val,
        Result::Err(err) => panic!("My error! {}", err),
    };
    let mut cluster = Cluster::default();
    cluster.set_contact_points(contact_points).unwrap();
    cluster.set_load_balance_round_robin();
    match cluster.connect() {
        Ok(ref mut session) => {
            let ks_statement = &stmt!("CREATE KEYSPACE IF NOT EXISTS examples WITH replication = \
                                       { \'class\': \'SimpleStrategy\', \'replication_factor\': \
                                       \'1\' };");
            let table_statement = &stmt!("CREATE TABLE IF NOT EXISTS examples.basic (key text, \
                                          bln boolean, flt float, dbl double, i32 int, i64 \
                                          bigint, PRIMARY KEY (flt));");
            session.execute(ks_statement).wait().unwrap();
            session.execute(table_statement).wait().unwrap();
            insert_into_basic(session, "test", input);
            let output = select_all(session);
            show(&output);
            println!("{:?}", input);
            // println!("{:?}", output);
        }
        err => println!("{:?}", err),
    }
}

TableMeta should implement Display

: the trait bound cassandra::TableMeta: std::fmt::Display is not satisfied [E0277]
src/main.rssrc/main.rs:188 :188 println!("Schema: {}", schema);

Unknown Error w/ Cassandra 2.2 and Nightly on Insert

Running the basic rust example results in "An unknown error occured" when building with cargo build.

Seems to be associated with binding variables to a statement, or inserting. Non-variable bound statement (eg. session.execute("SELECT...) work to read rows.

FWIW Running on OS X (El Capitan). Also apologies if I am leaving out something basic, new to the Rust world.

bind_by_name example fails to bind the primary key

./target/bind_by_name

key=prepared_test
1421723211.466 [ERROR](src/statement.cpp:394:virtual bool cass::Statement::get_routing_key%28std::string*%29 const): Routing key cannot have null value or be a collection
thread '

' panicked at 'SERVER_INVALID_QUERY', bind_by_name.rs:81

calling get_col_by_name causes panic and program exit

This snippet:

let query = format!("select column_name, type from system_schema.columns where keyspace_name = '{}' and table_name = '{}'", keyspace, table);
            let schema_query = Statement::new(&query, 0);

            let result = self.session.execute(&schema_query).wait().unwrap();
            for row in result {
                let name : String = row.get_col_by_name("column_name").unwrap();
                let ftype : String = row.get_col_by_name("type").unwrap();

                println!("{} {}", name, ftype);
            }

Causes this error:

thread 'main' panicked at 'Unsupported type: CASS_VALUE_TYPE_BLOB', /Users/jhaddad/.multirust/toolchains/nightly/cargo/registry/src/github.com-1ecc6299db9ec823/cassandra-0.6.10/src/cassandra/column.rs:279

The odd thing is that re-running the same pgoram gives me another error; except sometimes it errors with 'Unsupported type: CASS_VALUE_TYPE_BLOB'.

Attempting to recreate simple example fails on a syntax error

Rust v1.0
[cqlsh 4.1.1 | Cassandra 2.0.14 | CQL spec 3.1.1 | Thrift protocol 19.39.0]

My code is nearly the same as the code in examples/

extern crate cassandra;
use cassandra::*;
static CONTACT_POINTS:&'static str = "172.20.20.10";

fn main() {
  println!("Before cluster connect");
  let cluster = &CassCluster::new()
                      .set_contact_points(CONTACT_POINTS).unwrap()
                      .set_load_balance_round_robin().unwrap();

  println!("Before session connect");
  let mut session = CassSession::new().connect(&cluster).wait().unwrap();
  println!("Before session execute");
  let result = session.execute("SELECT keyspace_name FROM system.schema_keyspaces;", 0).wait().unwrap();

  println!("{:?}", result);

  session.close().wait().unwrap();
}

And I get the output & error:

in Ticks/ on master
› cargo run --verbose
       Fresh gcc v0.3.5
       Fresh libc v0.1.7
       Fresh cql_bindgen v0.0.11
       Fresh cassandra v0.2.5
       Fresh time v0.1.25
       Fresh Ticks v0.1.0 (file:///Users/cschneid/Code/Rust/Ticks)
     Running `target/debug/Ticks`
Before cluster connect
Before session connect
Before session execute
thread '<main>' panicked at 'called `Result::unwrap()` on an `Err` value: "Syntax error"', /Users/rustbuild/src/rust-buildbot/slave/stable-dist-rustc-mac/build/src/libcore/result.rs:729
Process didn't exit successfully: `target/debug/Ticks` (exit code: 101)

The query runs fine in the cqlsh interface, so there's something else going on with the result, or result unwraping. I have the c++ library linked from their homebrew recipe, which is 1.0.0.

Segfault when preparing invalid query

I inadvertently mispelled the table name of my query. This caused the app to segfault with this stack trace:

Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x000055fdeeafb003 in cass::Atomic<int>::fetch_sub(int, cass::MemoryOrder)
    ()
[Current thread is 1 (Thread 0x7f25d5e0c800 (LWP 5278))]
warning: Missing auto-load script at offset 0 in section .debug_gdb_scripts
of file /home/david/dev/rust/caspreptest/target/debug/caspreptest.
Use `info auto-load python-scripts [REGEXP]' to list them.
b(gdb) bt
#0  0x000055fdeeafb003 in cass::Atomic<int>::fetch_sub(int, cass::MemoryOrder)
    ()
#1  0x000055fdeeb18f2a in cass::RefCounted<cass::Prepared>::dec_ref() const ()
#2  0x000055fdeeb17f54 in cass_prepared_free ()
#3  0x000055fdeeaf8d24 in cassandra::cassandra::prepared::PreparedStatement.Drop::drop (self=0x7ffc61936aa8)
    at /home/david/.cargo/registry/src/github.com-88ac128001ac3a9a/cassandra-0.6.3/src/cassandra/prepared.rs:24
#4  0x000055fdeeaf8cbd in cassandra..prepared..PreparedStatement::drop.14743::hfcbf84fa845250d5 () at ../src/libcore/fmt/mod.rs:1301
#5  0x000055fdeeaf8c69 in cassandra::cassandra::error::CassError::wrap<cassandra::cassandra::prepared::PreparedStatement> (self=..., wrappee=...)
    at /home/david/.cargo/registry/src/github.com-88ac128001ac3a9a/cassandra-0.6.3/src/cassandra/error.rs:138
#6  0x000055fdeeaf8b82 in cassandra::cassandra::future::PreparedFuture::error_code (self=0x7ffc61936bf8)
    at /home/david/.cargo/registry/src/github.com-88ac128001ac3a9a/cassandra-0.6.3/src/cassandra/future.rs:220
#7  0x000055fdeeaf8b0f in cassandra::cassandra::future::PreparedFuture::wait (
    self=0x7ffc61936bf8)
    at /home/david/.cargo/registry/src/github.com-88ac128001ac3a9a/cassandra-0.6.3/src/cassandra/future.rs:213
#8  0x000055fdeeae8c1c in caspreptest::main () at src/main.rs:14

Rather than crash, an error result should be returned. It appears by the stacktrace that the code attempts to do that but when the PreparedStatement's Drop method is called it leads to the segfault.

Test code to reproduce the issue. Anything wrong with the query will cause it to segfault in the call to wait().

extern crate cassandra;
use cassandra::Cluster;
use cassandra::ContactPoints;
use std::str::FromStr;

fn main() {
    let seeds = "127.0.0.1";
    let mut cluster = Cluster::new();
    let contact_points = ContactPoints::from_str(seeds).unwrap();
    cluster.set_contact_points(contact_points).unwrap();
    cluster.set_load_balance_round_robin();
    let session = cluster.connect().unwrap();
    static USERS_INSERT:&'static str = 
        "INSERT into example.non_exist_table (non_exist_field) values(?);";
    session.prepare(USERS_INSERT).unwrap().wait().unwrap(); // Crashes on wait()
}

This occurs with cassandra 0.6.3, cassandra-sys 0.4.1, DataStax cpp-driver 2.2.2, and Rustc 1.6.0.

Transfer ownership of crate to new maintainer

Hi,

I have forked this project to https://github.com/Metaswitch/cassandra-rs and intend to maintain it there. If you no longer intend to maintain this project, please could you contact me and/or Alex Crichton to arrange a transfer of the cassandra and cassandra-sys crates to myself? I would like to avoid forking on crates.io, so that we don't leave the stale crates in place to trip people up in future.

To anyone else who is interested - my maintained fork is available on crates.io at cassandra-cpp.

Thanks,

--KW 8-)

Use error-chain

Sooner rather than later this should switch over to using error-chain. Will be breaking.

Planning to maintain this?

Hi,

can you share your plans for progress on this driver? I am about to build more than a toy project on top of Rust/C* and am looking for the driver to use.

Jan

make api feel less C-like when connecting

This feels a lot more like idiomatic rust:

let mut cluster = CassCluster::new()
cluster.set_contact_points("127.0.0.1").unwrap();
let mut session = cluster.connect()

Thoughts?

Implement Sync/Send traits

Hey @tupshin thank you for this crate. I have successfully managed to compile c++ DataStax driver as well as bind it to this crate. At the moment I want to reuse r2d2 connection pool but for this Sync and Send traits must be implemented. Considering all of this is it worth doing it or maybe you have other suggestions ?

Leak in statement execution

When executing the test program below valgrind reports leaks per query. Benchmarking does indeed increase heap usage over time. The leak does not seem to be specific to prepared statements; I observed it without preparation as well.

Program:

extern crate iron;
extern crate cassandra;

use iron::prelude::*;
use iron::status;
use std::sync::Arc;

use cassandra::*;

struct CassEnv {
    pub session:CassSession,
    pub prepared:Vec<CassPrepared>
}

const CONTACT_POINTS:&'static str = "127.0.0.1";
const SELECT_QUERY:&'static str = r#"SELECT * FROM "local_group_default_T_parsoid_html".data 
    WHERE "_domain" = 'en.wikipedia.org' and key = ? limit 1"#;

fn select_from_basic(cass_env:&CassEnv, prepared:&CassPrepared, key:&str) -> Result<String,CassError> {
    let mut statement = prepared.bind();
    try!(statement.bind_string(0, key));
    let result = try!(cass_env.session.execute_statement(statement).wait());
    //println!("Result: \n{:?}\n",result.first_row());
    match result.first_row() {
        None => Err(CassError::build(0)),
        Some(row) => {
            Ok(try!(row.get_column_by_name("content-type").get_string()))
        }
    }
}

fn main() {
    let cluster = &CassCluster::new()
        .set_contact_points(CONTACT_POINTS).unwrap()
        .set_load_balance_round_robin().unwrap();

    let session = CassSession::new().connect(cluster).wait().unwrap();
    let prepared = session.prepare(SELECT_QUERY).unwrap().wait().unwrap();
    let cass_env = Arc::new(CassEnv{session:session,prepared:vec!()});

    Iron::new(move |_: &mut Request| {
        //let query_env = cass_env.clone();
        let output = select_from_basic(&cass_env, &prepared, "Foobar").unwrap();
        Ok(Response::with((status::Ok, output)))
    }).listen_with("localhost:3000", 11, iron::Protocol::Http).unwrap();

}

Valgrind report:

==22164== 59,840 bytes in 136 blocks are definitely lost in loss record 276 of 288
==22164==    at 0x4C29180: operator new(unsigned long) (vg_replace_malloc.c:324)
==22164==    by 0x4FBCCDF: cass::Session::execute(cass::RoutableRequest const*) (session.cpp:583)
==22164==    by 0x4FBA362: cass_session_execute (session.cpp:87)
==22164==    by 0x1F6038: cql_ffi::session::CassSession::execute_statement::h43bdc0ac83d609ccKDa (session.rs:57)
==22164==    by 0x122C18: select_from_basic::h7db28212951f3c3cBaa (main.rs:22)
==22164==    by 0x14C695: main::closure.4839 (main.rs:44)

session.cpp:583 is pointing to the ResponseFuture being leaked:

ResponseFuture* future = new ResponseFuture(cluster_meta_.schema());

crash when trying to prepare statements

Seeing this when preparing statements:

killranswers(7456,0x7fff72977300) malloc: *** mach_vm_map(size=140185866158080) failed (error code=3)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug

Cpp driver built off master branch.

Timestamps

@tupshin @rustyrazorblade

Currently it is almost impossible to work with Timestamp values how about implementing traits of chrono or time ? What do you think ?

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.