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
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().