[ovs-dev] [PATCH 1/2] ovsdb: Save some space in the log for newly inserted records.
Justin Pettit
jpettit at nicira.com
Sat Jan 9 00:10:45 UTC 2010
On Jan 6, 2010, at 2:00 PM, Ben Pfaff wrote:
> When a new record is inserted into a database, ovsdb logs the values of all
> of the fields in the record. However, often new records have many columns
> that contain default values. There is no need to log those values, so this
> commit causes them to be omitted.
>
> As a side effect, this makes "ovsdb-tool show-log --more --more" output
> easier to read, because record insertions print less noise.
The "--more" is actually implemented in the second patch.
> +bool
> +ovsdb_atom_is_default(const union ovsdb_atom *atom,
> + enum ovsdb_atomic_type type)
> +{
> + switch (type) {
> + case OVSDB_TYPE_VOID:
> + NOT_REACHED();
NOT_REACHED is just a #define to abort(). I'm a bit nervous about having this function potentially aborting a running process by someone not being careful about the data they pass into it.
> + case OVSDB_N_TYPES:
> + default:
> + NOT_REACHED();
Same here.
> + for (i = 0; i < datum->n; i++) {
> + if (!ovsdb_atom_is_default(&datum->keys[i], type->key_type)) {
> + return false;
> + }
> + if (type->value_type != OVSDB_TYPE_VOID
> + && !ovsdb_atom_is_default(&datum->values[i], type->value_type)) {
> + return false;
> + }
> + }
As we discussed in person, it wasn't clear to me that a key always contains a value and that a value is only populated if the type is a mapping. A bit of documentation in ovsdb-data.h would be really helpful.
--Justin
More information about the dev
mailing list