[sr-dev] db_cassandra module: problems and fixes

Carlos Ruiz Díaz carlos.ruizdiaz at gmail.com
Thu Jan 9 18:28:39 CET 2014


Hi,

I've found some problems trying to use db_cassandra module for tables that
are not related to Kamailio and that are queried from the sqlops module.
Below there's a list where I describe them with some level of detail:

1. Querying from sqlops was impossible because of a parameter check that
reads the table name from the connection structure. This table name is
never set when using raw SQL (or CQL).
2. All data was being treated as string, not matter what their actual type
was. The table information for database schema was being ignored for raw
queries.
3. If you define your table structure beforehand, using CQL DDL for
example, all numeric types are inaccessible from inside the module because
of the problem described in the item above.

I fixed the problems of points #1 and #2. Sqlops module is now fully usable
with Cassandra and the table definition is being taken into account even
for raw queries. Some basic checks are also performed with field
definitions. The problem #3 remains; I was not able to fix it because I
don't have enough experience with Thrift. Hopefully, this will change soon
enough.

To avoid running into problems with point #3, one can simply create the
column family without specifying member types, and creating an index for
your primary key field (this will allow you to query using "where clause"
with that field as a condition). Later, define the table structure in plain
text with the correct database types and pass that information to cassandra
module (schema_path param), and the module should treat every value with
the correct type inside Kamailio memory space.

I've attached the patch of the fix. Hopefully, the original authors of the
module (who are copied on this email) will review it and authorize me to
push it to master.

Regards,
-- 
Carlos
http://caruizdiaz.com
+595981146623
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-dev/attachments/20140109/6296633c/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dbcassa_base.cpp.patch
Type: text/x-patch
Size: 8479 bytes
Desc: not available
URL: <http://lists.sip-router.org/pipermail/sr-dev/attachments/20140109/6296633c/attachment-0001.bin>


More information about the sr-dev mailing list