On Mon, Nov 2, 2015 at 12:27 AM, Liran Schour <lir...@il.ibm.com> wrote:
> "dev" <dev-boun...@openvswitch.org> wrote on 22/10/2015 07:45:27 AM:
>>
>> Add functions that can generate "update2" notification for a
>> "monitor2" session. "monitor2" and "update2" are RFC 7047 extensions
>> deescribed by ovsdb-server(1) manpage. See the manpage changes
>> for more details.
>>
>> Signed-off-by: Andy Zhou <az...@nicira.com>
>
> ...
>
>
>> +    } else {
>> +        diff_json = json_object_create();
>> +        const char *op;
>> +
>> +        for (i = 0; i < mt->n_columns; i++) {
>> +            const struct ovsdb_monitor_column *c = &mt->columns[i];
>> +
>> +            if (!(type & c->select)) {
>> +                /* We don't care about this type of change for this
>> +                 * particular column (but we will care about it for some
>> +                 * other column). */
>> +                continue;
>> +            }
>> +
>> +            if (type == OJMS_MODIFY) {
>> +                struct ovsdb_datum *diff;
>> +
>> +                if (!bitmap_is_set(changed, i)) {
>> +                    continue;
>> +                }
>> +
>> +                diff = ovsdb_datum_diff(&row->old[i], &row->new[i],
>> +                                        &c->column->type);
>> +                json_object_put(diff_json, c->column->name,
>> +                                ovsdb_datum_to_json(diff,
>> &c->column->type));
>> +                ovsdb_datum_destroy(diff, &c->column->type);
>> +                free(diff);
>> +            } else {
>> +                if (!ovsdb_datum_is_default(&row->new[i],
>> &c->column->type)) {
>> +                    json_object_put(diff_json, c->column->name,
>> +                                    ovsdb_datum_to_json(&row->new[i],
>> +
>> &c->column->type));
>> +                }
>
> Why to use here ovsdb_datum_is_default()? For example if a column is of type
> INTEGER and the value is 0, you will miss that value in the update message.
> Seems like a bug.
>

This is for 'initial' or 'insert' rows. In those cases, the rows will
be created with the default values on the client side.  In your
example, the column will be created with value 0. It seems sending
information about 0 will be redundant?  Please let me
know if I am still missing something here.

In any case,  It seems I did not add enough comments about this
optimization. Will add more in the next rev. Thanks for reviewing.
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to