(This is in reference to mail thread - http://openvswitch.org/pipermail/dev/2016-March/068331.html)
--- ovsdb-idl: Retain column values of deleted rows until change-track is cleared. When change tracking is enabled, only the row uuid of deleted rows is available. The column values are unparsed and the ovsdb_datum values are cleared so they are not available for inspection. This change leaves the column values around for inspection. The column values are cleared (unparsed) upon clearing the change track. Signed-off-by: Shad Ansari <shad.ans...@hpe.com> --- lib/ovsdb-idl.c | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/lib/ovsdb-idl.c b/lib/ovsdb-idl.c index 3ab05a3..be2cad2 100644 --- a/lib/ovsdb-idl.c +++ b/lib/ovsdb-idl.c @@ -181,6 +181,7 @@ static struct ovsdb_idl_row *ovsdb_idl_row_create(struct ovsdb_idl_table *, const struct uuid *); static void ovsdb_idl_row_destroy(struct ovsdb_idl_row *); static void ovsdb_idl_row_destroy_postprocess(struct ovsdb_idl *); +static void ovsdb_idl_row_free(struct ovsdb_idl_row *); static void ovsdb_idl_row_parse(struct ovsdb_idl_row *); static void ovsdb_idl_row_unparse(struct ovsdb_idl_row *); @@ -318,19 +319,12 @@ ovsdb_idl_clear(struct ovsdb_idl *idl) HMAP_FOR_EACH_SAFE (row, next_row, hmap_node, &table->rows) { struct ovsdb_idl_arc *arc, *next_arc; - if (!ovsdb_idl_row_is_orphan(row)) { - ovsdb_idl_row_unparse(row); - } LIST_FOR_EACH_SAFE (arc, next_arc, src_node, &row->src_arcs) { free(arc); } /* No need to do anything with dst_arcs: some node has those arcs * as forward arcs and will destroy them itself. */ - if (!ovs_list_is_empty(&row->track_node)) { - ovs_list_remove(&row->track_node); - } - ovsdb_idl_row_destroy(row); } } @@ -856,8 +850,7 @@ ovsdb_idl_track_clear(const struct ovsdb_idl *idl) ovs_list_remove(&row->track_node); ovs_list_init(&row->track_node); if (ovsdb_idl_row_is_orphan(row)) { - ovsdb_idl_row_clear_old(row); - free(row); + ovsdb_idl_row_free(row); } } } @@ -1619,7 +1612,7 @@ ovsdb_idl_row_destroy_postprocess(struct ovsdb_idl *idl) LIST_FOR_EACH_SAFE(row, next, track_node, &table->track_list) { if (!ovsdb_idl_track_is_set(row->table)) { ovs_list_remove(&row->track_node); - free(row); + ovsdb_idl_row_free(row); } } } @@ -1627,6 +1620,13 @@ ovsdb_idl_row_destroy_postprocess(struct ovsdb_idl *idl) } static void +ovsdb_idl_row_free(struct ovsdb_idl_row *row) +{ + ovsdb_idl_row_unparse(row); + free(row); +} + +static void ovsdb_idl_insert_row(struct ovsdb_idl_row *row, const struct json *row_json) { const struct ovsdb_idl_table_class *class = row->table->class; @@ -1646,7 +1646,6 @@ ovsdb_idl_insert_row(struct ovsdb_idl_row *row, const struct json *row_json) static void ovsdb_idl_delete_row(struct ovsdb_idl_row *row) { - ovsdb_idl_row_unparse(row); ovsdb_idl_row_clear_arcs(row, true); ovsdb_idl_row_clear_old(row); if (ovs_list_is_empty(&row->dst_arcs)) { @@ -2138,8 +2137,6 @@ ovsdb_idl_txn_disassemble(struct ovsdb_idl_txn *txn) ovsdb_idl_row_clear_arcs(row, false); ovsdb_idl_row_parse(row); } - } else { - ovsdb_idl_row_unparse(row); } ovsdb_idl_row_clear_new(row); @@ -2153,7 +2150,7 @@ ovsdb_idl_txn_disassemble(struct ovsdb_idl_txn *txn) hmap_node_nullify(&row->txn_node); if (!row->old) { hmap_remove(&row->table->rows, &row->hmap_node); - free(row); + ovsdb_idl_row_free(row); } } hmap_destroy(&txn->txn_rows); @@ -2720,12 +2717,11 @@ ovsdb_idl_txn_delete(const struct ovsdb_idl_row *row_) ovs_assert(row->new != NULL); if (!row->old) { - ovsdb_idl_row_unparse(row); ovsdb_idl_row_clear_new(row); ovs_assert(!row->prereqs); hmap_remove(&row->table->rows, &row->hmap_node); hmap_remove(&row->table->idl->txn->txn_rows, &row->txn_node); - free(row); + ovsdb_idl_row_free(row); return; } if (hmap_node_is_null(&row->txn_node)) { -- 1.9.1 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev