How to use confd_cmd -c "maapi_unlock"

Some errant code has placed a lock placed in my CDB that I would like to remove. I may need to do this occasionally for debugging purposes, so this is not a one-time event. I’d like to know how to remove a lock in the CDB. Restarting ConfD does not seem to help.

The confd_cmd tool has a “maapi_unlock” command. According to confd_cmd -h commands, this maapi_unlock command does not take any extra arguments.

How is this command used? When I try it, it gives the error:

CMD_MAAPI is true [mtid = 0]
FAILED: maapi_unlock(ms, mdb), Error: external error (19): , in function do_maapi_unlock, line 1508

I am using ConfD 6.0.3 on CentOS 6.5.

Thank you.


I couldn’t find information on this either but if you look at the maapi_unlock API, part of the MAAPI library, it needs some arguments: A MAAPI socket and a dyname to unlock.

I recommend opening a ticket with support for this as the confd_cmd -h maapi_unlock doesn’t return any information regarding arguments.


Thank you, I will do so.


You have the source code for confd_cmd at $CONFD_DIR/src/confd/tools/confd_cmd.c

So opening up a ticket for not enough info in the help text seems like a lot of overhead.

Now in confd_cmd.c on line 1508
maapi_unlock(ms, mdb)
is called. ms is the maapi socket, mdb is the datastore.

From the confd_lib_maapi man page on the maapi_lock/unlock() error codes:

If confd_errno is CONFD_ERR_EXTERNAL it means that a callback has been invoked in an external database to lock/unlock which in its turn returned an error. (See confd_lib_dp(3) for external database callback API)

Now let’s take a look at the lock / unlock() callbacks in the confd_lib_dp man page:

This should only be implemented if our database supports locking from other sources than through ConfD. In this case both the lock/unlock and lock_partial/unlock_partial callbacks must be implemented. If a lock on the whole database is set through e.g. NETCONF, ConfD will first make sure that no other ConfD transaction has locked the database. Then it will call lock() to make sure that the database is not locked by some other source (such as a non-ConfD CLI). Returns CONFD_OK on success, and CONFD_ERR if the lock was already held by an external entity.

Unlocks the database.

So check your external database, i.e. your “data feeder application” that registered and implement the lock() and unlock() callbacks, as it returns an error (CONFD_ERR) when you try to unlock().