How to free previously allocated memory when loading new schemas from ConfD?

Hi,

I notice the description for confd_free_schemas as below:

There is normally no need to call this function, since the memory will be automatically freed/unmapped if a new schema loading is done, or when the process terminates, but it may be useful in some cases.

In my case, a process will load schemas info from confd when receiving CONFD_UPGRADE_PERFORMED event. To implement this functionality, I have some questions to ask.

  • Is it enough to only call confd_load_schemas to free the previously allocated memory and reload new schemas? Or confd_free_schemas must be called first?

  • If yes, is confd_load_schemas atomic operation?

Hi,

You should load the schema when receiving the CONFD_UPGRADE_COMMITED event. See the examples.confd/in_service_upgrade/simple/cdb_subscriber.c for an example.

As the documentation you quoted says, yes.