diff --git a/SOURCES/openvswitch-2.13.0.patch b/SOURCES/openvswitch-2.13.0.patch index ca73b57..cc1e17b 100644 --- a/SOURCES/openvswitch-2.13.0.patch +++ b/SOURCES/openvswitch-2.13.0.patch @@ -84795,7 +84795,7 @@ index 91662cab84..938a99d914 100644 ovsdb_error_destroy(error); } diff --git a/ovsdb/ovsdb.c b/ovsdb/ovsdb.c -index cfc96b32f8..9042658fa8 100644 +index cfc96b32f8..e019631e9a 100644 --- a/ovsdb/ovsdb.c +++ b/ovsdb/ovsdb.c @@ -17,6 +17,10 @@ @@ -84809,7 +84809,15 @@ index cfc96b32f8..9042658fa8 100644 #include "column.h" #include "file.h" #include "monitor.h" -@@ -414,7 +418,7 @@ ovsdb_create(struct ovsdb_schema *schema, struct ovsdb_storage *storage) +@@ -27,6 +31,7 @@ + #include "simap.h" + #include "storage.h" + #include "table.h" ++#include "timeval.h" + #include "transaction.h" + #include "trigger.h" + +@@ -414,7 +419,7 @@ ovsdb_create(struct ovsdb_schema *schema, struct ovsdb_storage *storage) db->storage = storage; ovs_list_init(&db->monitors); ovs_list_init(&db->triggers); @@ -84818,7 +84826,7 @@ index cfc96b32f8..9042658fa8 100644 shash_init(&db->tables); if (schema) { -@@ -502,6 +506,10 @@ ovsdb_get_memory_usage(const struct ovsdb *db, struct simap *usage) +@@ -502,6 +507,10 @@ ovsdb_get_memory_usage(const struct ovsdb *db, struct simap *usage) } simap_increase(usage, "cells", cells); @@ -84829,7 +84837,7 @@ index cfc96b32f8..9042658fa8 100644 } struct ovsdb_table * -@@ -511,7 +519,7 @@ ovsdb_get_table(const struct ovsdb *db, const char *name) +@@ -511,18 +520,31 @@ ovsdb_get_table(const struct ovsdb *db, const char *name) } struct ovsdb_error * OVS_WARN_UNUSED_RESULT @@ -84838,7 +84846,12 @@ index cfc96b32f8..9042658fa8 100644 { if (!db->storage) { return NULL; -@@ -523,6 +531,12 @@ ovsdb_snapshot(struct ovsdb *db) + } + ++ uint64_t elapsed, start_time = time_msec(); + struct json *schema = ovsdb_schema_to_json(db->schema); + struct json *data = ovsdb_to_txn_json(db, "compacting database online"); + struct ovsdb_error *error = ovsdb_storage_store_snapshot(db->storage, schema, data); json_destroy(schema); json_destroy(data); @@ -84848,6 +84861,12 @@ index cfc96b32f8..9042658fa8 100644 + malloc_trim(0); + } +#endif ++ ++ elapsed = time_msec() - start_time; ++ if (elapsed > 1000) { ++ VLOG_INFO("%s: Database compaction took %"PRIu64"ms", ++ db->name, elapsed); ++ } return error; } @@ -84910,7 +84929,7 @@ index 18c83fe9c2..dd14d81091 100644 struct hmap servers; struct ovsdb_error *error = diff --git a/ovsdb/raft.c b/ovsdb/raft.c -index 4789bc4f22..d08a7bcb62 100644 +index 4789bc4f22..ec4c244762 100644 --- a/ovsdb/raft.c +++ b/ovsdb/raft.c @@ -36,6 +36,7 @@ @@ -85193,7 +85212,32 @@ index 4789bc4f22..d08a7bcb62 100644 } /* Returns true if 'raft' has grown enough since the last snapshot that -@@ -4143,9 +4259,7 @@ raft_handle_execute_command_request__( +@@ -4023,9 +4139,24 @@ raft_may_snapshot(const struct raft *raft) + && !raft->leaving + && !raft->left + && !raft->failed ++ && raft->role != RAFT_LEADER + && raft->last_applied >= raft->log_start); + } + ++/* Prepares for soon snapshotting. */ ++void ++raft_notify_snapshot_recommended(struct raft *raft) ++{ ++ if (raft->role == RAFT_LEADER) { ++ /* Leader is about to write database snapshot to the disk and this ++ * might take significant amount of time. Stepping back from the ++ * leadership to keep the cluster functional during this process. */ ++ VLOG_INFO("Transferring leadership to write a snapshot."); ++ raft_transfer_leadership(raft, "preparing to write snapshot"); ++ raft_become_follower(raft); ++ } ++} ++ + /* Replaces the log for 'raft', up to the last log entry read, by + * 'new_snapshot_data'. Returns NULL if successful, otherwise an error that + * the caller must eventually free. +@@ -4143,9 +4274,7 @@ raft_handle_execute_command_request__( cmd->sid = rq->common.sid; enum raft_command_status status = cmd->status; @@ -85204,7 +85248,7 @@ index 4789bc4f22..d08a7bcb62 100644 return status; } -@@ -4366,6 +4480,8 @@ raft_unixctl_status(struct unixctl_conn *conn, +@@ -4366,6 +4495,8 @@ raft_unixctl_status(struct unixctl_conn *conn, : raft->leaving ? "leaving cluster" : raft->left ? "left cluster" : raft->failed ? "failed" @@ -85213,7 +85257,7 @@ index 4789bc4f22..d08a7bcb62 100644 : "cluster member"); if (raft->joining) { ds_put_format(&s, "Remotes for joining:"); -@@ -4639,6 +4755,42 @@ raft_unixctl_change_election_timer(struct unixctl_conn *conn, +@@ -4639,6 +4770,42 @@ raft_unixctl_change_election_timer(struct unixctl_conn *conn, unixctl_command_reply(conn, "change of election timer initiated."); } @@ -85256,7 +85300,7 @@ index 4789bc4f22..d08a7bcb62 100644 static void raft_unixctl_failure_test(struct unixctl_conn *conn OVS_UNUSED, int argc OVS_UNUSED, const char *argv[], -@@ -4667,6 +4819,8 @@ raft_unixctl_failure_test(struct unixctl_conn *conn OVS_UNUSED, +@@ -4667,6 +4834,8 @@ raft_unixctl_failure_test(struct unixctl_conn *conn OVS_UNUSED, raft_reset_election_timer(raft); } } @@ -85265,7 +85309,7 @@ index 4789bc4f22..d08a7bcb62 100644 } else if (!strcmp(test, "clear")) { failure_test = FT_NO_TEST; unixctl_command_reply(conn, "test dismissed"); -@@ -4697,6 +4851,9 @@ raft_init(void) +@@ -4697,6 +4866,9 @@ raft_init(void) raft_unixctl_kick, NULL); unixctl_command_register("cluster/change-election-timer", "DB TIME", 2, 2, raft_unixctl_change_election_timer, NULL); @@ -85276,7 +85320,7 @@ index 4789bc4f22..d08a7bcb62 100644 raft_unixctl_failure_test, NULL); ovsthread_once_done(&once); diff --git a/ovsdb/raft.h b/ovsdb/raft.h -index 3d448995af..99d5307e54 100644 +index 3d448995af..59902fe825 100644 --- a/ovsdb/raft.h +++ b/ovsdb/raft.h @@ -67,6 +67,7 @@ @@ -85295,8 +85339,16 @@ index 3d448995af..99d5307e54 100644 /* Joining a cluster. */ bool raft_is_joining(const struct raft *); +@@ -172,6 +174,7 @@ void raft_command_wait(const struct raft_command *); + bool raft_grew_lots(const struct raft *); + uint64_t raft_get_log_length(const struct raft *); + bool raft_may_snapshot(const struct raft *); ++void raft_notify_snapshot_recommended(struct raft *); + struct ovsdb_error *raft_store_snapshot(struct raft *, + const struct json *new_snapshot) + OVS_WARN_UNUSED_RESULT; diff --git a/ovsdb/storage.c b/ovsdb/storage.c -index e26252b066..7b4ad16f60 100644 +index e26252b066..bd1fe0a33a 100644 --- a/ovsdb/storage.c +++ b/ovsdb/storage.c @@ -26,6 +26,7 @@ @@ -85323,6 +85375,51 @@ index e26252b066..7b4ad16f60 100644 void ovsdb_storage_run(struct ovsdb_storage *storage) { +@@ -499,14 +509,11 @@ ovsdb_storage_should_snapshot(const struct ovsdb_storage *storage) + return false; + } + +- /* If we can't snapshot right now, don't. */ +- if (storage->raft && !raft_may_snapshot(storage->raft)) { +- return false; +- } +- + uint64_t log_len = (storage->raft + ? raft_get_log_length(storage->raft) + : storage->n_read + storage->n_written); ++ bool snapshot_recommended = false; ++ + if (now < storage->next_snapshot_max) { + /* Maximum snapshot time not yet reached. Take a snapshot if there + * have been at least 100 log entries and the log file size has +@@ -514,12 +521,25 @@ ovsdb_storage_should_snapshot(const struct ovsdb_storage *storage) + bool grew_lots = (storage->raft + ? raft_grew_lots(storage->raft) + : ovsdb_log_grew_lots(storage->log)); +- return log_len >= 100 && grew_lots; ++ snapshot_recommended = (log_len >= 100 && grew_lots); + } else { + /* We have reached the maximum snapshot time. Take a snapshot if + * there have been any log entries at all. */ +- return log_len > 0; ++ snapshot_recommended = (log_len > 0); ++ } ++ ++ if (!snapshot_recommended) { ++ return false; ++ } ++ ++ /* If we can't snapshot right now, don't. */ ++ if (storage->raft && !raft_may_snapshot(storage->raft)) { ++ /* Notifying the storage that it needs to make a snapshot soon. */ ++ raft_notify_snapshot_recommended(storage->raft); ++ return false; + } ++ ++ return true; + } + + return false; diff --git a/ovsdb/storage.h b/ovsdb/storage.h index 8a9bbab709..a223968912 100644 --- a/ovsdb/storage.h @@ -89868,7 +89965,7 @@ index f2cc3f7f2a..fbe6e4f560 100755 def main(): diff --git a/utilities/ovs-ofctl.c b/utilities/ovs-ofctl.c -index 3601890f40..62059e962f 100644 +index 3601890f40..ede7f1e61a 100644 --- a/utilities/ovs-ofctl.c +++ b/utilities/ovs-ofctl.c @@ -4020,6 +4020,7 @@ ofctl_meter_mod__(const char *bridge, const char *str, int command) @@ -89903,6 +90000,15 @@ index 3601890f40..62059e962f 100644 } protocol = open_vconn_for_flow_mod(bridge, &vconn, usable_protocols); +@@ -5051,7 +5051,7 @@ static const struct ovs_cmdl_command all_commands[] = { + { "add-group", "switch group", + 1, 2, ofctl_add_group, OVS_RW }, + { "add-groups", "switch file", +- 1, 2, ofctl_add_groups, OVS_RW }, ++ 2, 2, ofctl_add_groups, OVS_RW }, + { "mod-group", "switch group", + 1, 2, ofctl_mod_group, OVS_RW }, + { "del-groups", "switch [group]", diff --git a/utilities/ovs-pipegen.py b/utilities/ovs-pipegen.py index ee5797221c..a3b6a661de 100755 --- a/utilities/ovs-pipegen.py diff --git a/SPECS/openvswitch2.13.spec b/SPECS/openvswitch2.13.spec index b40cf56..4cb13c9 100644 --- a/SPECS/openvswitch2.13.spec +++ b/SPECS/openvswitch2.13.spec @@ -59,7 +59,7 @@ Summary: Open vSwitch Group: System Environment/Daemons daemon/database/utilities URL: http://www.openvswitch.org/ Version: 2.13.0 -Release: 110%{?commit0:.%{date}git%{shortcommit0}}%{?commit1:dpdk%{shortcommit1}}%{?dist} +Release: 112%{?commit0:.%{date}git%{shortcommit0}}%{?commit1:dpdk%{shortcommit1}}%{?dist} # Nearly all of openvswitch is ASL 2.0. The bugtool is LGPLv2+, and the # lib/sflow*.[ch] files are SISSL @@ -710,6 +710,14 @@ exit 0 %endif %changelog +* Sat May 15 2021 Open vSwitch CI - 2.13.0-112 +- Merging upstream branch-2.13 + [3f4fc768f047a1072907df202826465863fb36e7] + +* Fri May 14 2021 Open vSwitch CI - 2.13.0-111 +- Merging upstream branch-2.13 + [5eca61ee5ecc569c1b4458826955523e4804647b] + * Wed May 12 2021 Open vSwitch CI - 2.13.0-110 - Merging upstream branch-2.13 [6022570f3ffe9e519fde26fdd8d52c175962f253]