summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2010-08-11 15:29:36 -0700
committerBen Pfaff <blp@nicira.com>2010-08-11 15:41:42 -0700
commite85bbd75f7eafe06edcd3edf88bb685e1541bcfe (patch)
tree8009c41d5eeb831719e15c9749ccb8ed1adb5c62 /lib
parentc547535a7c25ce4717b965b77877062796f12a95 (diff)
downloadopenvswitch-e85bbd75f7eafe06edcd3edf88bb685e1541bcfe.tar.gz
bridge: Don't pay attention to columns that vswitchd doesn't need.
Not replicating unneeded columns has some value in avoiding CPU time and bandwidth to the database. In ovs-vswitchd, setting cur_cfg as write-only also have great value in avoiding extra reconfiguration steps. When ovs-vsctl is used in its default mode this essentially avoids half of the reconfigurations that ovs-vswitchd currently does. What happens now is: 1. ovs-vsctl updates the database and increments next_cfg. 2. ovs-vswitchd notices the change to the database, reconfigures itself, then increments cur_cfg to match next_cfg. 3. The database sends the change to cur_cfg back to ovs-vswitchd. 4. ovs-vswitchd reconfigures itself a second time. By not replicating cur_cfg we avoid step 3 and save a whole reconfiguration step. Also, now that the database contains interface statistics, this avoids reconfiguring every time that statistics are updated.
Diffstat (limited to 'lib')
-rw-r--r--lib/ovsdb-idl.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/ovsdb-idl.c b/lib/ovsdb-idl.c
index 57d7b2acc..2132f9fef 100644
--- a/lib/ovsdb-idl.c
+++ b/lib/ovsdb-idl.c
@@ -641,11 +641,19 @@ ovsdb_idl_row_update(struct ovsdb_idl_row *row, const struct json *row_json)
error = ovsdb_datum_from_json(&datum, &column->type, node->data, NULL);
if (!error) {
unsigned int column_idx = column - table->class->columns;
- ovsdb_datum_swap(&row->old[column_idx], &datum);
- ovsdb_datum_destroy(&datum, &column->type);
- if (table->modes[column_idx] == OVSDB_IDL_MODE_RW) {
- changed = true;
+ struct ovsdb_datum *old = &row->old[column_idx];
+
+ if (!ovsdb_datum_equals(old, &datum, &column->type)) {
+ ovsdb_datum_swap(old, &datum);
+ if (table->modes[column_idx] == OVSDB_IDL_MODE_RW) {
+ changed = true;
+ }
+ } else {
+ /* Didn't really change but the OVSDB monitor protocol always
+ * includes every value in a row. */
}
+
+ ovsdb_datum_destroy(&datum, &column->type);
} else {
char *s = ovsdb_error_to_string(error);
VLOG_WARN_RL(&syntax_rl, "error parsing column %s in row "UUID_FMT