From patchwork Tue Jun 30 01:24:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Maximets X-Patchwork-Id: 1319456 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ovn.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49wmrQ28snz9sRk for ; Tue, 30 Jun 2020 11:25:26 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 1A69A88847; Tue, 30 Jun 2020 01:25:24 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Uxp99LCbkvnN; Tue, 30 Jun 2020 01:25:19 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by whitealder.osuosl.org (Postfix) with ESMTP id 249A0884C2; Tue, 30 Jun 2020 01:25:19 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 049BAC07FF; Tue, 30 Jun 2020 01:25:19 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 9634EC0895 for ; Tue, 30 Jun 2020 01:25:17 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 8832D2107D for ; Tue, 30 Jun 2020 01:25:17 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SyvmsfhN45CO for ; Tue, 30 Jun 2020 01:25:16 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) by silver.osuosl.org (Postfix) with ESMTPS id 950AE21541 for ; Tue, 30 Jun 2020 01:25:16 +0000 (UTC) X-Originating-IP: 90.177.210.238 Received: from im-t490s.redhat.com (238.210.broadband10.iol.cz [90.177.210.238]) (Authenticated sender: i.maximets@ovn.org) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id 7BCFC40003; Tue, 30 Jun 2020 01:25:13 +0000 (UTC) From: Ilya Maximets To: ovs-dev@openvswitch.org Date: Tue, 30 Jun 2020 03:24:33 +0200 Message-Id: <20200630012435.205590-4-i.maximets@ovn.org> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20200630012435.205590-1-i.maximets@ovn.org> References: <20200630012435.205590-1-i.maximets@ovn.org> MIME-Version: 1.0 Cc: Han Zhou , Ilya Maximets Subject: [ovs-dev] [PATCH 3/5] ovsdb-server: Integrate stream replay engine. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" This change adds support of stream record/replay functionality to ovsdb-server. Since current replay engine doesn't work well with time-based events generated locally, it will work only with standalone databases for now (raft heavily depends on time). To use this functionality run: # record: ovsdb-server --sream-replay-record --predictable-uuids-with-seed=1234 <...> ovs-appctl -t ovsdb-server exit # replay: ovsdb-server --sream-replay --predictable-uuids-with-seed=1234 <...> At this point ovsdb-server should execute all the same commands and transactions. Since the last command was 'exit' via unixctl, ovsdb-server will exit in the end. Signed-off-by: Ilya Maximets --- ovsdb/ovsdb-server.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ovsdb/ovsdb-server.c b/ovsdb/ovsdb-server.c index 3af09c8c1..178fa6fa5 100644 --- a/ovsdb/ovsdb-server.c +++ b/ovsdb/ovsdb-server.c @@ -1716,6 +1716,7 @@ parse_options(int argc, char *argv[], VLOG_OPTION_ENUMS, DAEMON_OPTION_ENUMS, SSL_OPTION_ENUMS, + STREAM_REPLAY_OPTION_ENUMS, }; static const struct option long_options[] = { @@ -1731,6 +1732,7 @@ parse_options(int argc, char *argv[], {"bootstrap-ca-cert", required_argument, NULL, OPT_BOOTSTRAP_CA_CERT}, {"peer-ca-cert", required_argument, NULL, OPT_PEER_CA_CERT}, STREAM_SSL_LONG_OPTIONS, + STREAM_REPLAY_LONG_OPTIONS, {"sync-from", required_argument, NULL, OPT_SYNC_FROM}, {"sync-exclude-tables", required_argument, NULL, OPT_SYNC_EXCLUDE}, {"active", no_argument, NULL, OPT_ACTIVE}, @@ -1807,6 +1809,8 @@ parse_options(int argc, char *argv[], stream_ssl_set_peer_ca_cert_file(optarg); break; + STREAM_REPLAY_OPTION_HANDLERS + case OPT_SYNC_FROM: *sync_from = xstrdup(optarg); break; @@ -1868,7 +1872,7 @@ usage(void) program_name, program_name, ovs_dbdir()); printf("\nJSON-RPC options (may be specified any number of times):\n" " --remote=REMOTE connect or listen to REMOTE\n"); - stream_usage("JSON-RPC", true, true, true, false); + stream_usage("JSON-RPC", true, true, true, true); daemon_usage(); vlog_usage(); replication_usage();