Problem with external data provider in initial configuration

Hello,

I would like to ask you about confd startup procedure. I have created an external data provider, I also use a script that controls confd phases transition. According to manual if there is an external data provider needs to be registered in phase0, but when I am trying to load initial configuration in confd, external data provider has not started yet as a result confd exits with error code 10 due to not yet registered callbacks.

From confd manual initial configuration is committed after phase 0, but meanwhile some ext-data provider’s data callbacks are needed before that(when loading initial configuration from xml file). Is this any way to avoid this. Is there any option confd waits in phase 0 before load any initial configuration?

Also external data provider with the script that controls phases transition cannot sync each other.

Regards,
Marc

Hello,

Do you start Confd in phases? E.g.:

confd -c confd.conf --start-phase0
confd --wait-phase0

<<start data provider app here>>

confd --start-phase1
confd --start-phase2
confd --wait-started 10

More info about parameters can be found in confd man page (man confd) or ConfD User Guide.

Hello mnovak,

Yes this is exactly how I am starting confd, in phases. The problem is while I am starting data provider (between phase0 and phase1) confd starts to load initial configuration as a result data callbacks from data provider to be called so confd exits with error code 10 (because data provider not started yet). My question is if there is any option confd NOT to load initial configuration immediately after loading .fxs files? Can we control initial load of confd?

Regards,
Marc

When loading the initial configuration from an initialization file where you have an external DB connected to ConfD, you can’t put the XML file in the CDB dbDir or CDB initPath, since you are not utilizing CDB to store that data.

Rather you want to do something like this:

$ confd --start-phase0 -c confd.conf --addloadpath /Users/tailf/confd-6.4.1/etc/confd
$ confd --wait-phase0
$ ./my_extdb_app &
$ confd_load -d -d -m -i -l init.xml
    TRACE Connected (maapi) to ConfD
    TRACE MAAPI_LOAD_ALL_NS
    TRACE Connected (maapi) to ConfD
    attaching to init session...
    TRACE MAAPI_LOAD_HASH_DB
    TRACE MAAPI_ATTACH  --> CONFD_OK
    TRACE MAAPI_LOAD_CONFIG_FILE TRACE
$ confd_load --start-phase2
...

From the ConfD UG

/confdConfig/cdb/dbDir (string)
 dbDir is the directory on disk which CDB use for its storage and any temporary files being used. 
 It is also the directory where CDB searches for initialization files.

/confdConfig/cdb/initPath
The initPath can contain any number of <dir> items, which should be directories. 
When CDB first starts it will first look in these directories for initialization files. 
The directories will be searched in the order they are listed, lastly the dbDir is searched.

Hello cohult,

Thanks for your info, that is exactly the case.

Regards,
Marc