if (!ovsdb_idl_row_is_orphan(row)) {
ovsdb_idl_row_unparse(row);
- ovsdb_idl_row_clear_old(row);
}
- hmap_remove(&table->rows, &row->hmap_node);
LIST_FOR_EACH_SAFE (arc, next_arc, struct ovsdb_idl_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. */
- free(row);
+ ovsdb_idl_row_destroy(row);
}
}
/* Force nodes that reference 'row' to reparse. */
static void
-ovsdb_idl_row_reparse_backrefs(struct ovsdb_idl_row *row, bool destroy_dsts)
+ovsdb_idl_row_reparse_backrefs(struct ovsdb_idl_row *row)
{
struct ovsdb_idl_arc *arc, *next;
struct ovsdb_idl_row *ref = arc->src;
ovsdb_idl_row_unparse(ref);
- ovsdb_idl_row_clear_arcs(ref, destroy_dsts);
+ ovsdb_idl_row_clear_arcs(ref, false);
ovsdb_idl_row_parse(ref);
}
}
ovsdb_idl_row_update(row, row_json);
ovsdb_idl_row_parse(row);
- ovsdb_idl_row_reparse_backrefs(row, false);
+ ovsdb_idl_row_reparse_backrefs(row);
}
static void
if (list_is_empty(&row->dst_arcs)) {
ovsdb_idl_row_destroy(row);
} else {
- ovsdb_idl_row_reparse_backrefs(row, true);
+ ovsdb_idl_row_reparse_backrefs(row);
}
}
assert(!idl->txn);
idl->txn = txn = xmalloc(sizeof *txn);
+ txn->request_id = NULL;
txn->idl = idl;
- txn->status = TXN_INCOMPLETE;
hmap_init(&txn->txn_rows);
+ txn->status = TXN_INCOMPLETE;
txn->dry_run = false;
ds_init(&txn->comment);
+
txn->inc_table = NULL;
txn->inc_column = NULL;
txn->inc_where = NULL;
+
hmap_init(&txn->inserted_rows);
+
return txn;
}
{
struct ovsdb_idl_txn_insert *insert, *next;
+ json_destroy(txn->request_id);
if (txn->status == TXN_INCOMPLETE) {
hmap_remove(&txn->idl->outstanding_txns, &txn->hmap_node);
}
&txn->inserted_rows) {
free(insert);
}
+ hmap_destroy(&txn->inserted_rows);
free(txn);
}
ovsdb_idl_row_parse(row);
}
} else {
- hmap_remove(&row->table->rows, &row->hmap_node);
+ ovsdb_idl_row_unparse(row);
}
ovsdb_idl_row_clear_new(row);
hmap_remove(&txn->txn_rows, &row->txn_node);
hmap_node_nullify(&row->txn_node);
+ if (!row->old) {
+ hmap_remove(&row->table->rows, &row->hmap_node);
+ free(row);
+ }
}
hmap_destroy(&txn->txn_rows);
hmap_init(&txn->txn_rows);
assert(row->new != NULL);
if (!row->old) {
+ ovsdb_idl_row_unparse(row);
ovsdb_idl_row_clear_new(row);
assert(!row->prereqs);
hmap_remove(&row->table->rows, &row->hmap_node);