I asked on the mailing list about a problem I was having with B2B logic MYSQL duplicate entry errors. In my logs I am seeing
Sep 9 09:57:27 /usr/local/sbin/opensips: CRITICAL:db_mysql:wrapper_single_mysql_real_query: driver error (1062): Duplicate entry '475.0' for key 2
Sep 9 09:57:27 /usr/local/sbin/opensips: ERROR:core:db_do_insert: error while submitting query
Sep 9 09:57:27 /usr/local/sbin/opensips: ERROR:b2b_logic:b2b_logic_dump: Sql insert failed
but the DB hasn't been restarted or crashed. The reply to my mailing list message was
"There is an issue with the b2b_logic module.
If a b2b_logic context is saved in the db and the b2b_entities corresponding to the b2b_logic contexts are lost, the db is not properly cleaned up.
When a new call comes in, a b2b_logic context is created and it may have the same key as the saved old b2b_logic context in the db.
When a db operation is performed on that call (like inserting a new b2b_logic context with the same id as the one in the db) the operation fails and you see those errors."