[ovs-git] [openvswitch/ovs] 4c0d09: ovsdb-idl.at: Make test outputs more predictable.

Dumitru Ceara noreply at github.com
Thu Apr 1 13:13:21 UTC 2021


  Branch: refs/heads/master
  Home:   https://github.com/openvswitch/ovs
  Commit: 4c0d093b17e8610e92891abad879484b7fbbd716
      https://github.com/openvswitch/ovs/commit/4c0d093b17e8610e92891abad879484b7fbbd716
  Author: Dumitru Ceara <dceara at redhat.com>
  Date:   2021-04-01 (Thu, 01 Apr 2021)

  Changed paths:
    M lib/ovsdb-idl.c
    M lib/ovsdb-idl.h
    M tests/ovsdb-cluster.at
    M tests/ovsdb-idl.at
    M tests/test-ovsdb.c
    M tests/test-ovsdb.py

  Log Message:
  -----------
  ovsdb-idl.at: Make test outputs more predictable.

IDL tests need predictable output from test-ovsdb.

This used to be done by first sorting the output of test-ovsdb and then
applying uuidfilt to predictably translate UUIDs.  This was not
reliable enough in case test-ovsdb processes two or more insert/delete
operations in the same iteration because the order of lines in the
output depends on the automatically generated UUID values.

To fix this we change the way test-ovsdb and test-ovsdb.py generate
outputs and prepend the table name and tracking information before
printing the contents of a row.

All existing ovsdb-idl.at and ovsdb-cluster.at tests are updated to
expect the new output format.

Signed-off-by: Dumitru Ceara <dceara at redhat.com>
Acked-by: Han Zhou <hzhou at ovn.org>
Signed-off-by: Ilya Maximets <i.maximets at ovn.org>


  Commit: 95689f1668181661fd69321aada81b339d1afbf3
      https://github.com/openvswitch/ovs/commit/95689f1668181661fd69321aada81b339d1afbf3
  Author: Dumitru Ceara <dceara at redhat.com>
  Date:   2021-04-01 (Thu, 01 Apr 2021)

  Changed paths:
    M lib/ovsdb-idl.c
    M tests/ovsdb-idl.at
    M tests/test-ovsdb.c
    M tests/test-ovsdb.py

  Log Message:
  -----------
  ovsdb-idl: Preserve references for deleted rows.

Considering two DB rows, 'a' from table A and 'b' from table B (with
column 'ref_a' a reference to table A):
a = {A._uuid=<U1>}
b = {B._uuid=<U2>, B.ref_a=<U1>}

Assuming both records are present in the IDL client's in-memory view of
the database, depending whether row 'b' is also deleted in the same
transaction or not, deletion of row 'a' should generate the following
tracked changes:

1. only row 'a' is deleted:
- for table A:
  - deleted records: a = {A._uuid=<U1>}
- for table B:
  - updated records: b = {B._uuid=<U2>, B.ref_a=[]}

2. row 'a' and row 'b' are deleted in the same update:
- for table A:
  - deleted records: a = {A._uuid=<U1>}
- for table B:
  - deleted records: b = {B._uuid=<U2>, B.ref_a=<U1>}

To ensure this, we now delay reparsing row backrefs for deleted rows
until all updates in the current run have been processed.

Without this change, in scenario 2 above, the tracked changes for table
B would be:
- deleted records: b = {B._uuid=<U2>, B.ref_a=[]}

In particular, for strong references, row 'a' can never be deleted in
a transaction that happens strictly before row 'b' is deleted.  In some
cases [0] both rows are deleted in the same transaction and having
B.ref_a=[] would violate the integrity of the database from client
perspective.  This would force the client to always validate that
strong reference fields are non-NULL.  This is not really an option
because the information in the original reference is required for
incrementally processing the record deletion.

[0] with ovn-monitor-all=true, the following command triggers a crash
    in ovn-controller because a strong reference field becomes NULL:
    $ ovn-nbctl --wait=hv -- lr-add r -- lrp-add r rp 00:00:00:00:00:01 1.0.0.1/24
    $ ovn-nbctl lr-del r

Reported-at: https://bugzilla.redhat.com/1932642
Fixes: 72aeb243a52a ("ovsdb-idl: Tracking - preserve data for deleted rows.")
Signed-off-by: Dumitru Ceara <dceara at redhat.com>
Acked-by: Han Zhou <hzhou at ovn.org>
Signed-off-by: Ilya Maximets <i.maximets at ovn.org>


  Commit: ac85cdb38c1f33e7952bc4c0347d6c7873fb56a1
      https://github.com/openvswitch/ovs/commit/ac85cdb38c1f33e7952bc4c0347d6c7873fb56a1
  Author: Dumitru Ceara <dceara at redhat.com>
  Date:   2021-04-01 (Thu, 01 Apr 2021)

  Changed paths:
    M lib/ovsdb-idl.c
    M tests/ovsdb-idl.at

  Log Message:
  -----------
  ovsdb-idl: Mark arc sources as updated when destination is deleted.

Considering two DB rows, 'a' from table A and 'b' from table B (with
column 'ref_a' a reference to table A):
a = {A._uuid=<U1>}
b = {B._uuid=<U2>, B.ref_a=<U1>}

When the IDL client processes an update that deletes row 'a', row 'b'
is also marked as 'updated' if change tracking is enabled for table B.

Fixes: 102781cc02c6 ("ovsdb-idl: Track changes for table references.")
Signed-off-by: Dumitru Ceara <dceara at redhat.com>
Acked-by: Han Zhou <hzhou at ovn.org>
Signed-off-by: Ilya Maximets <i.maximets at ovn.org>


Compare: https://github.com/openvswitch/ovs/compare/31629b5383c3...ac85cdb38c1f


More information about the git mailing list