Queries on CDB_SUBSCRIBE and CDB_SYNC_SUBSCRIPTION_SOCKET MAPPING

Hi all, have some below queries regarding CDB subscription and read,

  1. if we subscribe root path and sub path with different priorities, the root path changes in DB results two subscription get hit under polling , so we need to send cdb_sync_subscription for both sub_points right? if we miss sending cdb_sync_subscription, confd transcation will be under lock , is my undertsaning correct here?
  2. For each sub points we need send cdb_sync_subscription otherwise transactions at confd will be locked right?
  3. can we use same priority to different sub points (one subpoint is rootpath and another is its sub paths)? if we use same priority any issues possible?
  4. In any case below code else part will get hit?
    if ((set[0].revents & POLLIN))
    {
    int sub_points[2];
    int reslen = 0;
    int status = 0;
  status = cdb_read_subscription_socket(confd_oper_subs_socket,
          sub_points, &reslen);
   for (int idx = 0; idx < reslen ; ++idx)
  {
        if(sub_points[idx] == subpoin1)
        {
               cdb_iterate()
           cdb_sync_sub()
        }
        else if(sub_point[idx] == subpoin2)
        {
            cdb_iterate()
           cdb_sync_sub()
        }
        else
         {
           std::cout << "no sub points matched"<< std::endl;     --> this will hit in any scenario?
         }
  }

}
Thanks in advance

Hi,

  1. Yes. The default setting in confd.conf under /confdConfig/cdb/clientTimeout (xs:duration | infinity) [infinity]. See the confd.conf(5) man page will keep the transaction locked until a call to cdb_sync_subscription_socket() or until the subscriber socket is closed.
  2. Yes. See above.
  3. No. The subscribers will be called concurrently if they have the same priority.
  4. Your code is basic C-programming and not ConfD-related. And yes, the else statement will likely execute for subscription point 2 as the else if statement evaluation uses a sub_point[idx] array, not the sub_points[idx] array it should be using.