### Description
I have 2 mtrees defined that get loaded on startup. I have not specified the 
`db_table` value but have changed each of the values for `tname_column`, 
`tprefix_column`, and `tvalue_column`.

 `kamcmd mtree.summary` and `kamcmd mtree.list` show that the data was 
successfully loaded. I expected that running `kamcmd mtree.reload` would reload 
these mtrees from the database. Running this or sending the same command as an 
http xmlrpc request yields "error: 500 - Mtree Reload Failed". The same error 
is received if I try to reload a specific mtree. Prior to this version we were 
successfully reloading these mtrees with MI commands.

### Troubleshooting

#### Reproduction
Use the following mtree paramters with a database table that has the name, 
prefix, and value fields.

```
modparam("mtree", "tname_column", "name")
modparam("mtree", "tprefix_column", "prefix")
modparam("mtree", "tvalue_column", "value")
modparam("mtree", "mtree", "name=some_mtree;dbtable=some_table;type=0;multi=0")
```

Verify the mtrees were successfully created and attempt to reload with the 
mtree.reload RPC command.

We are not using an mtrees table and this throws an error that the table does 
not exist (see logs below). Try creating the mtrees table according to the 
script located at utils/kamctl/mysql/mtree-create.sql and insert the tname, 
tprefix, and tvalue values used above. The same error is thrown with a 
different log entry.


#### Log Messages

<!--
Check the syslog file and if there are relevant log messages printed by 
Kamailio, add them next, or attach to issue, or provide a link to download them 
(e.g., to a pastebin site).
-->

Without mtrees table:
```
Apr  4 21:45:51 localhost /usr/local/sbin/kamailio[26416]: ERROR: db_mysql 
[km_dbase.c:128]: db_mysql_submit_query(): driver error on query: Table 
'db_name.mtrees' doesn't exist (1146)
Apr  4 21:45:51 localhost /usr/local/sbin/kamailio[26416]: ERROR: <core> 
[db_query.c:132]: db_do_query_internal(): error while submitting query
Apr  4 21:45:51 localhost /usr/local/sbin/kamailio[26416]: ERROR: mtree 
[mtree_mod.c:724]: mt_load_db_trees(): Error while querying db
Apr  4 21:45:51 localhost /usr/local/sbin/kamailio[26416]: ERROR: mtree 
[mtree_mod.c:928]: rpc_mtree_reload(): cannot re-load mtrees from database
```

With mtrees table:
```
Apr  4 21:41:47 localhost /usr/local/sbin/kamailio[26416]: ERROR: db_mysql 
[km_dbase.c:128]: db_mysql_submit_query(): driver error on query: Unknown 
column 'name' in 'field list' (1054)
Apr  4 21:41:47 localhost /usr/local/sbin/kamailio[26416]: ERROR: <core> 
[db_query.c:132]: db_do_query_internal(): error while submitting query
Apr  4 21:41:47 localhost /usr/local/sbin/kamailio[26416]: ERROR: mtree 
[mtree_mod.c:724]: mt_load_db_trees(): Error while querying db
Apr  4 21:41:47 localhost /usr/local/sbin/kamailio[26416]: ERROR: mtree 
[mtree_mod.c:928]: rpc_mtree_reload(): cannot re-load mtrees from database
```


### Additional Information

According to the documentation found here: 
http://kamailio.org/docs/modules/5.0.x/modules/mtree.html the db_table param 
should be ignored if a mtree paramter is defined so I would not expect to need 
the mtrees table. The data is successfully loaded at startup so I believe the 
issue is just with the reload command. Our kamailio config and database schema 
has not changed and we were able to reload mtrees successfully with MI commands 
in previous releases. 


  * **Kamailio Version** - output of `kamailio -v`

```
version: kamailio 5.0.0 (x86_64/linux) 
flags: STATS: Off, USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, DISABLE_NAGLE, 
USE_MCAST, DNS_IP_HACK, SHM_MEM, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, 
TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, 
USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST, HAVE_RESOLV_RES
ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16, 
MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
id: unknown 
compiled on 14:35:44 Apr  4 2017 with gcc 4.8.5
```

* **Operating System**:

```
Linux proxy.vagrant.vm 3.10.0-514.6.2.el7.x86_64 #1 SMP Thu Feb 23 03:04:39 UTC 
2017 x86_64 x86_64 x86_64 GNU/Linux
CentOS Linux release 7.3.1611 (Core)
```


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/1057
_______________________________________________
sr-dev mailing list
sr-dev@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to