mirror of
https://github.com/openvswitch/ovs
synced 2025-08-31 14:25:26 +00:00
ovsdb-idl: Suppress "delete" operations for garbage-collected tables.
Deciding what delete operations to issue on garbage-collected tables has been a bit of a difficult issue for ovs-vsctl. When garbage collection was introduced in commitc5f341a
"ovsdb: Implement garbage collection", ovs-vsctl did not issue any deletions for these tables at all. As a side effect, ovs-vsctl did not notice that records were going to be deleted. That meant that when multiple commands were issued in one ovs-vsctl run, ovs-vsctl could get confused by apparent duplicate records that did not in fact exist. Commit28a14bf
"ovs-vsctl: Back out garbage collection changes" fixed the problem by putting all of the explicit deletions back into ovs-vsctl. However, adding these explicit deletions had the price that it then became (again) impossible to use ovs-vsctl commands to delete duplicates, for example to use "ovs-vsctl del-br" to delete a bridge that points to the same Port records that some other Bridge record also does. This commit makes that possible again, by implementing a compromise: * Internally, ovs-vsctl deletes the records that it believes should be deleted. * ovsdb-idl suppresses the deletions when it makes the RPC call into the database server. Bug #5358. Reported-by: Henrik Amren <henrik@nicira.com>
This commit is contained in:
@@ -1397,12 +1397,16 @@ ovsdb_idl_txn_commit(struct ovsdb_idl_txn *txn)
|
||||
if (row->old == row->new) {
|
||||
continue;
|
||||
} else if (!row->new) {
|
||||
struct json *op = json_object_create();
|
||||
json_object_put_string(op, "op", "delete");
|
||||
json_object_put_string(op, "table", class->name);
|
||||
json_object_put(op, "where", where_uuid_equals(&row->uuid));
|
||||
json_array_add(operations, op);
|
||||
any_updates = true;
|
||||
if (class->is_root) {
|
||||
struct json *op = json_object_create();
|
||||
json_object_put_string(op, "op", "delete");
|
||||
json_object_put_string(op, "table", class->name);
|
||||
json_object_put(op, "where", where_uuid_equals(&row->uuid));
|
||||
json_array_add(operations, op);
|
||||
any_updates = true;
|
||||
} else {
|
||||
/* Let ovsdb-server decide whether to really delete it. */
|
||||
}
|
||||
} else {
|
||||
struct json *row_json;
|
||||
struct json *op;
|
||||
|
Reference in New Issue
Block a user