Trying to confirm my understanding about init xml files and phased startup

There is a subtlety in the initialization sequence that I had not realized before and would like to confirrm.

Suppose we use the aaa_init.xml file and start confd in a phased approach. I.E., the startup command is
confd --foreground -c confd.conf --verbose --start-phase0

I can see that aaa_init.xml is loaded via log messages.

15-Jul-2022::11:54:49.946 ctc-rocky-03 confd[3130527]: devel-cdb init files found in ./confd-cdb: aaa_init.xml
15-Jul-2022::11:54:49.947 ctc-rocky-03 confd[3130527]: - CDB load: processing file: ./confd-cdb/aaa_init.xml
15-Jul-2022::11:54:50.082 ctc-rocky-03 confd[3130527]: - ConfD phase0 started

However, this doesn’t seem to be committed till phase 1. Thus if there is a failure or restart between phase 0 and phase 1, the init data will not be loaded.

tldr; Two consecutive starts in phase0 prevent loading of initial config data?

Is this the expected behavior?



Yes, if ConfD is gracefully stopped after start-phase 0 before start-phase 1 where the init transaction is committed, the *.cdb files created in start-phase 0 will be deleted.

If the ConfD process is, for example, killed after start-phase 0 the *.cdb files will not be deleted and thus the *.xml files in the CDB directory will not be read in start-phase 0.

If this scenario can happen for your use case, you can load the XML file(s), e.g. aaa_init.xml after starting ConfD to phase 0 by attaching to the init transaction instead of placing them in the CDB directory.


$ confd -c confd.conf --start-phase0
$ confd_load -i -m -l /path/to/my/aaa_init.xml
$ confd --start-phase1
$ confd --start-phase2