Usage of replay.cdb file


I am using maapi to control the confd startup and when confd is in phase 1 i load the initial configuration from maapi again. After this transaction gets commited in phase 2 i see that the replay.cdb file is created. What i want to know is if the existence of this file guarantees that at some point in the past the initial configuration was loaded successfully and confd reached phase 2.
The application requires that if for any reason confd restarts after phase 2 the initial configuration must not be loaded again so i assumed that checking the replay.cdb file could give enough information about the previous state of confd. Can you please provide some info about that or if there is another way to know if the application has loaded the initial configuration after a confd restart?


replay.cdb is related to cdb_replay_subscriptions and confd.conf configuration /confdConfig/cdb/subscriptionReplay/enabled. It contains saved previous transaction information. If it is turned off in confd.conf, it will not be created.

But would not it be better approach just to check (via maapi) if initial configuration is already present?
It is better than relay on some file being created by ConfD.


Thank you for your response but let me explain myself better. What i am trying to solve is a failure situation in which the container where Confd runs restarts for any reason. In that case after the restart my program that manages Confd has to decide if this is the fist time that is running or this a case after a restart where initial configuration was loaded at some point in the past and doesn’t need to load it again.

So i need a state that i can rely on. Maapi as far as i know cannot provide that kind of info. The current implementation creates some kind of a flag-file and depends on it’s existence to decide the state (before or after a restart). I was wondering if Confd can provide something similar and this why i asked about replay.cdb. What i want to know is if there is something that can tell me if Confd reached phase 2 at any time in the past even if Confd has restarted.

Yes, I understand your requirement. Not sure if relying on replay.cdb is good choice. This file will be created/updated after each transaction, so it might work. But what if you disable subscriptionReplay in the confd.conf? Then replay.cdb will not be created at all. I suggest you create some field (can be hidden) in your configuration and update it (increment) after each application start. This seems to me more reliable. The advantage is that you have also full control of the functionality.

Ok that seems like a good solution!

Thank you!