ConfD User Community

Creating threads when configuring cdb



In config mode (update), I am running a linux command which takes a long time to execute so I put it in a thread. But unfortunately that is also holding up the commit.

I have seen threads behave efficiently in action and operational, but i need help with config mode.

How can i start a thread without it holding up the commit and so that the thread is running in the background




You are holding up the commit transaction as subscribers need to reply with cdb_sync_subscription_socket(). Configuration changes are done through ACID transactions.

From the ConfD UG Chapter “CDB subscriptions”:

As the last part of the transaction CDB will generate notifications in lock-step priority order. First all subscribers at the lowest numbered priority are handled, once they all have replied and synchronized by calling cdb_sync_subscription_socket() the next set - at the next priority level - is handled by CDB. Not until all subscription points have been acknowledged is the transaction complete. This implies that if the initiator of the transaction was for example a commit command in the CLI, the command will hang until notifications have been acknowledged.



Thanks, but I thought that is the purpose of thread so that the thread can run in the background and cdb changes are already made by then so the subscriber can acknowledge that the transaction is complete. Or does it wait for the thread to complete for transaction to be considered complete?


The transaction is not complete until all subscription points have been acknowledged (e.g. by calling cdb_sync_subscription_socket())