[OpenSIPS-Devel] [ opensips-Patches-3611397 ] CACHEDB_COUCHBASE - Error reporting and reconnects

SourceForge.net noreply at sourceforge.net
Fri Apr 19 21:31:15 CEST 2013


Patches item #3611397, was opened at 2013-04-19 12:31
Message generated for change (Tracker Item Submitted) made by rrb3942
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=1086412&aid=3611397&group_id=232389

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: modules
Group: trunk
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Ryan Bullock (rrb3942)
Assigned to: Nobody/Anonymous (nobody)
Summary: CACHEDB_COUCHBASE - Error reporting and reconnects

Initial Comment:
This patch updates the CACHEDB_COUCHBASE module. It  adds better error reporting and handling as well as automatic reconnects for certain error codes.

Errors:
Removed calls to lcb_get_last_error. Since we have callbacks set this is unnecessary and we can go off the last_error variable.
Moved error log messages to the callback only, to reduce noise in the logs. (Perhaps debug messages would be appropriate in the get, set, remove, and arithmetic methods?)

Return codes:
For both the get and remove methods I have made changes so that Non-existent keys return -1 and all other failures return -2. Since couchbase can be used as a primary data-store it is
very important to distinguish between no data and other failures at the script level, as the data may not be available elsewhere. This involved a change to the cachedb_fetch(), cachedb_counter_fetch(), and cachedb_remove() methods in cachedb.c to pass through the return code of the underlying drivers method. Compatibility with the other cachedb_* modules should be verified.

Reconnects:
The libcouchbase library does a pretty good job of handling reconnects itself, there are however a few scenarios where it will get into a state where it will not reconnect. When one of these errors are detected we created a new handle and destroy the old one. This list of errors may need review. 

Because of this we also support starting opensips without successfully connecting to couchbase, and are able to connect to it later once the service becomes available. We will still fail to start on certain connection errors that are deemed fatal. Again this list of errors may need review.

Documentation:

I updated the documentation to include an example of multiple hosts in the connection string. I have tested the following works:
modparam("cachedb_couchbase", "cachedb_url","couchbase:test://192.168.122.192;192.168.122.77/somebucket")

If 192.168.122.192 is not available it will still connect to the cluster via 192.168.122.77.

I wrote this patch against 1.9, but I think it should apply against trunk just fine. It would be nice if this could be applied to 1.9 as well, however the changes for return codes may pose an issue there.

Happy to answer any questions!

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=1086412&aid=3611397&group_id=232389



More information about the Devel mailing list