From patchwork Tue Mar 17 08:28:04 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Huettner X-Patchwork-Id: 2211734 X-Patchwork-Delegate: i.maximets@samsung.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=digits.schwarz header.i=@digits.schwarz header.a=rsa-sha256 header.s=google header.b=WOFRL2WA; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::138; helo=smtp1.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4fZlTb2qJNz1xyt for ; Tue, 17 Mar 2026 19:28:19 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 5CFCF83E83; Tue, 17 Mar 2026 08:28:17 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id yaTKpFe_kT6h; Tue, 17 Mar 2026 08:28:16 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=2605:bc80:3010:104::8cd3:938; helo=lists.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org E9B4C83E14 Authentication-Results: smtp1.osuosl.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=digits.schwarz header.i=@digits.schwarz header.a=rsa-sha256 header.s=google header.b=WOFRL2WA Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp1.osuosl.org (Postfix) with ESMTPS id E9B4C83E14; Tue, 17 Mar 2026 08:28:15 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id C7397C03FD; Tue, 17 Mar 2026 08:28:15 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 75A65C03FC for ; Tue, 17 Mar 2026 08:28:14 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 54C8C83E73 for ; Tue, 17 Mar 2026 08:28:14 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id FJuimNwFI3OX for ; Tue, 17 Mar 2026 08:28:13 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2a00:1450:4864:20::164; helo=mail-lf1-x164.google.com; envelope-from=felix.huettner@digits.schwarz; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp1.osuosl.org 8E83483E14 Authentication-Results: smtp1.osuosl.org; dmarc=pass (p=reject dis=none) header.from=digits.schwarz DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 8E83483E14 Received: from mail-lf1-x164.google.com (mail-lf1-x164.google.com [IPv6:2a00:1450:4864:20::164]) by smtp1.osuosl.org (Postfix) with ESMTPS id 8E83483E14 for ; Tue, 17 Mar 2026 08:28:11 +0000 (UTC) Received: by mail-lf1-x164.google.com with SMTP id 2adb3069b0e04-5a0fc5e2c59so6169215e87.1 for ; Tue, 17 Mar 2026 01:28:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=digits.schwarz; s=google; t=1773736089; x=1774340889; darn=openvswitch.org; h=mime-version:mail-followup-to:message-id:subject:to:from:date:from :to:cc:subject:date:message-id:reply-to; bh=m4eiTEbGpwpvbasmdSSmNzEf1X3KkIQ1vbjnQCiCSDc=; b=WOFRL2WA8dQV/mwNlanXmCKV3J17fv34BgKFJYO5qPGPmK4Zrn8Z+TztIZHxJfL0eR 767cZbjYkdU58s3xzLceat063CWOS93SmF65ydM8js9qZBAYYz8mY1Nz5XZXvauUKpCP l+w1+OMpdzCmBX/wmw0KYbHfHrPzl7k1at1O9oIyOQfhXrFsLOS7uKRKj5jPJnlrZ/SN dhDjODrNX5XKBOINIRd2v0JabyfRnoYXQBKZ5WbCIuSWRQEgKSNg3XrSs1SVNJCbovMJ /OwRU3NyRIGmEA7flIpFJ2T6QBFCM61BMFzcHU5OWZyZFJFuWdRmpgT9A2GSO1V6LqZM /Kww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773736089; x=1774340889; h=mime-version:mail-followup-to:message-id:subject:to:from:date :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=m4eiTEbGpwpvbasmdSSmNzEf1X3KkIQ1vbjnQCiCSDc=; b=J+LZZpnr3vGCgfFmjrIN9xkh9vlQtkCKEWwhpgpXmiYruCUskpGuTKjgJ2vXn9eLSs AdXmor5j5ycCWO9ZaxpexkRBjXtcN69PdtHPc/zMK8JsZEuvKeHdoraTfzJXpZIgIv3R brvh2LfMGOW6nIII0w/v/EwAQpklgZ5wWsZAvD+lxrUySA0sFRMizaQiuQirX3RfvRKi ypXZ0GJklnbDY1r9Fpnizt/kmy8nTqojXlJB7mTLvWM1grWV4mikO/0Wzq82bbPmH6Vn QCybVG3Oq8qiO0JUJRpr1wVwUOqgz8hD7HSSTgyS7oaiKQcc6KrxbxxkMNkNJnjfumJl mKxg== X-Gm-Message-State: AOJu0YxiV0KDWcvd8Utxihak7OYranl45YWEIetvClm4qsnM7EwA27j4 eM2y0PBHxM4gVCe9RkpGhJeFGkgQftLNfSDmaOjxeQO+l7vK5uXxXtPVicaSPHOXp+lIe1sxcij CjYub/vTvska7w1SFQSJ+8nfPJpWuyXZTu0XCnxr4IjBoNQ4B59kgza1+mDL49XvPO2Cx2gWoFi sPpzjCNCyn6X/nSTbuvRHkswl7I4Ljv+D1O7pZJKuw883h4qhGkg/2RcSzytpg/5Xy9KSUmB0Iu R5o157HnDhc7dR8rqE= X-Gm-Gg: ATEYQzzMONrN4Yd51rCbgvrbYjJ2fApZWJOf0m1h+0GwzoBxjIcunOfTbmiy4p46xTd KlF2N8Kp1+NZ+gmlQYC9Fy0J9hiQWCYSup5g1P/TwXkZM2ndiPN16li8aD4o7LCn11tp4TLsokX MsdTDj3dFkD2Q2lW4JFvkI59bUUjX22sKI2JBsnBba2qwKVW4vBoz+OuDoCNKH/WkZ3ElAXrzfJ DJc2P/6c2MqCZg8E3I+8gnM/SAlEC11c2I3pdSjhwXHXCDdZKMwfj5PB07IPbA8YIib8/YyD63T 4IGCgpFwiT8eGQzD6mPTf8MSSOHrGejX9DyeORZ1bP2XiR3uc3Ar2dGrMx/Jh6kj+WZdrcn9La0 gBBovfUXxqxe8RT9A14DW8pGO1jgrXuwf1UIeT6yCUBIsjsFEYTk8F6oZfQx3K1APvPGzSVOS4F uPfCnyl2HsV/tkQSNadNXs3w== X-Received: by 2002:a05:6512:3414:b0:59e:57d2:75f0 with SMTP id 2adb3069b0e04-5a162afe136mr5924304e87.32.1773736089096; Tue, 17 Mar 2026 01:28:09 -0700 (PDT) Received: from smtpproxy-deployment-54667c4795-6v7gj.de2.smtp.exclaimer.net ([20.113.217.22]) by smtp-relay.gmail.com with ESMTPS id 2adb3069b0e04-5a155f35bdasm1452819e87.18.2026.03.17.01.28.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 17 Mar 2026 01:28:09 -0700 (PDT) X-Relaying-Domain: digits.schwarz Received: from mail-wm1-f72.google.com (209.85.128.72) by smtpproxy-deployment-54667c4795-6v7gj.de2.smtp.exclaimer.net (20.113.217.16/28) with Exclaimer Signature Manager ESMTP Proxy smtpproxy-deployment-54667c4795-6v7gj.de2.smtp.exclaimer.net (tlsversion=TLS12, tlscipher=TLS_DIFFIEHELLMAN_WITH_AES256_NONE); Tue, 17 Mar 2026 08:28:09 +0000 X-ExclaimerHostedSignatures-MessageProcessed: true X-ExclaimerProxyLatency: 10754936 X-ExclaimerImprintLatency: 5720088 X-ExclaimerImprintAction: e0a51001af2c41f8bb0e71d66bc83a5d Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-485390246c8so45299585e9.0 for ; Tue, 17 Mar 2026 01:28:07 -0700 (PDT) X-Received: by 2002:a05:600c:6912:b0:485:4eaf:eb54 with SMTP id 5b1f17b1804b1-485566fcb3cmr255950045e9.20.1773736086833; Tue, 17 Mar 2026 01:28:06 -0700 (PDT) X-Received: by 2002:a05:600c:6912:b0:485:4eaf:eb54 with SMTP id 5b1f17b1804b1-485566fcb3cmr255949485e9.20.1773736086102; Tue, 17 Mar 2026 01:28:06 -0700 (PDT) Received: from SDGDEU-G5041VBR ([185.124.194.86]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-439fe2186e3sm54821367f8f.26.2026.03.17.01.28.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Mar 2026 01:28:05 -0700 (PDT) Date: Tue, 17 Mar 2026 09:28:04 +0100 To: dev@openvswitch.org Message-ID: Mail-Followup-To: dev@openvswitch.org MIME-Version: 1.0 X-please-dont-add-a-signature: thanks X-Schwarz-Google-ToExclaimerByDomain: 1 Content-Disposition: inline X-Content-Filtered-By: Mailman/MimeDel 2.1.30 Subject: [ovs-dev] [PATCH v2 1/2] ovsdb: Support custom transaction history size. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Felix Huettner via dev From: Felix Huettner Reply-To: Felix Huettner Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Previously the transaction history was hard limited to 100 entries. However in fast changing environments (e.g. with 20 transactions/sec) this means that transactions are only in the history for a few seconds. If now a client reconnects and tries to use monitor_cond_since it has only a short timeframe where this will reliably work. We make the history limit configurable here so that use can choose the speed vs memory tradeoff as needed. We still keep the limit based on size of the history, as syncing a history larger than the actual database size does not make sense in any way. Signed-off-by: Felix Huettner --- v1->v2: handle setting if the config does not specify the service-model. ovsdb/ovsdb-server.c | 29 +++++++++++++++++++++++++++-- ovsdb/ovsdb.h | 1 + ovsdb/relay.c | 4 ++-- ovsdb/transaction.c | 33 +++++++++++++++++++++++++++++++-- ovsdb/transaction.h | 5 ++++- tests/ovsdb-server.at | 22 +++++++++++++++++++++- 6 files changed, 86 insertions(+), 8 deletions(-) base-commit: a8b0e4cab94f57bc414b20b4af43c7c5a800cf6c diff --git a/ovsdb/ovsdb-server.c b/ovsdb/ovsdb-server.c index 7c3a5ef11..7d8562cb2 100644 --- a/ovsdb/ovsdb-server.c +++ b/ovsdb/ovsdb-server.c @@ -156,6 +156,11 @@ struct db_config { bool backup; /* If true, the database is read-only and receives * updates from the 'source'. */ } ab; + + /* Valid for SM_CLUSTERED or SM_RELAY. */ + unsigned int n_txn_history_max; /* The maximum amount of history entries + * to keep. 0 means default. */ + }; struct db { @@ -462,6 +467,7 @@ db_config_clone(const struct db_config *c) conf->options = ovsdb_jsonrpc_options_clone(c->options); } conf->ab.sync_exclude = nullable_xstrdup(c->ab.sync_exclude); + conf->n_txn_history_max = c->n_txn_history_max; return conf; } @@ -572,6 +578,12 @@ database_update_config(struct server_config *server_config, replication_set_db(db->db, conf->source, conf->ab.sync_exclude, server_uuid, &conf->options->rpc); } + + if ((conf->model == SM_CLUSTERED || conf->model == SM_RELAY) && + conf->n_txn_history_max) { + ovsdb_txn_history_update(db->db, conf->n_txn_history_max); + + } } static bool @@ -1180,7 +1192,8 @@ open_db(struct server_config *server_config, /* Enable txn history for clustered and relay modes. It is not enabled for * other modes for now, since txn id is available for clustered and relay * modes only. */ - ovsdb_txn_history_init(db->db, model == SM_RELAY || model == SM_CLUSTERED); + ovsdb_txn_history_init(db->db, model == SM_RELAY || model == SM_CLUSTERED, + conf->n_txn_history_max); read_db(server_config, db); @@ -2889,6 +2902,12 @@ db_config_to_json(const struct db_config *conf) } json_object_put(json, "backup", json_boolean_create(conf->ab.backup)); } + + if (conf->n_txn_history_max) { + json_object_put(json, "transaction-history-limit", + json_integer_create(conf->n_txn_history_max)); + } + return json; } @@ -3012,7 +3031,7 @@ remotes_from_json(struct shash *remotes, const struct json *json) static struct db_config * db_config_from_json(const char *name, const struct json *json) { - const struct json *model, *source, *sync_exclude, *backup; + const struct json *model, *source, *sync_exclude, *backup, *txn_limit; struct db_config *conf = xzalloc(sizeof *conf); struct ovsdb_parser parser; struct ovsdb_error *error; @@ -3093,6 +3112,12 @@ db_config_from_json(const char *name, const struct json *json) } } + txn_limit = ovsdb_parser_member(&parser, "transaction-history-limit", + OP_INTEGER | OP_OPTIONAL); + if (txn_limit) { + conf->n_txn_history_max = json_integer(txn_limit); + } + error = ovsdb_parser_finish(&parser); if (error) { char *s = ovsdb_error_to_string_free(error); diff --git a/ovsdb/ovsdb.h b/ovsdb/ovsdb.h index 325900bc6..a6a65dc1b 100644 --- a/ovsdb/ovsdb.h +++ b/ovsdb/ovsdb.h @@ -110,6 +110,7 @@ struct ovsdb { bool need_txn_history; /* Need to maintain history of transactions. */ unsigned int n_txn_history; /* Current number of history transactions. */ unsigned int n_txn_history_atoms; /* Total number of atoms in history. */ + unsigned int n_txn_history_max; /* The maximum history length. */ struct ovs_list txn_history; /* Contains "struct ovsdb_txn_history_node. */ size_t n_atoms; /* Total number of ovsdb atoms in the database. */ diff --git a/ovsdb/relay.c b/ovsdb/relay.c index a5e1a5f3a..7691e0b73 100644 --- a/ovsdb/relay.c +++ b/ovsdb/relay.c @@ -274,7 +274,7 @@ exit: /* The relay source doesn't support unique transaction ids, * disabling transaction history for relay. */ ovsdb_txn_history_destroy(db); - ovsdb_txn_history_init(db, false); + ovsdb_txn_history_init(db, false, 0); } else { ovsdb_txn_set_txnid(last_id, txn); } @@ -307,7 +307,7 @@ ovsdb_relay_clear(struct ovsdb *db) /* Clearing the transaction history, and re-enabling it. */ ovsdb_txn_history_destroy(db); - ovsdb_txn_history_init(db, true); + ovsdb_txn_history_init(db, true, db->n_txn_history_max); return error; } diff --git a/ovsdb/transaction.c b/ovsdb/transaction.c index 0d0d27b61..7ebb8245f 100644 --- a/ovsdb/transaction.c +++ b/ovsdb/transaction.c @@ -18,6 +18,7 @@ #include "transaction.h" #include "bitmap.h" +#include "coverage.h" #include "openvswitch/dynamic-string.h" #include "file.h" #include "hash.h" @@ -37,6 +38,9 @@ #include "util.h" VLOG_DEFINE_THIS_MODULE(transaction); +COVERAGE_DEFINE(transaction_history_add); + +#define TRANSACTION_HISTORY_LIMIT_DEFAULT 100 struct ovsdb_txn { struct ovsdb *db; @@ -1192,6 +1196,7 @@ ovsdb_txn_add_to_history(struct ovsdb_txn *txn) ovs_list_push_back(&txn->db->txn_history, &node->node); txn->db->n_txn_history++; txn->db->n_txn_history_atoms += txn->n_atoms; + COVERAGE_INC(transaction_history_add); } } @@ -1686,7 +1691,7 @@ ovsdb_txn_history_run(struct ovsdb *db) * Keeping at least one transaction to avoid sending UUID_ZERO as a last id * if all entries got removed due to the size limit. */ while (db->n_txn_history > 1 && - (db->n_txn_history > 100 || + (db->n_txn_history > db->n_txn_history_max || db->n_txn_history_atoms > db->n_atoms)) { struct ovsdb_txn_history_node *txn_h_node = CONTAINER_OF( ovs_list_pop_front(&db->txn_history), @@ -1700,11 +1705,20 @@ ovsdb_txn_history_run(struct ovsdb *db) } void -ovsdb_txn_history_init(struct ovsdb *db, bool need_txn_history) +ovsdb_txn_history_init(struct ovsdb *db, bool need_txn_history, + unsigned int n_txn_history_max) { db->need_txn_history = need_txn_history; db->n_txn_history = 0; db->n_txn_history_atoms = 0; + db->n_txn_history_max = n_txn_history_max != 0 ? n_txn_history_max : + TRANSACTION_HISTORY_LIMIT_DEFAULT; + if (db->need_txn_history && db->n_txn_history_max < 2) { + VLOG_WARN("transaction history needed, but limit too low. " + "%u < 2. Setting it to 2.", + n_txn_history_max); + db->n_txn_history_max = 2; + } ovs_list_init(&db->txn_history); } @@ -1725,3 +1739,18 @@ ovsdb_txn_history_destroy(struct ovsdb *db) db->n_txn_history = 0; db->n_txn_history_atoms = 0; } + +void +ovsdb_txn_history_update(struct ovsdb *db, unsigned int n_txn_history_max) +{ + db->n_txn_history_max = n_txn_history_max != 0 ? n_txn_history_max : + TRANSACTION_HISTORY_LIMIT_DEFAULT; + if (db->need_txn_history && db->n_txn_history_max < 2) { + VLOG_WARN("transaction history needed, but limit too low. " + "%u < 2. Setting it to 2.", + n_txn_history_max); + db->n_txn_history_max = 2; + } + + ovsdb_txn_history_run(db); +} diff --git a/ovsdb/transaction.h b/ovsdb/transaction.h index d94205414..04f96f079 100644 --- a/ovsdb/transaction.h +++ b/ovsdb/transaction.h @@ -75,7 +75,10 @@ struct ovsdb_row *ovsdb_index_search(struct hmap *index, void ovsdb_txn_add_comment(struct ovsdb_txn *, const char *); const char *ovsdb_txn_get_comment(const struct ovsdb_txn *); void ovsdb_txn_history_run(struct ovsdb *); -void ovsdb_txn_history_init(struct ovsdb *, bool need_txn_history); +void ovsdb_txn_history_init(struct ovsdb *, bool need_txn_history, + unsigned int n_txn_history_max); void ovsdb_txn_history_destroy(struct ovsdb *); +void ovsdb_txn_history_update(struct ovsdb *db, + unsigned int n_txn_history_max); #endif /* ovsdb/transaction.h */ diff --git a/tests/ovsdb-server.at b/tests/ovsdb-server.at index d9389e12f..921339dfa 100644 --- a/tests/ovsdb-server.at +++ b/tests/ovsdb-server.at @@ -1937,7 +1937,8 @@ m4_define([OVSDB_CHECK_EXECUTION_RELAY], \"databases\": { \"${schema_name}\": { \"service-model\": \"relay\", - \"source\": { \"unix:db$((i-1)).sock\": {} } + \"source\": { \"unix:db$((i-1)).sock\": {} }, + \"transaction-history-limit\": 1234 } } }" > config${i}.json @@ -3108,6 +3109,25 @@ WARN|syntax "{"dscp":42,"inactivity-probe":10000,"max-backoff":8000,"role":"My-R syntax error: Parsing JSON-RPC options failed: Member 'role' is present but not allowed here. ]) +TEST_CONFIG_FILE([relay with transaction-history-limit], [ +{ + "remotes": { "punix:db.sock": {} }, + "databases": { + "RelaySchema": { + "service-model": "relay", + "source": { + "punix:db2.sock": { + "inactivity-probe": 10000, + "max-backoff": 8000, + "dscp": 42 + } + }, + "transaction-history-limit": 1000 + } + } +} +], [0]) + TEST_CONFIG_FILE([unknown config], [ { "remotes": { "punix:db.sock": {} }, From patchwork Tue Mar 17 08:28:11 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Huettner X-Patchwork-Id: 2211735 X-Patchwork-Delegate: i.maximets@samsung.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=digits.schwarz header.i=@digits.schwarz header.a=rsa-sha256 header.s=google header.b=s90vaHyi; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::137; helo=smtp4.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4fZlTk2XCwz1xyt for ; Tue, 17 Mar 2026 19:28:26 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id EC5B0415DB; Tue, 17 Mar 2026 08:28:22 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id dYPM7CIEqTvk; Tue, 17 Mar 2026 08:28:21 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.9.56; helo=lists.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org D4B2E415CB Authentication-Results: smtp4.osuosl.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=digits.schwarz header.i=@digits.schwarz header.a=rsa-sha256 header.s=google header.b=s90vaHyi Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp4.osuosl.org (Postfix) with ESMTPS id D4B2E415CB; Tue, 17 Mar 2026 08:28:21 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 96CC0C03FD; Tue, 17 Mar 2026 08:28:21 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 00793C03FC for ; Tue, 17 Mar 2026 08:28:20 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id DAEA340BE8 for ; Tue, 17 Mar 2026 08:28:19 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 9iKVWD6-nxVP for ; Tue, 17 Mar 2026 08:28:19 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2a00:1450:4864:20::363; helo=mail-wm1-x363.google.com; envelope-from=felix.huettner@digits.schwarz; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp2.osuosl.org D5DFF40BE3 Authentication-Results: smtp2.osuosl.org; dmarc=pass (p=reject dis=none) header.from=digits.schwarz DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org D5DFF40BE3 Authentication-Results: smtp2.osuosl.org; dkim=pass (2048-bit key) header.d=digits.schwarz header.i=@digits.schwarz header.a=rsa-sha256 header.s=google header.b=s90vaHyi Received: from mail-wm1-x363.google.com (mail-wm1-x363.google.com [IPv6:2a00:1450:4864:20::363]) by smtp2.osuosl.org (Postfix) with ESMTPS id D5DFF40BE3 for ; Tue, 17 Mar 2026 08:28:18 +0000 (UTC) Received: by mail-wm1-x363.google.com with SMTP id 5b1f17b1804b1-48539d21b76so38472575e9.1 for ; Tue, 17 Mar 2026 01:28:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=digits.schwarz; s=google; t=1773736096; x=1774340896; darn=openvswitch.org; h=in-reply-to:mime-version:references:mail-followup-to:message-id :subject:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=9B/VbP/3drQp0XWJRBwKu9r+PR97jU10grijmNhZaMA=; b=s90vaHyioAR0UnNIe0dG73q8YD8cHyrCUINOgEwt7dIPTAkFYKbi9hFGIynUALnC+1 k5J9iSI4tfaeQfAy/Orii3r9b24jnVVJlelmWq3hABk7CBH6GNbBDxdRQiK38NTEF59F OCJbxFDiYJ9ylJE8S/odLsya23Xx8rVTIV/pYriZn98VeR95nxW80nokxN8GBJjW79iN hFs5SfVVUSPTDdOsJF1r6Scy/p/AtXNGRHnG75GYvPgRsLlCgKojubXNuMAgaHJy7Cp9 biGUiQpYPAHTY7y/01KhROS1UT+K314c6Eii7rIJrsRP8L1Wso1H93eE5+W+9sXzCkOw iQ/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773736096; x=1774340896; h=in-reply-to:mime-version:references:mail-followup-to:message-id :subject:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=9B/VbP/3drQp0XWJRBwKu9r+PR97jU10grijmNhZaMA=; b=baBSrUNMLsat3Q+i9A+XsZAOUZKwK6FqhmUDXMzWRidHLHD4SYADR/scJ4E9/5q0dY mW9jDF5zNcS8sNmifophLDCtJXSMLpQHYJN0xxKia//AI2Q+Bf6EOr5N2p2X+9pWDtNY uSCFbHpLg8JMytEgkqizvRBVhaMyb60Z35R7vsOnB0ITcI0o3+ueR4XjHvoQXUd5P+jx rj2/KbQfoVUlmYPzzLq9i6vVuyQtoieX6+J0Smbl3ykSOZIGej4gqkdXxGBVNg85GStl 5bVF3z293O2bYF01sfgvSDBS7s1yqJOSKO6L+BiuTi0ajSe3qvMl/m95M840jTjxFBdM ORYw== X-Gm-Message-State: AOJu0YxDf9s7z9MLKxxXPsxqD4FdIVjxEnZfc+ITLOu0S9DZBgjvGV2l aeNCCDSGsf2ljDFIVzyuNQsZI52vS6JqEXxiykF6jgZ6c8klR2qI/KpRpjZlMkYbU11sbeCVE6v qnHBAaNo0IT+G76uwUXHhw1xHPvkbr1UIlePI+dvv0YnzZm1ZNtSzna7CMaVVhtBfpBWUkFlCda hBRGG0oSZz/1PGjaLBivjjWsjOBMHZ1d3E4dCS/QKTSnI5MWCayJfRaCFceMwarh91wCtsCt/1m ia8FbJVEcDixzZu4rc= X-Gm-Gg: ATEYQzyNMU4TGn+6nE+eYLuIho/zj8h3qV2esRQyHlW/DyVzZFuoKgOFe0j9u+O/XcQ CG0NZjVjvuWUffRHKMP1wK5i0Vne+Bi9HfiUQKzKg/q8E7W2UUqaavsgHemftweaxxd7XSt+531 VD+ZaVGoF1HGzwVyMAWwS01Ni9f0tW0pgW2PVNP2TJaYgUvvGWPHixb1eQnPXlKuo8Mx74HGxuH 7YE3I/AR9MhveQJmAyxKRwE2GuExMu/Bp+6UDm2q2nF0eSWas6220gdRSILxs1NlJ1Km84dVsWe pxJNM0qeGYM6IQ43yiBh00QQwZwrQSsXSfVQ9gj2InQqVlT7VnShsAuabbqKMTgnrgEGarrA368 JruXxYLas68O8zUpPwYzpmppcG6+tRdORkfB7+pZhKBa6rrsKovZNpbui3pwxS2Wn34A795n6U/ X21oGtCCmnT0gxfdvZ7LrL0g== X-Received: by 2002:a05:600c:a46:b0:480:4d38:7abc with SMTP id 5b1f17b1804b1-485566d6ec5mr274009105e9.11.1773736096057; Tue, 17 Mar 2026 01:28:16 -0700 (PDT) Received: from smtpproxy-deployment-54667c4795-s9snf.de2.smtp.exclaimer.net ([20.113.217.16]) by smtp-relay.gmail.com with ESMTPS id 5b1f17b1804b1-4856eacbdcfsm1317715e9.16.2026.03.17.01.28.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 17 Mar 2026 01:28:16 -0700 (PDT) X-Relaying-Domain: digits.schwarz Received: from mail-wm1-f72.google.com (209.85.128.72) by smtpproxy-deployment-54667c4795-s9snf.de2.smtp.exclaimer.net (20.113.217.16/28) with Exclaimer Signature Manager ESMTP Proxy smtpproxy-deployment-54667c4795-s9snf.de2.smtp.exclaimer.net (tlsversion=TLS12, tlscipher=TLS_DIFFIEHELLMAN_WITH_AES256_NONE); Tue, 17 Mar 2026 08:28:15 +0000 X-ExclaimerHostedSignatures-MessageProcessed: true X-ExclaimerProxyLatency: 5808286 X-ExclaimerImprintLatency: 3106772 X-ExclaimerImprintAction: 9d3df541aafa4db9a047fb2a2af2be12 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-485375aa56eso39065335e9.1 for ; Tue, 17 Mar 2026 01:28:15 -0700 (PDT) X-Received: by 2002:a05:600c:8b46:b0:485:557d:9fe with SMTP id 5b1f17b1804b1-485566d6e3emr266011825e9.12.1773736094473; Tue, 17 Mar 2026 01:28:14 -0700 (PDT) X-Received: by 2002:a05:600c:8b46:b0:485:557d:9fe with SMTP id 5b1f17b1804b1-485566d6e3emr266011215e9.12.1773736093828; Tue, 17 Mar 2026 01:28:13 -0700 (PDT) Received: from SDGDEU-G5041VBR ([185.124.194.86]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4856eaeca12sm95524735e9.12.2026.03.17.01.28.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Mar 2026 01:28:13 -0700 (PDT) Date: Tue, 17 Mar 2026 09:28:11 +0100 To: dev@openvswitch.org Message-ID: <2e943333189533bd6844a9ea5a506e8cce324c10.1773736007.git.felix.huettner@digits.schwarz> Mail-Followup-To: dev@openvswitch.org References: MIME-Version: 1.0 In-Reply-To: X-please-dont-add-a-signature: thanks X-Schwarz-Google-ToExclaimerByDomain: 1 Content-Disposition: inline X-Content-Filtered-By: Mailman/MimeDel 2.1.30 Subject: [ovs-dev] [PATCH v2 2/2] ovsdb-cs: Add coverage for updates. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Felix Huettner via dev From: Felix Huettner Reply-To: Felix Huettner Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" This allows us to figure out how often we receive updates from upstream dbs. In addition we can see e.g. during a reconnection if we did clear the database (e.g. because monitor_cond_since did not work). Signed-off-by: Felix Huettner --- lib/ovsdb-cs.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/ovsdb-cs.c b/lib/ovsdb-cs.c index df33a835d..0f0f88ef7 100644 --- a/lib/ovsdb-cs.c +++ b/lib/ovsdb-cs.c @@ -20,6 +20,7 @@ #include +#include "coverage.h" #include "hash.h" #include "jsonrpc.h" #include "openvswitch/dynamic-string.h" @@ -38,6 +39,9 @@ #include "uuid.h" VLOG_DEFINE_THIS_MODULE(ovsdb_cs); +COVERAGE_DEFINE(ovsdb_cs_update); +COVERAGE_DEFINE(ovsdb_cs_update_with_clear); +COVERAGE_DEFINE(ovsdb_cs_update_from_monitor); /* Connection state machine. * @@ -1568,6 +1572,14 @@ ovsdb_cs_db_add_update(struct ovsdb_cs_db *db, const struct json *table_updates, int version, bool clear, bool monitor_reply) { + COVERAGE_INC(ovsdb_cs_update); + if (clear) { + COVERAGE_INC(ovsdb_cs_update_with_clear); + } + if (monitor_reply) { + COVERAGE_INC(ovsdb_cs_update_from_monitor); + } + struct ovsdb_cs_event *event = ovsdb_cs_db_add_event( db, OVSDB_CS_EVENT_TYPE_UPDATE); event->update = (struct ovsdb_cs_update_event) {