On Fri, Jun 2, 2023 at 12:13 AM Han Zhou <[email protected]> wrote: > > For changes such as nb_cfg related columns, don't trigger recompute. > > Signed-off-by: Han Zhou <[email protected]> > Reviewed-by: Ales Musil <[email protected]>
Acked-by: Numan Siddique <[email protected]> Numan > --- > northd/en-northd.c | 26 ++++++++++++++++++++++++++ > northd/en-northd.h | 1 + > northd/inc-proc-northd.c | 3 ++- > tests/ovn-northd.at | 6 +++--- > 4 files changed, 32 insertions(+), 4 deletions(-) > > diff --git a/northd/en-northd.c b/northd/en-northd.c > index e8f3a844af71..a3dc37e198e3 100644 > --- a/northd/en-northd.c > +++ b/northd/en-northd.c > @@ -20,6 +20,7 @@ > > #include "en-northd.h" > #include "lib/inc-proc-eng.h" > +#include "lib/ovn-nb-idl.h" > #include "openvswitch/list.h" /* TODO This is needed for ovn-parallel-hmap.h. > * lib/ovn-parallel-hmap.h should be updated > * to include this dependency itself */ > @@ -122,6 +123,31 @@ void en_northd_run(struct engine_node *node, void *data) > engine_set_node_state(node, EN_UPDATED); > > } > + > +bool > +northd_nb_nb_global_handler(struct engine_node *node, > + void *data OVS_UNUSED) > +{ > + const struct nbrec_nb_global_table *nb_global_table > + = EN_OVSDB_GET(engine_get_input("NB_nb_global", node)); > + > + const struct nbrec_nb_global *nb = > + nbrec_nb_global_table_first(nb_global_table); > + > + if (!nb) { > + static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 1); > + VLOG_WARN_RL(&rl, "NB_Global is updated but has no record."); > + return false; > + } > + > + /* We care about the 'options' and 'ipsec' columns only. */ > + if (nbrec_nb_global_is_updated(nb, NBREC_NB_GLOBAL_COL_OPTIONS) || > + nbrec_nb_global_is_updated(nb, NBREC_NB_GLOBAL_COL_IPSEC)) { > + return false; > + } > + return true; > +} > + > void *en_northd_init(struct engine_node *node OVS_UNUSED, > struct engine_arg *arg OVS_UNUSED) > { > diff --git a/northd/en-northd.h b/northd/en-northd.h > index 0e7f76245e69..8d8343b459a6 100644 > --- a/northd/en-northd.h > +++ b/northd/en-northd.h > @@ -13,5 +13,6 @@ void en_northd_run(struct engine_node *node OVS_UNUSED, > void *data OVS_UNUSED); > void *en_northd_init(struct engine_node *node OVS_UNUSED, > struct engine_arg *arg); > void en_northd_cleanup(void *data); > +bool northd_nb_nb_global_handler(struct engine_node *, void *data > OVS_UNUSED); > > #endif /* EN_NORTHD_H */ > diff --git a/northd/inc-proc-northd.c b/northd/inc-proc-northd.c > index d54aa19c7749..863c9323c444 100644 > --- a/northd/inc-proc-northd.c > +++ b/northd/inc-proc-northd.c > @@ -141,7 +141,8 @@ void inc_proc_northd_init(struct ovsdb_idl_loop *nb, > { > /* Define relationships between nodes where first argument is dependent > * on the second argument */ > - engine_add_input(&en_northd, &en_nb_nb_global, NULL); > + engine_add_input(&en_northd, &en_nb_nb_global, > + northd_nb_nb_global_handler); > engine_add_input(&en_northd, &en_nb_logical_switch, NULL); > engine_add_input(&en_northd, &en_nb_port_group, NULL); > engine_add_input(&en_northd, &en_nb_load_balancer, NULL); > diff --git a/tests/ovn-northd.at b/tests/ovn-northd.at > index 79b5ba63ac8e..6736429ae201 100644 > --- a/tests/ovn-northd.at > +++ b/tests/ovn-northd.at > @@ -8899,11 +8899,11 @@ wait_column '20.0.0.4' Address_Set addresses > name=pg1_ip4 > recompute_stat=$(as northd ovn-appctl -t NORTHD_TYPE inc-engine/show-stats > sync_to_sb_addr_set recompute) > AT_CHECK([test $recompute_stat -ge 1]) > > -# Any change to northd engine node should result in full recompute of > sync_to_sb_addr_set node. > +# No change, no recompute > check as northd ovn-appctl -t NORTHD_TYPE inc-engine/clear-stats > check ovn-nbctl --wait=sb sync > -recompute_stat=$(as northd ovn-appctl -t NORTHD_TYPE inc-engine/show-stats > sync_to_sb_addr_set recompute) > -AT_CHECK([test $recompute_stat -ge 1]) > +AT_CHECK([as northd ovn-appctl -t NORTHD_TYPE inc-engine/show-stats > sync_to_sb_addr_set recompute], [0], [0 > +]) > > AT_CLEANUP > ]) > -- > 2.30.2 > > _______________________________________________ > dev mailing list > [email protected] > https://mail.openvswitch.org/mailman/listinfo/ovs-dev > _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
