lib/ovsdb-idl.c
/* Should be called when the IDL fsm is restarted and resyncs table conditions
 * based on the state the DB is in:
 * - if a non-zero last_id is available for the DB then upon reconnect
 *   the IDL should first request acked conditions to avoid missing updates
 *   about records that were added before the transaction with
 *   txn-id == last_id. If there were requested condition changes in flight
 *   (i.e., req_cond not NULL) and the IDL client didn't set new conditions
 *   (i.e., new_cond is NULL) then move req_cond to new_cond to trigger a
 *   follow up monitor_cond_change request.
 * - if there's no last_id available for the DB then it's safe to use the
 *   latest conditions set by the IDL client even if they weren't acked yet.
 */
Should be called when the IDL fsm is restarted and resyncs table conditions
based on the state the DB is in:
- if a non-zero last_id is available for the DB then upon reconnect
the IDL should first request acked conditions to avoid missing updates
about records that were added before the transaction with
txn-id == last_id. If there were requested condition changes in flight
and the IDL client didn't set new conditions
then move req_cond to new_cond to trigger a
follow up monitor_cond_change request.
- if there's no last_id available for the DB then it's safe to use the
latest conditions set by the IDL client even if they weren't acked yet.
Should be called when the IDL fsm is restarted and resyncs table conditions based on the state the DB is in : - if a non - zero last_id is available for the DB then upon reconnect the IDL should first request acked conditions to avoid missing updates about records that were added before the transaction with txn - id == last_id . If there were requested condition changes in flight and the IDL client didn ' t set new conditions then move req_cond to new_cond to trigger a follow up monitor_cond_change request . - if there ' s no last_id available for the DB then it ' s safe to use the latest conditions set by the IDL client even if they weren ' t acked yet .
static void
ovsdb_idl_db_sync_condition(struct ovsdb_idl_db *db)
{
    bool ack_all = uuid_is_zero(&db->last_id);
    db->cond_changed = false;
    for (size_t i = 0; i < db->class_->n_tables; i++) {
        struct ovsdb_idl_table *table = &db->tables[i];
        if (ack_all) {
            if (table->new_cond) {
                ovsdb_idl_condition_move(&table->req_cond, &table->new_cond);
            }
            if (table->req_cond) {
                ovsdb_idl_condition_move(&table->ack_cond, &table->req_cond);
            }
        } else {
            if (table->req_cond && !table->new_cond) {
                ovsdb_idl_condition_move(&table->new_cond, &table->req_cond);
                db->cond_changed = true;
            }
        }
    }
}
static void ovsdb_idl_db_sync_condition ( struct ovsdb_idl_db * db ) { bool ack_all = uuid_is_zero ( & db -> last_id ) ; db -> cond_changed = false ; for ( size_t i = 0 ; i < db -> class_ -> n_tables ; i ++ ) { struct ovsdb_idl_table * table = & db -> tables [ i ] ; if ( ack_all ) { if ( table -> new_cond ) { ovsdb_idl_condition_move ( & table -> req_cond , & table -> new_cond ) ; } if ( table -> req_cond ) { ovsdb_idl_condition_move ( & table -> ack_cond , & table -> req_cond ) ; } } else { if ( table -> req_cond && ! table -> new_cond ) { ovsdb_idl_condition_move ( & table -> new_cond , & table -> req_cond ) ; db -> cond_changed = true ; } } } }
Should be called when the IDL fsm is restarted and resyncs table conditions
 based on the state the DB is in:
 - if a non-zero last_id is available for the DB then upon reconnect
   the IDL should first request acked conditions to avoid missing updates
   about records that were added before the transaction with
   txn-id == last_id.
Should be called when the IDL fsm is restarted and resyncs table conditions based on the state the DB is in : - if a non - zero last_id is available for the DB then upon reconnect the IDL should first request acked conditions to avoid missing updates about records that were added before the transaction with txn - id == last_id .
/* When monitor_cond_since requests will be issued, the
         * table->ack_cond condition will be added to the "where" clause".
         * Follow up monitor_cond_change requests will use table->new_cond.
         */ /* If there was no "unsent" condition but instead a
             * monitor_cond_change request was in flight, move table->req_cond
             * to table->new_cond and set db->cond_changed to trigger a new
             * monitor_cond_change request.
             *
             * However, if a new condition has been set by the IDL client,
             * monitor_cond_change will be sent anyway and will use the most
             * recent table->new_cond so there's no need to update it here.
             */