### Description
The dbmode behavior was modified (see the commit reference bellow) and does not clearly align with the documentation anymore, I still need the feature when we can persist htable records that were inserted at runtime.
In fact I do not understand that value of writing back only records that where loaded from the DB, this seems equivalent to dbmode 0 (if the db is not altered) ?
Maybe you can help me understand why we the change is needed @miconda ?
``` dbmode - if set to 1, the content of hash table is written to database table when the SIP server is stopped (i.e., ensure persistency over restarts). Default value is 0 (no write back to db table). ```
``` commit b1fa63b1547fc5af6cc1e97db42ea76db1bf927b Author: Daniel-Constantin Mierla miconda@gmail.com Date: Wed Apr 13 13:11:30 2022 +0200
htable: track when records were successfully loaded from database
- write back only in such case
diff --git a/src/modules/htable/ht_api.c b/src/modules/htable/ht_api.c index 00023e7153..f212600e21 100644 --- a/src/modules/htable/ht_api.c +++ b/src/modules/htable/ht_api.c @@ -1099,7 +1099,7 @@ int ht_db_sync_tables(void) ht = _ht_root; while(ht) { - if(ht->dbtable.len>0 && ht->dbmode!=0 && ht->ncols==0) + if(ht->dbtable.len>0 && ht->dbmode!=0 && ht->dbload!=0 && ht->ncols==0) { LM_DBG("sync db table [%.*s] from ht [%.*s]\n", ht->dbtable.len, ht->dbtable.s, ```
@jchavanton: I tracked back and seems related to:
- https://github.com/kamailio/kamailio/issues/3082
However, your observations seem to be valid, so needs another fix for dbmode 1.
Cheers Daniel ! Thanks, I get the intent.
Hopefully the commit ba9d663c5d the case of not writing back to db at shut down when there were no records in db at start up. If not, reopen.
Closed #3422 as completed.
Reopened #3422.
Just tested with `5.7.1` and it does not seems to work, I will try reverting the commit who broke it to be sure.
https://github.com/jchavanton/kamailio/commit/db041f386fdf8b1a3c2d47911c09f4...
my config was incomplete, I can confirm that on 5.7.1 the htable db persistency is working
Thanks for fixing it !
Closed #3422 as completed.