warning from CPP Driver while inserting row - Unable to find key column 'key' in prepared query

183 views
Skip to first unread message

Prerana Khare

unread,
Sep 22, 2015, 4:45:12 AM9/22/15
to DataStax C++ Driver for Apache Cassandra User Mailing List
I have been using Cassandra DB for a while starting from version 2.1.8 to 2.2.1.
I have started getting a warning from CPP driver while using Cassandra 2.2.1

WARN:src/prepared.cpp:54:cass\3a\3aPrepared\3a\3aPrepared(const cass\3a\3aResultResponse*, const std\3a\3astring&, const std\3a\3avector<std\3a\3abasic_string<char, std\3a\3achar_traits<char>, std\3a\3aallocator<char> >, std\3a\3aallocator<std\3a\3abasic_string<char, std\3a\3achar_traits<char>, std\3a\3aallocator<char> > > >&):Unable to find key column 'key' in prepared query

I was not getting this error when using Cassandra version 2.1.8.
Is this any issue with the way we use prepare query?

I need to understand more about this warning so that if required we can eliminate this issue.

More Details:
---------------

Table Definition:
CREATE TABLE if not exists keyspace1.tbl1 (
id bigint,
attrid text,
attrvalue blob,
PRIMARY KEY(id, attrid)
) WITH compaction = { 'class' : 'LeveledCompactionStrategy' };


The warning comes when we use following query string and send it to prepare -

INSERT INTO tbl1 ("id", "attrid", "attrvalue") VALUES (?, ?, ?) USING TIMESTAMP ?


We are getting this error after calling cass_future_get_prepared function

Appreciate help here.

Thanks,
Prerana

Michael Penick

unread,
Sep 24, 2015, 5:54:14 PM9/24/15
to cpp-dri...@lists.datastax.com
Thanks for reporting. I'll need to investigate this a bit more.

Mike

To unsubscribe from this group and stop receiving emails from it, send an email to cpp-driver-us...@lists.datastax.com.

Prerana Khare

unread,
Sep 28, 2015, 4:06:01 AM9/28/15
to DataStax C++ Driver for Apache Cassandra User Mailing List
Thanks Mike. Let me know if you need more information.

Etienne

unread,
Sep 29, 2015, 4:51:48 AM9/29/15
to DataStax C++ Driver for Apache Cassandra User Mailing List
On Thursday, September 24, 2015 at 11:54:14 PM UTC+2, Michael Penick wrote:
> Thanks for reporting. I'll need to investigate this a bit more.
>
>
> Mike
>

I have the same issue; it seems the error comes from the method that tries to get the indices of the key columns. This method relies on a "key_aliases" field in the schema metadata, that does not exist (was it removed with C* 2.2?)

Looking at the sources of the java driver, it should instead rely on the "partition_key" type of the columns metadata. Something like:
for (auto it: columns_) {
if (it.second.get_field("type")->value()->to_string() == "partition_key")
output->push_back(it.first);
}

Etienne

Michael Penick

unread,
Sep 29, 2015, 12:26:08 PM9/29/15
to cpp-dri...@lists.datastax.com
You're right. "key_alisaes" is gone in C* 2.2 and that causes it to incorrectly use the C* 1.2 thrift fallback: https://github.com/datastax/cpp-driver/blob/master/src/schema_metadata.cpp#L533-L545. That's the reason for 'key' in the warning: "Unable to find key column 'key' in prepared query". Going forward the driver should use the primary key metadata provided in the prepared response (https://datastax-oss.atlassian.net/browse/CPP-306) which will be available in the final version of 2.2 release of the driver which should be out in the next few weeks.

Mike



Prerana Khare

unread,
Sep 29, 2015, 2:11:15 PM9/29/15
to DataStax C++ Driver for Apache Cassandra User Mailing List
Hi Mike,

Thanks a lot for the response.
We will wait for the next version.
However it would be great if you can let me know if there is any impact of this issue?

Michael Penick

unread,
Sep 30, 2015, 12:03:43 PM9/30/15
to cpp-dri...@lists.datastax.com
This disables token-aware routing for requests, but wouldn't have any other impact. Token-aware routing allows the driver to routes requests directly to one of the replicas instead of relying on a server-side coordinator node to route the request to a replica. This could potentially increase the latency of requests.

Mike

Prerana Khare

unread,
Oct 7, 2015, 12:59:21 AM10/7/15
to DataStax C++ Driver for Apache Cassandra User Mailing List
Hi Mike,

Ok. Then we will be waiting for this issue fix in next version.

:)
Reply all
Reply to author
Forward
0 new messages