How to know if there is schema upgrade in ConfD start phase


I use external validation callback, and apply the validation in ConfD startup. So I need to wait application to register validation callback after --wait-phase0. But this wait is not needed if CDB exists and there is no schema upgrade when ConfD starts, because ConfD would not invoke validation callback in this case.

So I would like to know which API or other ways can be used to check whether there is schema upgrade in ConfD start phase. Thanks.


please, can you describe your use case in more details?

Why is it problem in your application to wait till ConfD is started in phase1?
If there is no upgrade (or initial data validation), then the start-up should be fast.
If there is upgrade, you need to wait anyway.

Maybe you can just use cdb_wait_start (from confd_lib_cdb) in your application.

Best regards,


Use for example cdb_get_phase():

$ confd -c ./confd.conf --start-phase0
$ confd_cmd -d -d -c get_phase
TRACE Connected (cdb) to ConfD
phase: 0 flags: 0x2 UPGRADE

Now you know that an upgrade will take place and that the upgrade transaction will modify the data in start-phase 1, so here you can for example save the old data if you wish.

See more in in ConfD 6.3 UG chapter 5.9–5.12.

However, it could be a good thing to register your validation callback in start-phase 0 since a transaction that you want to validate might occur as soon as you move to start-phase 2 since the northbound interfaces are now available.

Yes, but what’s the point with respect to the original question? Just always follow one of the tables in ConfD 6.3 UG “28.5. Starting ConfD”. You will always register in phase0 everything that may be needed for the upgrade, if there is one. If there is no upgrade, no harm done, and you have a clear and straightforward startup procedure that you always follow, instead of a complex one with conditions and alternatives, making testing harder and errors likely to exist.

In my case, ConfD and the applications that implement the validation callback are started together when the system boot up.

In the case that ConfD validates the configuration in start-phase, i.e. the cdb does not exist, or cdb exists but schema is upgraded, I need to let ConfD wait for a specific time to ensure application is started and register its validation callback to ConfD. The Confd startup sequence is as below.
confd --start-phase0 [applications may or may not be started at this time. The start of ConfD and application are controlled by one central process controller, which just starts these processes one by one]
confd --wait-phase0
start timer (5s) [This step aims to give applications the time to start and to register to confd before confd start-phase1 ]
confd --start-phase1

While as ConfD does not validate the configuration in the case that CDB exists and there is no schema upgrade, I need not to let ConfD wait the specific time so that I can speed the confd startup. The ConfD startup sequence is as below.
confd --start-phase0
confd --wait-phase0
confd --start-phase1

Therefore, I want to know if confd is in a schema upgrade phase, and to decide whether need to wait for a specific time or not.

I think the answer from cohult can solve it. Thanks.