Cleanup particially tracked data due to some of the change handler
executions before falling back to recompute. This is done already
in the en_runtime_data_run() implementation, but this patch makes
it a generic behavior of the I-P engine.

Signed-off-by: Han Zhou <[email protected]>
---
v1->v2: no change

 controller/ovn-controller.c | 17 -----------------
 lib/inc-proc-eng.c          |  5 +++++
 2 files changed, 5 insertions(+), 17 deletions(-)

diff --git a/controller/ovn-controller.c b/controller/ovn-controller.c
index 6f7c9ea61..13c03131c 100644
--- a/controller/ovn-controller.c
+++ b/controller/ovn-controller.c
@@ -1412,23 +1412,6 @@ en_runtime_data_run(struct engine_node *node, void *data)
     struct sset *local_lport_ids = &rt_data->local_lport_ids;
     struct sset *active_tunnels = &rt_data->active_tunnels;
 
-    /* Clear the (stale) tracked data if any. Even though the tracked data
-     * gets cleared in the beginning of engine_init_run(),
-     * any of the runtime data handler might have set some tracked
-     * data and later another runtime data handler might return false
-     * resulting in full recompute of runtime engine and rendering the tracked
-     * data stale.
-     *
-     * It's possible that engine framework can be enhanced to indicate
-     * the node handlers (in this case flow_output_runtime_data_handler)
-     * that its input node had a full recompute. However we would still
-     * need to clear the tracked data, because we don't want the
-     * stale tracked data to be accessed outside of the engine, since the
-     * tracked data is cleared in the engine_init_run() and not at the
-     * end of the engine run.
-     * */
-    en_runtime_data_clear_tracked_data(data);
-
     static bool first_run = true;
     if (first_run) {
         /* don't cleanup since there is no data yet */
diff --git a/lib/inc-proc-eng.c b/lib/inc-proc-eng.c
index a6337a1d9..161327404 100644
--- a/lib/inc-proc-eng.c
+++ b/lib/inc-proc-eng.c
@@ -327,6 +327,11 @@ engine_recompute(struct engine_node *node, bool forced, 
bool allowed)
     }
 
     /* Run the node handler which might change state. */
+    /* Clear tracked data before calling run() so that partially tracked data
+     * from some of the change handler executions are cleared. */
+    if (node->clear_tracked_data) {
+        node->clear_tracked_data(node->data);
+    }
     node->run(node, node->data);
     node->stats.recompute++;
 }
-- 
2.30.2

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to