How to avoid re-reading the configuration?

We could read the last transaction id from CDB by cdb_get_txid(int sock, struct cdb_txid *txid), I think it is a global id for all MO modules.

The problem is for example I got two MOs which are A and B.

  1. A and B start and read the last transaction id assume = = 1
  2. now config some leaf in moudle A, is updated, = 2, note that we are not config B
  3. assume module B restart and read the last transaction id, B.old_id = 1, B.new_id = 2
  4. module B compare the new and old transaction id, they are not the same, B module re-reading the configuration.(actually, configuration of module B is not changed)

Example 5.3 in confd_user_guide-6.0.pdf shows pseudo code demonstrating how to avoid re-reading the configuration in single module, but virtually there must be multiple modules work together. I think if we could distinguish txid of different modules, the problom is solved.

One way around this is to register your cdb subscribers as mandatory subscribers in order to ensure that no transactions will go through when your subscriber aborts. Transactions can only go through when your mandatory subscriber is running. You can refer to the man page for cdb_mandatory_subscriber( ) API call for more information.

Well, this problem seems the same as How to recover from lost CDB subscription notifications?