cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jonathan Ellis <jbel...@gmail.com>
Subject Re: odd problem retrieving binary values using C++
Date Tue, 06 Apr 2010 19:05:56 GMT
Glad it's working now! :)

On Tue, Apr 6, 2010 at 12:14 PM, Chris Beaumont <drchris32@yahoo.com> wrote:
> mmmh...  well... wasn't long before I figured out the problem sits between
> the chair and the keyboard!!!
>
> I had a bad case of copy/paste dealing with super-columns and multiple
> rows in the actual code (original post was wayyyyyyy stripped).
>
> Everything is fine and returning the proper buffer size (as long as I refer to
> the right variable that was !)
>
> Apologies for the long and silly original post...
>
> Chris.
>
>
>
> ----- Original Message ----
> From: Chris Beaumont <drchris32@yahoo.com>
> To: user@cassandra.apache.org
> Sent: Tue, April 6, 2010 9:36:16 AM
> Subject: odd problem retrieving binary values using C++
>
> Hi all...
>
> I am having a pretty tough time retrieving binary values out of my DB...
> I am using cassandra 0.5.1 on Centos 5.4 with java 1.6.0-19
>
> Here is the simple test I am trying to run in C++
>
> /* snip initialization */
> {
>    transport->open();
>
>    ColumnPath new_col;
>    new_col.__isset.column = true; /* this is required! */
>    new_col.column_family.assign("Standard2");
>    new_col.super_column.assign("");
>    new_col.column.assign("testing");
>
>    char *data_cstr="this\0 is\0 data!";
>    std::string data;
>    data.assign(data_cstr, 15);
>
>    printf("Data '%s' has length %lu\n", data.c_str(), data.length());
>    // This properly returns 15
>
>    client.insert("Keyspace1","newone",new_col,data,55,ONE);
>
>    ColumnOrSuperColumn ret_val;
>
>    client.get(ret_val,"Keyspace1","newone",new_col,ONE);
>
>    printf("Column name retrieved is: %s\n", ret_val.column.name.c_str());
>    printf("Value in column retrieved is: %s\n", ret_val.column.value.c_str());
>    // This only ever returns  'this'  (i.e., everything before the first \0)
>    // I understand null termination in %s... see below
>    printf("Value has length %lu\n", ret_val.column.value.length());
>    // and this gives me 4
>
>    transport->close();
>  }
> /* snip the rest too! */
>
> Am I missing something major in proceeding this way?
>
> I have tried GDB and eventually all I get back is a string containing 'this'.
> Here is the dumped content of Keyspace1/Standard2-1-Data.db...
> od -c /u01/cassandra/data/Keyspace1/Standard2-1-Data.db
>
> 0000000  \0   -   1   1   5   5   7   1   6   5   7   6   3   3   4  
2
> 0000020   7   0   7   9   0   1   4   5   2   8   3   5   8   0   2  
3
> 0000040   7   5   1   9   9   5   2   8   :   n   e   w   o   n   e  \0
> 0000060  \0  \0 264  \0  \0  \0   U  \0  \0  \0 003 254 355  \0 005   s
> 0000100   r  \0 020   j   a   v   a   .   u   t   i   l   .   B   i  
t
> 0000120   S   e   t   n 375 210   ~   9   4 253   ! 003  \0 001   [  \0
> 0000140 004   b   i   t   s   t  \0 002   [   J   x   p   u   r  \0 002
> 0000160   [   J   x     004 265 022 261   u 223 002  \0  \0   x   p  \0
> 0000200  \0  \0 001  \0 202  \b  \0  \0  \0  \0  \0   x  \0  \0  \0   "
> 0000220  \0  \a   t   e   s   t   i   n   g  \0  \a   t   e   s   t  
i
> 0000240   n   g  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0
> 0000260  \0   % 200  \0  \0  \0 200  \0  \0  \0  \0  \0  \0  \0  \0  \0
> 0000300  \0 001  \0  \a   t   e   s   t   i   n   g  \0  \0  \0  \0  \0
> 0000320  \0  \0  \0   7  \0  \0  \0 017   t   h   i   s  \0       i  
s
> 0000340  \0       d   a   t   a   !
> 0000347
>
> This shows that the data is stored properly to the db file.
>
> # bin/cassandra-cli -host localhost
> Connected to localhost/9160
> Welcome to cassandra CLI.
> cassandra> get Keyspace1.Standard2['newone']
> => (column=testing, value=this is data!, timestamp=55)
> Returned 1 results.
>
> Shows the same thing! It's there !!!
>
> I would lean towards a Thrift interface problem...
>
> In any case... I'd be thankful if someone had a pointer/workaround to this show-stopper
> of mine...
>
> Best
>
> Chris.
>
>
>
>
>

Mime
View raw message