diff --git a/modules/pua/doc/pua_admin.xml b/modules/pua/doc/pua_admin.xml index e7b242d..0d7ccba 100644 --- a/modules/pua/doc/pua_admin.xml +++ b/modules/pua/doc/pua_admin.xml @@ -287,6 +287,28 @@ modparam("pua", "db_mode", 0)
+ <varname>db_table_lock_type</varname> (integer) + + Enable (=1) or disable (=0) the Locks for table during an transaction. + Locking only the "current" table causes problems with a MySQL-Databases + in "DB-Only" mode. + + + + Default value is 1 (Write Lock for the Tables). + + + + Set <varname>db_table_lock_type</varname> parameter + +... +modparam("pua", "db_table_lock_type", 0) +... + + +
+ +
<varname>check_remote_contact</varname> (int) When sending a SUBSCRIBE check that the remote contact matches the diff --git a/modules/pua/pua.c b/modules/pua/pua.c index e44a38d..8122b24 100644 --- a/modules/pua/pua.c +++ b/modules/pua/pua.c @@ -73,6 +73,9 @@ int reginfo_increase_version = 0; pua_event_t* pua_evlist= NULL; int dbmode = 0; +int db_table_lock_type = 1; +db_locking_t db_table_lock = DB_LOCKING_WRITE; + int pua_fetch_rows = 500; /* database connection */ @@ -134,6 +137,7 @@ static param_export_t params[]={ {"check_remote_contact", INT_PARAM, &check_remote_contact}, {"db_mode", INT_PARAM, &dbmode}, {"fetch_rows", INT_PARAM, &pua_fetch_rows}, + { "db_table_lock_type", INT_PARAM, &db_table_lock_type}, {0, 0, 0} }; @@ -280,10 +284,13 @@ static int mod_init(void) register_timer(db_update, 0, update_period); } + if (db_table_lock_type != 1) + db_table_lock = DB_LOCKING_NONE; + if(pua_db) pua_dbf.close(pua_db); pua_db = NULL; - + return 0; } diff --git a/modules/pua/send_publish.c b/modules/pua/send_publish.c index c04163e..8cd553b 100644 --- a/modules/pua/send_publish.c +++ b/modules/pua/send_publish.c @@ -49,6 +49,8 @@ #include "event_list.h" #include "pua_db.h" +extern db_locking_t db_table_lock; + str* publ_build_hdr(int expires, pua_event_t* ev, str* content_type, str* etag, str* extra_headers, int is_body) { @@ -216,7 +218,7 @@ void publ_cback_func(struct cell *t, int type, struct tmcb_params *ps) if (dbmode == PUA_DB_ONLY && pua_dbf.start_transaction) { - if (pua_dbf.start_transaction(pua_db, DB_LOCKING_WRITE) < 0) + if (pua_dbf.start_transaction(pua_db, db_table_lock) < 0) { LM_ERR("in start_transaction\n"); goto error; @@ -502,7 +504,7 @@ int send_publish( publ_info_t* publ ) if (dbmode == PUA_DB_ONLY && pua_dbf.start_transaction) { - if (pua_dbf.start_transaction(pua_db, DB_LOCKING_WRITE) < 0) + if (pua_dbf.start_transaction(pua_db, db_table_lock) < 0) { LM_ERR("in start_transaction\n"); goto error; diff --git a/modules/pua/send_subscribe.c b/modules/pua/send_subscribe.c index 17a4f3f..67aa9d2 100644 --- a/modules/pua/send_subscribe.c +++ b/modules/pua/send_subscribe.c @@ -48,6 +48,7 @@ #include "pua_db.h" #include "../presence/subscribe.h" +extern db_locking_t db_table_lock; void print_subs(subs_info_t* subs) { @@ -301,7 +302,7 @@ void subs_cback_func(struct cell *t, int cb_type, struct tmcb_params *ps) if (dbmode == PUA_DB_ONLY && pua_dbf.start_transaction) { - if (pua_dbf.start_transaction(pua_db, DB_LOCKING_WRITE) < 0) + if (pua_dbf.start_transaction(pua_db, db_table_lock) < 0) { LM_ERR("in start_transaction\n"); goto error; @@ -687,7 +688,7 @@ faked_error: if (pua_dbf.start_transaction) { - if (pua_dbf.start_transaction(pua_db, DB_LOCKING_WRITE) < 0) + if (pua_dbf.start_transaction(pua_db, db_table_lock) < 0) { LM_ERR("in start_transaction\n"); goto error; @@ -986,7 +987,7 @@ int send_subscribe(subs_info_t* subs) if (dbmode == PUA_DB_ONLY && pua_dbf.start_transaction) { - if (pua_dbf.start_transaction(pua_db, DB_LOCKING_WRITE) < 0) + if (pua_dbf.start_transaction(pua_db, db_table_lock) < 0) { LM_ERR("in start_transaction\n"); goto error;