<div dir="ltr">Hi devs,<div><br></div><div>I'm trying to make the db_cassandra work for my kamailio specifically userblacklist module.</div><div><br></div><div>I've cassanda keyspace and tables defined along with the db_schema directory structure defined as instructed however the debug logs keep telling me that table 'version' doesn't exist.</div><div><br></div><div>I've taken a look inside the dbcassa_table.c file </div><div><a href="https://github.com/kamailio/kamailio/blob/master/modules/db_cassandra/dbcassa_table.c#L441">https://github.com/kamailio/kamailio/blob/master/modules/db_cassandra/dbcassa_table.c#L441</a></div><div><br></div><div>Somewhere in this function it just doesn't get hold of "tbc" and hence it throws up error.</div><div><br></div><div>Here is how I've figured out this code.</div><div><br></div><div><br><div><div><font face="monospace, monospace">        hash = core_hash(dbn, tbn, DBCASSA_TABLE_SIZE);</font></div><div><font face="monospace, monospace">        <span style="background-color:rgb(255,229,153)">if(!hash)</span></font></div><div><font face="monospace, monospace" style="background-color:rgb(255,229,153)">                LM_ERR("hash  NOT FOUND\n");</font></div><div><font face="monospace, monospace">        hashidx = hash % DBCASSA_TABLE_SIZE;</font></div><div><font face="monospace, monospace">     <span style="background-color:rgb(255,229,153)">   if(!hashidx)</span></font></div><div><font face="monospace, monospace" style="background-color:rgb(255,229,153)">                LM_ERR("hashidx NOT FOUND\n");</font></div><div><font face="monospace, monospace">        ref_read_data(dbcassa_tbl_htable[hashidx].lock);</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">        tbc = dbcassa_tbl_htable[hashidx].dtp;</font></div><div><font face="monospace, monospace">   <span style="background-color:rgb(255,229,153)">     if(!tbc)</span></font></div><div><font face="monospace, monospace" style="background-color:rgb(255,229,153)">                LM_ERR("TBC NOT FOUND\n");</font></div><div><font face="monospace, monospace">        while(tbc) {</font></div><div><font face="monospace, monospace">                LM_DBG("found dbname=%.*s, table=%.*s\n", tbc->dbname.len, tbc->dbname.s, tbc->name.len, tbc->name.s);</font></div><div><font face="monospace, monospace">                if(tbc->hash==hash && tbc->dbname.len == dbn->len</font></div><div><font face="monospace, monospace">                                && tbc->name.len == tbn->len</font></div><div><font face="monospace, monospace">                                && !strncasecmp(tbc->dbname.s, dbn->s, dbn->len)</font></div><div><font face="monospace, monospace">                                && !strncasecmp(tbc->name.s, tbn->s, tbn->len)) {</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">                        memcpy(full_path_buf + dbcassa_schema_path.len, dbn->s, dbn->len);</font></div><div><font face="monospace, monospace">                        len = dbcassa_schema_path.len + dbn->len;</font></div><div><font face="monospace, monospace">                        full_path_buf[len++] = '/';</font></div><div><font face="monospace, monospace">                        memcpy(full_path_buf + len, tbn->s, tbn->len);</font></div><div><font face="monospace, monospace">                        full_path_buf[len + tbn->len] = '\0';</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">                        if(dbcassa_check_mtime(&tbc->mt) == 0)</font></div><div><font face="monospace, monospace">                                return tbc;</font></div><div><font face="monospace, monospace">                        old_tbc = tbc;</font></div><div><font face="monospace, monospace">                        break;</font></div><div><font face="monospace, monospace">                }</font></div><div><font face="monospace, monospace">                tbc = tbc->next;</font></div><div><font face="monospace, monospace">        }</font></div><div><font face="monospace, monospace">        unref_read_data(dbcassa_tbl_htable[hashidx].lock);</font></div><div><font face="monospace, monospace">        if(!old_tbc) {</font></div><div><font face="monospace, monospace" style="background-color:rgb(255,229,153)">                LM_ERR("OLD_TBC NOT FOUND\n");</font></div><div><font face="monospace, monospace">                return NULL;</font></div><div><font face="monospace, monospace">        }</font></div></div></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">and upon starting of kamailio after recompiling the module I see these lines printed.</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace"><div> 0(15574) DEBUG: db_cassandra [dbcassa_base.cpp:149]: db_cassa_new_connection(): opening connection: cassa://<a href="http://xxxx:xxxx@127.0.0.1:9160/kamailio">xxxx:xxxx@127.0.0.1:9160/kamailio</a></div><div> 0(15574) DEBUG: <core> [mem/f_malloc.c:439]: fm_malloc(): fm_malloc(0x7f9c14f8a010, 48) called from db_cassandra: dbcassa_base.cpp: db_cassa_new_connection(155)</div><div> 0(15574) DEBUG: <core> [mem/f_malloc.c:514]: fm_malloc(): fm_malloc(0x7f9c14f8a010, 48) returns address 0x7f9c150055f0</div><div> 0(15574) DEBUG: db_cassandra [dbcassa_base.cpp:161]: db_cassa_new_connection(): 0x7f9c150055f0=pkg_malloc(48)</div><div> 0(15574) DEBUG: db_cassandra [dbcassa_base.cpp:117]: dbcassa_open(): Opened connection to Cassandra cluster  <a href="http://127.0.0.1:9160">127.0.0.1:9160</a></div><div> 0(15574) DEBUG: db_cassandra [dbcassa_base.cpp:955]: db_cassa_query(): query table=version</div><div><span style="background-color:rgb(255,229,153)"> 0(15574) ERROR: db_cassandra [dbcassa_table.c:463]: dbcassa_db_get_table(): TBC NOT FOUND</span></div><div><span style="background-color:rgb(255,229,153)"> 0(15574) ERROR: db_cassandra [dbcassa_table.c:486]: dbcassa_db_get_table(): OLD_TBC NOT FOUND</span></div><div> 0(15574) ERROR: db_cassandra [dbcassa_base.cpp:449]: cassa_translate_query(): table version does not exist!</div><div> 0(15574) ERROR: db_cassandra [dbcassa_base.cpp:962]: db_cassa_query(): Failed to query Cassandra cluster</div><div> 0(15574) ERROR: <core> [db.c:397]: db_table_version(): error in db_query</div><div> 0(15574) ERROR: <core> [db.c:436]: db_check_table_version(): querying version for table userblacklist</div><div> 0(15574) ERROR: userblacklist [db_userblacklist.c:86]: userblacklist_db_init(): during table version check.</div><div> 0(15574) DEBUG: <core> [db_pool.c:100]: pool_remove(): removing connection from the pool</div><div> 0(15574) DEBUG: <core> [mem/f_malloc.c:575]: fm_free(): fm_free(0x7f9c14f8a010, 0x7f9c150055f0), called from db_cassandra: dbcassa_base.cpp: db_cassa_free_connection(203)</div><div> 0(15574) DEBUG: <core> [mem/f_malloc.c:594]: fm_free(): fm_free: freeing block alloc'ed from db_cassandra: dbcassa_base.cpp: db_cassa_new_connection(155)</div><div> 0(15574) DEBUG: <core> [mem/f_malloc.c:575]: fm_free(): fm_free(0x7f9c14f8a010, 0x7f9c15005318), called from core: db.c: db_do_close(356)</div><div> 0(15574) DEBUG: <core> [mem/f_malloc.c:594]: fm_free(): fm_free: freeing block alloc'ed from core: db.c: db_do_init2(298)</div><div> 0(15574) ERROR: <core> [sr_module.c:968]: init_mod(): Error while initializing module userblacklist (/usr/local/lib64/kamailio/modules/userblacklist.so)</div><div>ERROR: error while initializing modules</div><div><br></div></font></div><div><br></div><div><br></div><div>Kindly look into this and let me know how to make this work.</div><div><br></div><div><br></div><div>Thanks,</div><div>Sammy </div><div><br></div></div>