Skip to content

Commit

Permalink
inc-proc-eng: Call clear_tracked_data before recompute.
Browse files Browse the repository at this point in the history
Cleanup partially 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.

Acked-by: Mark D. Gray <mark.d.gray@redhat.com>
Signed-off-by: Han Zhou <hzhou@ovn.org>
  • Loading branch information
hzhou8 committed Apr 29, 2021
1 parent 150be47 commit db41da3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 17 deletions.
17 changes: 0 additions & 17 deletions controller/ovn-controller.c
Original file line number Diff line number Diff line change
Expand Up @@ -1411,23 +1411,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 */
Expand Down
6 changes: 6 additions & 0 deletions lib/inc-proc-eng.c
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,12 @@ engine_recompute(struct engine_node *node, bool forced, bool allowed)
return;
}

/* 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);
}

/* Run the node handler which might change state. */
node->run(node, node->data);
node->stats.recompute++;
Expand Down

0 comments on commit db41da3

Please sign in to comment.