diff --git a/SOURCES/openvswitch-3.1.0.patch b/SOURCES/openvswitch-3.1.0.patch index 420d678..1842a2f 100644 --- a/SOURCES/openvswitch-3.1.0.patch +++ b/SOURCES/openvswitch-3.1.0.patch @@ -3118,6 +3118,49 @@ index 90714ea13..63e5681a0 100644 void ovsdb_log_compose_record(const struct json *, const char *magic, struct ds *header, struct ds *data); +diff --git a/ovsdb/monitor.c b/ovsdb/monitor.c +index 191befcae..bf5d083cc 100644 +--- a/ovsdb/monitor.c ++++ b/ovsdb/monitor.c +@@ -474,6 +474,7 @@ ovsdb_monitor_add_column(struct ovsdb_monitor *dbmon, + enum ovsdb_monitor_selection select, + bool monitored) + { ++ struct ovsdb_monitor_change_set *mcs; + struct ovsdb_monitor_table *mt; + struct ovsdb_monitor_column *c; + +@@ -484,6 +485,18 @@ ovsdb_monitor_add_column(struct ovsdb_monitor *dbmon, + return column->name; + } + ++ mcs = dbmon->init_change_set; ++ if (mcs) { ++ /* A new column is going to be added to the monitor. Existing ++ * initial change set doesn't have it, so can no longer be used. ++ * Initial change set is never used by more than one session at ++ * the same time, so it's safe to destroy it here. */ ++ ovs_assert(mcs->n_refs == 1); ++ ovsdb_monitor_json_cache_destroy(dbmon, mcs); ++ ovsdb_monitor_change_set_destroy(mcs); ++ dbmon->init_change_set = NULL; ++ } ++ + if (mt->n_columns >= mt->allocated_columns) { + mt->columns = x2nrealloc(mt->columns, &mt->allocated_columns, + sizeof *mt->columns); +@@ -609,7 +622,10 @@ ovsdb_monitor_untrack_change_set(struct ovsdb_monitor *dbmon, + ovs_assert(mcs); + if (--mcs->n_refs == 0) { + if (mcs == dbmon->init_change_set) { +- dbmon->init_change_set = NULL; ++ /* The initial change set should exist as long as the ++ * monitor doesn't change. */ ++ mcs->n_refs++; ++ return; + } else if (mcs == dbmon->new_change_set) { + dbmon->new_change_set = NULL; + } diff --git a/ovsdb/ovsdb-server.c b/ovsdb/ovsdb-server.c index 33ca4910d..cb4671d51 100644 --- a/ovsdb/ovsdb-server.c @@ -4005,6 +4048,80 @@ index 5a7e76eaa..9d28672ef 100644 [0], [stdout], [ignore]) AT_CHECK([sort stdout | uuidfilt]m4_if([$6],,, [[| $6]]), [0], [$4]) +diff --git a/tests/ovsdb-monitor.at b/tests/ovsdb-monitor.at +index 3b622b3ec..82b0e9362 100644 +--- a/tests/ovsdb-monitor.at ++++ b/tests/ovsdb-monitor.at +@@ -1011,3 +1011,69 @@ row,action,name,number,_version + ]], [ignore]) + AT_CLEANUP + ++AT_SETUP([monitor-cond initial reply with condition on non-monitored column]) ++AT_KEYWORDS([ovsdb server monitor monitor-cond positive initial non-monitored]) ++ ++ordinal_schema > schema ++AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore]) ++on_exit 'kill `cat ovsdb-server.pid`' ++AT_CAPTURE_FILE([ovsdb-server.log]) ++AT_CHECK([ovsdb-server --detach --no-chdir --pidfile \ ++ --remote=punix:socket --log-file db], [0], [ignore], [ignore]) ++ ++dnl Initialize the database content. ++for txn in m4_foreach([txn], [[[["ordinals", ++ {"op": "insert", ++ "table": "ordinals", ++ "row": {"number": 0, "name": "zero"}}, ++ {"op": "insert", ++ "table": "ordinals", ++ "row": {"number": 1, "name": "one"}}, ++ {"op": "insert", ++ "table": "ordinals", ++ "row": {"number": 2, "name": "two"}}]]]], ['txn' ]); do ++ AT_CHECK([ovsdb-client transact unix:socket "$txn"], [0], [ignore], [ignore]) ++done ++ ++dnl Start a first client that monitors only the column 'name'. ++on_exit 'kill `cat client-1.pid`' ++AT_CAPTURE_FILE([client-1.out]) ++AT_CHECK([ovsdb-client -vjsonrpc --pidfile=client-1.pid --detach --no-chdir \ ++ -d json monitor-cond --format=csv unix:socket \ ++ ordinals '[[true]]' ordinals ["name"] \ ++ > client-1.out 2> client-1.err], [0], [ignore], [ignore]) ++dnl Wait for the initial monitor reply. ++OVS_WAIT_UNTIL([grep -q 'initial' client-1.out]) ++ ++dnl Start a second client that monitors the column 'name', but has a condition ++dnl on column 'number'. ++on_exit 'kill `cat client-2.pid`' ++AT_CAPTURE_FILE([client-2.out]) ++AT_CHECK([ovsdb-client -vjsonrpc --pidfile=client-2.pid --detach --no-chdir \ ++ -d json monitor-cond --format=csv unix:socket \ ++ ordinals '[[["number", "!=", 1]]]' ordinals ["name"] \ ++ > client-2.out 2> client-2.err], [0], [ignore], [ignore]) ++dnl Wait for the initial monitor reply. ++OVS_WAIT_UNTIL([grep -q 'initial' client-2.out]) ++ ++OVSDB_SERVER_SHUTDOWN ++OVS_WAIT_UNTIL([test ! -e ovsdb-server.pid && \ ++ test ! -e client-1.pid && test ! -e client-2.pid]) ++ ++dnl The first client should have all the names. ++AT_CHECK([$PYTHON3 $srcdir/ovsdb-monitor-sort.py < client-1.out | uuidfilt], ++ [0], [dnl ++row,action,name ++<0>,initial,"""one""" ++<1>,initial,"""two""" ++<2>,initial,"""zero""" ++]) ++ ++dnl The second client should not have the name 'one'. ++AT_CHECK([$PYTHON3 $srcdir/ovsdb-monitor-sort.py < client-2.out | uuidfilt], ++ [0], [dnl ++row,action,name ++<0>,initial,"""two""" ++<1>,initial,"""zero""" ++]) ++AT_CLEANUP diff --git a/tests/ovsdb-tool.at b/tests/ovsdb-tool.at index 12ad6fb3f..5496ccda7 100644 --- a/tests/ovsdb-tool.at diff --git a/SPECS/openvswitch3.1.spec b/SPECS/openvswitch3.1.spec index ca1b55c..cb7035d 100644 --- a/SPECS/openvswitch3.1.spec +++ b/SPECS/openvswitch3.1.spec @@ -63,7 +63,7 @@ Summary: Open vSwitch Group: System Environment/Daemons daemon/database/utilities URL: http://www.openvswitch.org/ Version: 3.1.0 -Release: 38%{?dist} +Release: 39%{?dist} # Nearly all of openvswitch is ASL 2.0. The bugtool is LGPLv2+, and the # lib/sflow*.[ch] files are SISSL @@ -757,6 +757,13 @@ exit 0 %endif %changelog +* Mon Jun 12 2023 Open vSwitch CI - 3.1.0-39 +- Merging upstream branch-3.1 [RH git: a8358be74b] + Commit list: + 859071224c ovsdb: monitor: Destroy initial change set when new columns added. + 54e45e3fee ovsdb: Monitor: Keep and maintain the initial change set. + + * Fri Jun 09 2023 Open vSwitch CI - 3.1.0-38 - Merging upstream branch-3.1 [RH git: 1b7d3d3a1f] Commit list: