From patchwork Fri Apr 2 15:48:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dumitru Ceara X-Patchwork-Id: 1461776 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=2605:bc80:3010::136; helo=smtp3.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Ks32cuVt; dkim-atps=neutral Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FBkxG0Lgxz9sRK for ; Sat, 3 Apr 2021 02:48:49 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id DDA5860769; Fri, 2 Apr 2021 15:48:47 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id z4O_3PGOHYA2; Fri, 2 Apr 2021 15:48:46 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp3.osuosl.org (Postfix) with ESMTP id 9A722605FF; Fri, 2 Apr 2021 15:48:45 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 73C9BC000C; Fri, 2 Apr 2021 15:48:45 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) by lists.linuxfoundation.org (Postfix) with ESMTP id B9DCCC000A for ; Fri, 2 Apr 2021 15:48:43 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id A96F140663 for ; Fri, 2 Apr 2021 15:48:43 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp2.osuosl.org (amavisd-new); dkim=pass (1024-bit key) header.d=redhat.com Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id YTD8IdJg8SCp for ; Fri, 2 Apr 2021 15:48:42 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by smtp2.osuosl.org (Postfix) with ESMTPS id 8072840216 for ; Fri, 2 Apr 2021 15:48:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617378521; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gutUPjL/JS59uP266yjz//aqsbAldjoi/GnSg9Kz848=; b=Ks32cuVt7ww/xmv10Ygb4M4h/bgO0uWmCEmDm9n/KGFm3CuH99/HhORw69DbIiBq+0q8bK aEB0sQwNINMsIeqbSQSBdKrxV2zZo4GKagqkY/6gjhHVjJCYwhNnJtHouBEQzRd3Bj2ghf SEmmwIQwAVrsFviN740Jl0lU7Gs6PcI= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-470-m7vWCzEiPy65AcsXyavRPw-1; Fri, 02 Apr 2021 11:48:39 -0400 X-MC-Unique: m7vWCzEiPy65AcsXyavRPw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9A7945138; Fri, 2 Apr 2021 15:48:38 +0000 (UTC) Received: from dceara.remote.csb (ovpn-112-193.ams2.redhat.com [10.36.112.193]) by smtp.corp.redhat.com (Postfix) with ESMTP id 730F85D9DC; Fri, 2 Apr 2021 15:48:34 +0000 (UTC) From: Dumitru Ceara To: dev@openvswitch.org Date: Fri, 2 Apr 2021 17:48:32 +0200 Message-Id: <20210402154829.7879.90114.stgit@dceara.remote.csb> In-Reply-To: <20210402154605.7879.66878.stgit@dceara.remote.csb> References: <20210402154605.7879.66878.stgit@dceara.remote.csb> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dceara@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Cc: i.maximets@ovn.org, dceara@redhat.com Subject: [ovs-dev] [PATCH branch-2.13 1/4] test-ovsdb: Log steps in idl test. 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" From: Ben Pfaff Until now, "test-ovsdb idl" has printed the steps that it goes through to stdout. This commit also makes it log the same information. This makes it easier to match up the steps with the rest of the log (in particular with the jsonrpc logging). Signed-off-by: Ben Pfaff Acked-by: Ilya Maximets (cherry picked from commit 81f06e2b8f2d46ed40bef33e502f988afc703e64) Signed-off-by: Dumitru Ceara --- tests/test-ovsdb.c | 266 +++++++++++++++++++++++++++------------------------- 1 file changed, 137 insertions(+), 129 deletions(-) diff --git a/tests/test-ovsdb.c b/tests/test-ovsdb.c index 31513c537f..15433e3472 100644 --- a/tests/test-ovsdb.c +++ b/tests/test-ovsdb.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -52,6 +53,8 @@ #include "util.h" #include "openvswitch/vlog.h" +VLOG_DEFINE_THIS_MODULE(test_ovsdb); + struct test_ovsdb_pvt_context { bool track; }; @@ -1844,194 +1847,191 @@ compare_link1(const void *a_, const void *b_) return a->i < b->i ? -1 : a->i > b->i; } +static void OVS_PRINTF_FORMAT(1, 2) +print_and_log(const char *format, ...) +{ + va_list args; + va_start(args, format); + char *message = xvasprintf(format, args); + va_end(args); + + printf("%s\n", message); + VLOG_INFO("%s", message); + + free(message); +} + static void print_idl_row_updated_simple(const struct idltest_simple *s, int step) { - size_t i; - bool updated = false; - - for (i = 0; i < IDLTEST_SIMPLE_N_COLUMNS; i++) { + struct ds updates = DS_EMPTY_INITIALIZER; + for (size_t i = 0; i < IDLTEST_SIMPLE_N_COLUMNS; i++) { if (idltest_simple_is_updated(s, i)) { - if (!updated) { - printf("%03d: updated columns:", step); - updated = true; - } - printf(" %s", idltest_simple_columns[i].name); + ds_put_format(&updates, " %s", idltest_simple_columns[i].name); } } - if (updated) { - printf("\n"); + if (updates.length) { + print_and_log("%03d: updated columns:%s", step, ds_cstr(&updates)); + ds_destroy(&updates); } } static void print_idl_row_updated_link1(const struct idltest_link1 *l1, int step) { - size_t i; - bool updated = false; - - for (i = 0; i < IDLTEST_LINK1_N_COLUMNS; i++) { + struct ds updates = DS_EMPTY_INITIALIZER; + for (size_t i = 0; i < IDLTEST_LINK1_N_COLUMNS; i++) { if (idltest_link1_is_updated(l1, i)) { - if (!updated) { - printf("%03d: updated columns:", step); - updated = true; - } - printf(" %s", idltest_link1_columns[i].name); + ds_put_format(&updates, " %s", idltest_link1_columns[i].name); } } - if (updated) { - printf("\n"); + if (updates.length) { + print_and_log("%03d: updated columns:%s", step, ds_cstr(&updates)); + ds_destroy(&updates); } } static void print_idl_row_updated_link2(const struct idltest_link2 *l2, int step) { - size_t i; - bool updated = false; - - for (i = 0; i < IDLTEST_LINK2_N_COLUMNS; i++) { + struct ds updates = DS_EMPTY_INITIALIZER; + for (size_t i = 0; i < IDLTEST_LINK2_N_COLUMNS; i++) { if (idltest_link2_is_updated(l2, i)) { - if (!updated) { - printf("%03d: updated columns:", step); - updated = true; - } - printf(" %s", idltest_link2_columns[i].name); + ds_put_format(&updates, " %s", idltest_link2_columns[i].name); } } - if (updated) { - printf("\n"); + if (updates.length) { + print_and_log("%03d: updated columns:%s", step, ds_cstr(&updates)); + ds_destroy(&updates); } } static void print_idl_row_updated_simple6(const struct idltest_simple6 *s6, int step) { - size_t i; - bool updated = false; - - for (i = 0; i < IDLTEST_SIMPLE6_N_COLUMNS; i++) { + struct ds updates = DS_EMPTY_INITIALIZER; + for (size_t i = 0; i < IDLTEST_SIMPLE6_N_COLUMNS; i++) { if (idltest_simple6_is_updated(s6, i)) { - if (!updated) { - printf("%03d: updated columns:", step); - updated = true; - } - printf(" %s", idltest_simple6_columns[i].name); + ds_put_format(&updates, " %s", idltest_simple6_columns[i].name); } } - if (updated) { - printf("\n"); + if (updates.length) { + print_and_log("%03d: updated columns:%s", step, ds_cstr(&updates)); + ds_destroy(&updates); } } static void print_idl_row_updated_singleton(const struct idltest_singleton *sng, int step) { - size_t i; - bool updated = false; - - for (i = 0; i < IDLTEST_SINGLETON_N_COLUMNS; i++) { + struct ds updates = DS_EMPTY_INITIALIZER; + for (size_t i = 0; i < IDLTEST_SINGLETON_N_COLUMNS; i++) { if (idltest_singleton_is_updated(sng, i)) { - if (!updated) { - printf("%03d: updated columns:", step); - updated = true; - } - printf(" %s", idltest_singleton_columns[i].name); + ds_put_format(&updates, " %s", idltest_singleton_columns[i].name); } } - if (updated) { - printf("\n"); + if (updates.length) { + print_and_log("%03d: updated columns:%s", step, ds_cstr(&updates)); + ds_destroy(&updates); } } static void print_idl_row_simple(const struct idltest_simple *s, int step) { - size_t i; - - printf("%03d: i=%"PRId64" r=%g b=%s s=%s u="UUID_FMT" ia=[", - step, s->i, s->r, s->b ? "true" : "false", - s->s, UUID_ARGS(&s->u)); - for (i = 0; i < s->n_ia; i++) { - printf("%s%"PRId64, i ? " " : "", s->ia[i]); + struct ds msg = DS_EMPTY_INITIALIZER; + ds_put_format(&msg, "%03d: i=%"PRId64" r=%g b=%s s=%s u="UUID_FMT" ia=[", + step, s->i, s->r, s->b ? "true" : "false", + s->s, UUID_ARGS(&s->u)); + for (size_t i = 0; i < s->n_ia; i++) { + ds_put_format(&msg, "%s%"PRId64, i ? " " : "", s->ia[i]); } - printf("] ra=["); - for (i = 0; i < s->n_ra; i++) { - printf("%s%g", i ? " " : "", s->ra[i]); + ds_put_cstr(&msg, "] ra=["); + for (size_t i = 0; i < s->n_ra; i++) { + ds_put_format(&msg, "%s%g", i ? " " : "", s->ra[i]); } - printf("] ba=["); - for (i = 0; i < s->n_ba; i++) { - printf("%s%s", i ? " " : "", s->ba[i] ? "true" : "false"); + ds_put_cstr(&msg, "] ba=["); + for (size_t i = 0; i < s->n_ba; i++) { + ds_put_format(&msg, "%s%s", i ? " " : "", s->ba[i] ? "true" : "false"); } - printf("] sa=["); - for (i = 0; i < s->n_sa; i++) { - printf("%s%s", i ? " " : "", s->sa[i]); + ds_put_cstr(&msg, "] sa=["); + for (size_t i = 0; i < s->n_sa; i++) { + ds_put_format(&msg, "%s%s", i ? " " : "", s->sa[i]); } - printf("] ua=["); - for (i = 0; i < s->n_ua; i++) { - printf("%s"UUID_FMT, i ? " " : "", UUID_ARGS(&s->ua[i])); + ds_put_cstr(&msg, "] ua=["); + for (size_t i = 0; i < s->n_ua; i++) { + ds_put_format(&msg, "%s"UUID_FMT, i ? " " : "", UUID_ARGS(&s->ua[i])); } - printf("] uuid="UUID_FMT"\n", UUID_ARGS(&s->header_.uuid)); + ds_put_format(&msg, "] uuid="UUID_FMT, UUID_ARGS(&s->header_.uuid)); + print_and_log("%s", ds_cstr(&msg)); + ds_destroy(&msg); + print_idl_row_updated_simple(s, step); } static void print_idl_row_link1(const struct idltest_link1 *l1, int step) { - struct idltest_link1 **links; - size_t i; - - printf("%03d: i=%"PRId64" k=", step, l1->i); + struct ds msg = DS_EMPTY_INITIALIZER; + ds_put_format(&msg, "%03d: i=%"PRId64" k=", step, l1->i); if (l1->k) { - printf("%"PRId64, l1->k->i); + ds_put_format(&msg, "%"PRId64, l1->k->i); } - printf(" ka=["); - links = xmemdup(l1->ka, l1->n_ka * sizeof *l1->ka); + ds_put_cstr(&msg, " ka=["); + struct idltest_link1 **links = xmemdup(l1->ka, l1->n_ka * sizeof *l1->ka); qsort(links, l1->n_ka, sizeof *links, compare_link1); - for (i = 0; i < l1->n_ka; i++) { - printf("%s%"PRId64, i ? " " : "", links[i]->i); + for (size_t i = 0; i < l1->n_ka; i++) { + ds_put_format(&msg, "%s%"PRId64, i ? " " : "", links[i]->i); } free(links); - printf("] l2="); + ds_put_cstr(&msg, "] l2="); if (l1->l2) { - printf("%"PRId64, l1->l2->i); + ds_put_format(&msg, "%"PRId64, l1->l2->i); } - printf(" uuid="UUID_FMT"\n", UUID_ARGS(&l1->header_.uuid)); + ds_put_format(&msg, " uuid="UUID_FMT, UUID_ARGS(&l1->header_.uuid)); + print_and_log("%s", ds_cstr(&msg)); + ds_destroy(&msg); + print_idl_row_updated_link1(l1, step); } static void print_idl_row_link2(const struct idltest_link2 *l2, int step) { - printf("%03d: i=%"PRId64" l1=", step, l2->i); + struct ds msg = DS_EMPTY_INITIALIZER; + ds_put_format(&msg, "%03d: i=%"PRId64" l1=", step, l2->i); if (l2->l1) { - printf("%"PRId64, l2->l1->i); + ds_put_format(&msg, "%"PRId64, l2->l1->i); } - printf(" uuid="UUID_FMT"\n", UUID_ARGS(&l2->header_.uuid)); + ds_put_format(&msg, " uuid="UUID_FMT, UUID_ARGS(&l2->header_.uuid)); + print_and_log("%s", ds_cstr(&msg)); + ds_destroy(&msg); + print_idl_row_updated_link2(l2, step); } static void print_idl_row_simple6(const struct idltest_simple6 *s6, int step) { - int i; - - printf("%03d: name=%s ", step, s6->name); - printf("weak_ref=["); - for (i = 0; i < s6->n_weak_ref; i++) { - printf("%s"UUID_FMT, i ? " " : "", - UUID_ARGS(&s6->weak_ref[i]->header_.uuid)); + struct ds msg = DS_EMPTY_INITIALIZER; + ds_put_format(&msg, "%03d: name=%s ", step, s6->name); + ds_put_cstr(&msg, "weak_ref=["); + for (size_t i = 0; i < s6->n_weak_ref; i++) { + ds_put_format(&msg, "%s"UUID_FMT, i ? " " : "", + UUID_ARGS(&s6->weak_ref[i]->header_.uuid)); } + ds_put_format(&msg, "] uuid="UUID_FMT, UUID_ARGS(&s6->header_.uuid)); + print_and_log("%s", ds_cstr(&msg)); + ds_destroy(&msg); - printf("] uuid="UUID_FMT"\n", UUID_ARGS(&s6->header_.uuid)); print_idl_row_updated_simple6(s6, step); } static void print_idl_row_singleton(const struct idltest_singleton *sng, int step) { - printf("%03d: name=%s", step, sng->name); - printf(" uuid="UUID_FMT"\n", UUID_ARGS(&sng->header_.uuid)); + print_and_log("%03d: name=%s uuid="UUID_FMT, step, sng->name, + UUID_ARGS(&sng->header_.uuid)); print_idl_row_updated_singleton(sng, step); } @@ -2061,7 +2061,7 @@ print_idl(struct ovsdb_idl *idl, int step) n++; } if (!n) { - printf("%03d: empty\n", step); + print_and_log("%03d: empty", step); } } @@ -2077,36 +2077,36 @@ print_idl_track(struct ovsdb_idl *idl, int step) IDLTEST_SIMPLE_FOR_EACH_TRACKED (s, idl) { print_idl_row_simple(s, step); if (idltest_simple_is_deleted(s)) { - printf("%03d: deleted row: uuid="UUID_FMT"\n", step, - UUID_ARGS(&s->header_.uuid)); + print_and_log("%03d: deleted row: uuid="UUID_FMT, step, + UUID_ARGS(&s->header_.uuid)); } else if (idltest_simple_is_new(s)) { - printf("%03d: inserted row: uuid="UUID_FMT"\n", step, - UUID_ARGS(&s->header_.uuid)); + print_and_log("%03d: inserted row: uuid="UUID_FMT, step, + UUID_ARGS(&s->header_.uuid)); } n++; } IDLTEST_LINK1_FOR_EACH_TRACKED (l1, idl) { if (idltest_link1_is_deleted(l1)) { - printf("%03d: deleted row: uuid="UUID_FMT"\n", step, - UUID_ARGS(&l1->header_.uuid)); + print_and_log("%03d: deleted row: uuid="UUID_FMT, step, + UUID_ARGS(&l1->header_.uuid)); } else { print_idl_row_link1(l1, step); if (idltest_link1_is_new(l1)) { - printf("%03d: inserted row: uuid="UUID_FMT"\n", step, - UUID_ARGS(&l1->header_.uuid)); + print_and_log("%03d: inserted row: uuid="UUID_FMT, step, + UUID_ARGS(&l1->header_.uuid)); } } n++; } IDLTEST_LINK2_FOR_EACH_TRACKED (l2, idl) { if (idltest_link2_is_deleted(l2)) { - printf("%03d: deleted row: uuid="UUID_FMT"\n", step, - UUID_ARGS(&l2->header_.uuid)); + print_and_log("%03d: deleted row: uuid="UUID_FMT, step, + UUID_ARGS(&l2->header_.uuid)); } else { print_idl_row_link2(l2, step); if (idltest_link2_is_new(l2)) { - printf("%03d: inserted row: uuid="UUID_FMT"\n", step, - UUID_ARGS(&l2->header_.uuid)); + print_and_log("%03d: inserted row: uuid="UUID_FMT, step, + UUID_ARGS(&l2->header_.uuid)); } } @@ -2115,17 +2115,17 @@ print_idl_track(struct ovsdb_idl *idl, int step) IDLTEST_SIMPLE6_FOR_EACH_TRACKED (s6, idl) { print_idl_row_simple6(s6, step); if (idltest_simple6_is_deleted(s6)) { - printf("%03d: deleted row: uuid="UUID_FMT"\n", step, + print_and_log("%03d: deleted row: uuid="UUID_FMT, step, UUID_ARGS(&s6->header_.uuid)); } else if (idltest_simple6_is_new(s6)) { - printf("%03d: inserted row: uuid="UUID_FMT"\n", step, - UUID_ARGS(&s6->header_.uuid)); + print_and_log("%03d: inserted row: uuid="UUID_FMT, step, + UUID_ARGS(&s6->header_.uuid)); } n++; } if (!n) { - printf("%03d: empty\n", step); + print_and_log("%03d: empty", step); } } @@ -2314,7 +2314,7 @@ idl_set(struct ovsdb_idl *idl, char *commands, int step) ovsdb_idl_check_consistency(idl); break; } else if (!strcmp(name, "destroy")) { - printf("%03d: destroy\n", step); + print_and_log("%03d: destroy", step); ovsdb_idl_txn_destroy(txn); ovsdb_idl_check_consistency(idl); return; @@ -2325,13 +2325,17 @@ idl_set(struct ovsdb_idl *idl, char *commands, int step) } status = ovsdb_idl_txn_commit_block(txn); - printf("%03d: commit, status=%s", - step, ovsdb_idl_txn_status_to_string(status)); + + struct ds s = DS_EMPTY_INITIALIZER; + ds_put_format(&s, "%03d: commit, status=%s", + step, ovsdb_idl_txn_status_to_string(status)); if (increment) { - printf(", increment=%"PRId64, - ovsdb_idl_txn_get_increment_new_value(txn)); + ds_put_format(&s, ", increment=%"PRId64, + ovsdb_idl_txn_get_increment_new_value(txn)); } - putchar('\n'); + print_and_log("%s", ds_cstr(&s)); + ds_destroy(&s); + ovsdb_idl_txn_destroy(txn); ovsdb_idl_check_consistency(idl); } @@ -2505,7 +2509,7 @@ do_idl(struct ovs_cmdl_context *ctx) const char cond_s[] = "condition "; if (ctx->argc > 2 && strstr(ctx->argv[2], cond_s)) { update_conditions(idl, ctx->argv[2] + strlen(cond_s)); - printf("%03d: change conditions\n", step++); + print_and_log("%03d: change conditions", step++); i = 3; } else { i = 2; @@ -2543,11 +2547,11 @@ do_idl(struct ovs_cmdl_context *ctx) seqno = ovsdb_idl_get_seqno(idl); if (!strcmp(arg, "reconnect")) { - printf("%03d: reconnect\n", step++); + print_and_log("%03d: reconnect", step++); ovsdb_idl_force_reconnect(idl); } else if (!strncmp(arg, cond_s, strlen(cond_s))) { update_conditions(idl, arg + strlen(cond_s)); - printf("%03d: change conditions\n", step++); + print_and_log("%03d: change conditions", step++); } else if (arg[0] != '[') { idl_set(idl, arg, step++); } else { @@ -2558,13 +2562,17 @@ do_idl(struct ovs_cmdl_context *ctx) if (error || reply->error) { ovs_fatal(error, "jsonrpc transaction failed"); } - printf("%03d: ", step++); if (reply->result) { parse_uuids(reply->result, symtab, &n_uuids); } json_destroy(reply->id); reply->id = NULL; - print_and_free_json(jsonrpc_msg_to_json(reply)); + + struct json *msg_json = jsonrpc_msg_to_json(reply); + char *msg_s = json_to_string(msg_json, JSSF_SORT); + json_destroy(msg_json); + print_and_log("%03d: %s", step++, msg_s); + free(msg_s); } } ovsdb_symbol_table_destroy(symtab); @@ -2584,7 +2592,7 @@ do_idl(struct ovs_cmdl_context *ctx) print_idl(idl, step++); ovsdb_idl_track_clear(idl); ovsdb_idl_destroy(idl); - printf("%03d: done\n", step); + print_and_log("%03d: done", step); } static void From patchwork Fri Apr 2 15:48:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dumitru Ceara X-Patchwork-Id: 1461777 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.133; helo=smtp2.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=DnZcbGV5; dkim-atps=neutral Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FBkxj552pz9sRK for ; Sat, 3 Apr 2021 02:49:13 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 7B59140685; Fri, 2 Apr 2021 15:49:11 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id A1Vu_ndRE4bL; Fri, 2 Apr 2021 15:49:08 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp2.osuosl.org (Postfix) with ESMTP id 708D640670; Fri, 2 Apr 2021 15:49:07 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 44393C0011; Fri, 2 Apr 2021 15:49:07 +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 14693C000A for ; Fri, 2 Apr 2021 15:49:06 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id B0CB984C62 for ; Fri, 2 Apr 2021 15:49:01 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp1.osuosl.org (amavisd-new); dkim=pass (1024-bit key) header.d=redhat.com Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ciAJKOzxGOpp for ; Fri, 2 Apr 2021 15:48:58 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by smtp1.osuosl.org (Postfix) with ESMTPS id 241A784C63 for ; Fri, 2 Apr 2021 15:48:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617378537; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AzuOCBZ9QaTnmmFEtzSFvyeCaxLLRxfetZFwXmBW+sU=; b=DnZcbGV5/B+CTbOUN2OJ/wc8ML5+B7690j0o5JX9xTRzrGZhby+lABDF6xI018xlLZH7NE 36KZn49+hiD+x5ymLBvo+u7Ba3ZaYy930c7aD3wfcnfhAr5LodjTwsdxN7n1ogozLZ2KbP zlu9A1f1IJ48d9cQm0zvfVyeo20Z4Lo= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-408-kYEzrAPuNBexT72rps62wQ-1; Fri, 02 Apr 2021 11:48:54 -0400 X-MC-Unique: kYEzrAPuNBexT72rps62wQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4AAD25135; Fri, 2 Apr 2021 15:48:53 +0000 (UTC) Received: from dceara.remote.csb (ovpn-112-193.ams2.redhat.com [10.36.112.193]) by smtp.corp.redhat.com (Postfix) with ESMTP id 96FF35D9DC; Fri, 2 Apr 2021 15:48:50 +0000 (UTC) From: Dumitru Ceara To: dev@openvswitch.org Date: Fri, 2 Apr 2021 17:48:48 +0200 Message-Id: <20210402154844.7879.91364.stgit@dceara.remote.csb> In-Reply-To: <20210402154605.7879.66878.stgit@dceara.remote.csb> References: <20210402154605.7879.66878.stgit@dceara.remote.csb> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dceara@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Cc: i.maximets@ovn.org, dceara@redhat.com Subject: [ovs-dev] [PATCH branch-2.13 2/4] ovsdb-idl.at: Make test outputs more predictable. 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" 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 Acked-by: Han Zhou Signed-off-by: Ilya Maximets (cherry picked from commit 4c0d093b17e8610e92891abad879484b7fbbd716) --- lib/ovsdb-idl.c | 3 lib/ovsdb-idl.h | 2 tests/ovsdb-cluster.at | 2 tests/ovsdb-idl.at | 471 +++++++++++++++++++++++------------------------- tests/test-ovsdb.c | 186 +++++++++++-------- tests/test-ovsdb.py | 91 +++++---- 6 files changed, 396 insertions(+), 359 deletions(-) diff --git a/lib/ovsdb-idl.c b/lib/ovsdb-idl.c index 1ff9b2bb75..ef2fb4c2fc 100644 --- a/lib/ovsdb-idl.c +++ b/lib/ovsdb-idl.c @@ -383,7 +383,6 @@ ovsdb_idl_db_table_from_class(const struct ovsdb_idl_db *, static struct ovsdb_idl_table * ovsdb_idl_table_from_class(const struct ovsdb_idl *, const struct ovsdb_idl_table_class *); -static bool ovsdb_idl_track_is_set(struct ovsdb_idl_table *table); static void ovsdb_idl_send_cond_change(struct ovsdb_idl *idl); static void ovsdb_idl_destroy_indexes(struct ovsdb_idl_table *); @@ -1859,7 +1858,7 @@ ovsdb_idl_track_add_all(struct ovsdb_idl *idl) } /* Returns true if 'table' has any tracked column. */ -static bool +bool ovsdb_idl_track_is_set(struct ovsdb_idl_table *table) { size_t i; diff --git a/lib/ovsdb-idl.h b/lib/ovsdb-idl.h index 9f12ce3206..6ad6d3a54e 100644 --- a/lib/ovsdb-idl.h +++ b/lib/ovsdb-idl.h @@ -53,6 +53,7 @@ struct ovsdb_datum; struct ovsdb_idl_class; struct ovsdb_idl_row; struct ovsdb_idl_column; +struct ovsdb_idl_table; struct ovsdb_idl_table_class; struct uuid; @@ -217,6 +218,7 @@ unsigned int ovsdb_idl_row_get_seqno( void ovsdb_idl_track_add_column(struct ovsdb_idl *idl, const struct ovsdb_idl_column *column); void ovsdb_idl_track_add_all(struct ovsdb_idl *idl); +bool ovsdb_idl_track_is_set(struct ovsdb_idl_table *table); const struct ovsdb_idl_row *ovsdb_idl_track_get_first( const struct ovsdb_idl *, const struct ovsdb_idl_table_class *); const struct ovsdb_idl_row *ovsdb_idl_track_get_next(const struct ovsdb_idl_row *); diff --git a/tests/ovsdb-cluster.at b/tests/ovsdb-cluster.at index 92aa427093..cf43e9cf86 100644 --- a/tests/ovsdb-cluster.at +++ b/tests/ovsdb-cluster.at @@ -128,7 +128,7 @@ ovsdb_test_cluster_disconnect () { "rows": [{"i": 1}]}]]' > test-ovsdb.log 2>&1 & echo $! > test-ovsdb.pid - OVS_WAIT_UNTIL([grep "000: i=1" test-ovsdb.log]) + OVS_WAIT_UNTIL([grep "000: table simple: i=1" test-ovsdb.log]) # Start collecting raft_is_connected logs for $target before shutting down # any servers. diff --git a/tests/ovsdb-idl.at b/tests/ovsdb-idl.at index d0feaa31fe..20db5442ba 100644 --- a/tests/ovsdb-idl.at +++ b/tests/ovsdb-idl.at @@ -355,28 +355,28 @@ OVSDB_CHECK_IDL([simple idl, initially empty, various ops], 'reconnect']], [[000: empty 001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]}]} -002: i=0 r=0 b=false s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> -002: i=1 r=2 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0> +002: table simple: i=0 r=0 b=false s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> +002: table simple: i=1 r=2 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0> 003: {"error":null,"result":[{"count":2}]} -004: i=0 r=0 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> -004: i=1 r=2 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0> +004: table simple: i=0 r=0 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> +004: table simple: i=1 r=2 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0> 005: {"error":null,"result":[{"count":2}]} -006: i=0 r=123.5 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> -006: i=1 r=123.5 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0> +006: table simple: i=0 r=123.5 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> +006: table simple: i=1 r=123.5 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0> 007: {"error":null,"result":[{"uuid":["uuid","<6>"]}]} -008: i=-1 r=125 b=false s= u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> -008: i=0 r=123.5 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> -008: i=1 r=123.5 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0> +008: table simple: i=-1 r=125 b=false s= u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> +008: table simple: i=0 r=123.5 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> +008: table simple: i=1 r=123.5 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0> 009: {"error":null,"result":[{"count":2}]} -010: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> -010: i=0 r=123.5 b=true s=newstring u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> -010: i=1 r=123.5 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0> +010: table simple: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> +010: table simple: i=0 r=123.5 b=true s=newstring u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> +010: table simple: i=1 r=123.5 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0> 011: {"error":null,"result":[{"count":1}]} -012: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> -012: i=1 r=123.5 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0> +012: table simple: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> +012: table simple: i=1 r=123.5 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0> 013: reconnect -014: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> -014: i=1 r=123.5 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0> +014: table simple: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> +014: table simple: i=1 r=123.5 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0> 015: done ]]) @@ -403,11 +403,11 @@ OVSDB_CHECK_IDL([simple idl, initially populated], "table": "simple", "where": [], "row": {"b": true}}]']], - [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> -000: i=1 r=2 b=true s=mystring u=<2> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<3> <4>] uuid=<5> + [[000: table simple: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> +000: table simple: i=1 r=2 b=true s=mystring u=<2> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<3> <4>] uuid=<5> 001: {"error":null,"result":[{"count":2}]} -002: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> -002: i=1 r=2 b=true s=mystring u=<2> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<3> <4>] uuid=<5> +002: table simple: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> +002: table simple: i=1 r=2 b=true s=mystring u=<2> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<3> <4>] uuid=<5> 003: done ]]) @@ -431,14 +431,14 @@ OVSDB_CHECK_IDL([simple idl, writing via IDL], "row": {}}]']], [['verify 0 b, verify 1 r, set 0 b 1, set 1 r 3.5' \ 'insert 2, verify 2 i, verify 1 b, delete 1']], - [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> -000: i=1 r=2 b=true s=mystring u=<2> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<3> <4>] uuid=<5> + [[000: table simple: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> +000: table simple: i=1 r=2 b=true s=mystring u=<2> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<3> <4>] uuid=<5> 001: commit, status=success -002: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> -002: i=1 r=3.5 b=true s=mystring u=<2> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<3> <4>] uuid=<5> +002: table simple: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> +002: table simple: i=1 r=3.5 b=true s=mystring u=<2> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<3> <4>] uuid=<5> 003: commit, status=success -004: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> -004: i=2 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<6> +004: table simple: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> +004: table simple: i=2 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<6> 005: done ]]) @@ -448,10 +448,10 @@ OVSDB_CHECK_IDL([simple idl, writing via IDL with unicode], "table": "simple", "row": {"s": "(╯°□°)╯︵ ┻━┻"}}]']], [['set 0 b 1, insert 1, set 1 s "¯\_(ツ)_/¯"']], - [[000: i=0 r=0 b=false s=(╯°□°)╯︵ ┻━┻ u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> + [[000: table simple: i=0 r=0 b=false s=(╯°□°)╯︵ ┻━┻ u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> 001: commit, status=success -002: i=0 r=0 b=true s=(╯°□°)╯︵ ┻━┻ u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> -002: i=1 r=0 b=false s="¯\_(ツ)_/¯" u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2> +002: table simple: i=0 r=0 b=true s=(╯°□°)╯︵ ┻━┻ u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> +002: table simple: i=1 r=0 b=false s="¯\_(ツ)_/¯" u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2> 003: done ]]) @@ -475,10 +475,10 @@ OVSDB_CHECK_IDL_PY_WITH_EXPOUT([simple idl, writing large data via IDL with unic "table": "simple", "row": {"s": "'$(printf "测试超过四千零九十六个字节的中文字符串以使解码出现问题。%.0s" {1..50})'"}}]']], [['set 0 b 1, insert 1, set 1 s '$(printf "测试超过四千零九十六个字节的中文字符串以使解码出现问题。%.0s" {1..100})'']], - [[000: i=0 r=0 b=false s=$(printf "测试超过四千零九十六个字节的中文字符串以使解码出现问题。%.0s" {1..50}) u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> + [[000: table simple: i=0 r=0 b=false s=$(printf "测试超过四千零九十六个字节的中文字符串以使解码出现问题。%.0s" {1..50}) u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> 001: commit, status=success -002: i=0 r=0 b=true s=$(printf "测试超过四千零九十六个字节的中文字符串以使解码出现问题。%.0s" {1..50}) u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> -002: i=1 r=0 b=false s=$(printf "测试超过四千零九十六个字节的中文字符串以使解码出现问题。%.0s" {1..100}) u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2> +002: table simple: i=0 r=0 b=true s=$(printf "测试超过四千零九十六个字节的中文字符串以使解码出现问题。%.0s" {1..50}) u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> +002: table simple: i=1 r=0 b=false s=$(printf "测试超过四千零九十六个字节的中文字符串以使解码出现问题。%.0s" {1..100}) u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2> 003: done]]) OVSDB_CHECK_IDL([simple idl, handling verification failure], @@ -499,16 +499,16 @@ OVSDB_CHECK_IDL([simple idl, handling verification failure], '+verify 1 r, set 1 r 3' \ 'verify 1 r, set 1 r 3' \ ]], - [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> -000: i=1 r=2 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2> + [[000: table simple: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> +000: table simple: i=1 r=2 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2> 001: commit, status=success 002: {"error":null,"result":[{"count":1}]} 003: commit, status=try again -004: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> -004: i=1 r=5 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2> +004: table simple: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> +004: table simple: i=1 r=5 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2> 005: commit, status=success -006: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> -006: i=1 r=3 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2> +006: table simple: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> +006: table simple: i=1 r=3 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2> 007: done ]]) @@ -518,9 +518,9 @@ OVSDB_CHECK_IDL([simple idl, increment operation], "table": "simple", "row": {}}]']], [['set 0 r 2.0, increment 0']], - [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> + [[000: table simple: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> 001: commit, status=success, increment=1 -002: i=1 r=2 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> +002: table simple: i=1 r=2 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> 003: done ]]) @@ -531,10 +531,10 @@ OVSDB_CHECK_IDL([simple idl, aborting], "row": {}}]']], [['set 0 r 2.0, abort' \ '+set 0 b 1']], - [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> + [[000: table simple: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> 001: commit, status=aborted 002: commit, status=success -003: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> +003: table simple: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> 004: done ]]) @@ -545,10 +545,10 @@ OVSDB_CHECK_IDL([simple idl, destroy without commit or abort], "row": {}}]']], [['set 0 r 2.0, destroy' \ '+set 0 b 1']], - [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> + [[000: table simple: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> 001: destroy 002: commit, status=success -003: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> +003: table simple: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> 004: done ]]) @@ -564,7 +564,7 @@ OVSDB_CHECK_IDL([simple idl, conditional, false condition], [[000: change conditions 001: empty 002: change conditions -003: i=1 r=2 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> +003: table simple: i=1 r=2 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> 004: done ]]) @@ -580,7 +580,7 @@ OVSDB_CHECK_IDL([simple idl, conditional, true condition], [[000: change conditions 001: empty 002: change conditions -003: i=1 r=2 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> +003: table simple: i=1 r=2 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> 004: done ]]) @@ -601,8 +601,8 @@ OVSDB_CHECK_IDL([simple idl, conditional, multiple clauses in condition], [[000: change conditions 001: empty 002: change conditions -003: i=1 r=2 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> -003: i=2 r=3 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2> +003: table simple: i=1 r=2 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> +003: table simple: i=2 r=3 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2> 004: done ]]) @@ -618,7 +618,7 @@ OVSDB_CHECK_IDL([simple idl, conditional, modify as insert due to condition], [[000: change conditions 001: empty 002: change conditions -003: i=1 r=2 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> +003: table simple: i=1 r=2 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> 004: done ]]) @@ -641,11 +641,11 @@ OVSDB_CHECK_IDL([simple idl, conditional, modify as delete due to condition], [[000: change conditions 001: empty 002: change conditions -003: i=1 r=2 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> +003: table simple: i=1 r=2 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> 004: change conditions 005: empty 006: {"error":null,"result":[{"uuid":["uuid","<2>"]}]} -007: i=2 r=3 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2> +007: table simple: i=2 r=3 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2> 008: done ]]) @@ -676,15 +676,15 @@ OVSDB_CHECK_IDL([simple idl, conditional, multiple tables], [[000: change conditions 001: empty 002: change conditions -003: i=1 r=2 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> +003: table simple: i=1 r=2 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> 004: change conditions -005: i=0 k=0 ka=[] l2= uuid=<2> -005: i=1 r=2 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> +005: table link1: i=0 k=0 ka=[] l2= uuid=<2> +005: table simple: i=1 r=2 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> 006: change conditions 007: {"error":null,"result":[{"uuid":["uuid","<3>"]}]} -008: i=0 k=0 ka=[] l2= uuid=<2> -008: i=1 r=2 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> -008: i=3 l1= uuid=<3> +008: table link1: i=0 k=0 ka=[] l2= uuid=<2> +008: table link2: i=3 l1= uuid=<3> +008: table simple: i=1 r=2 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> 009: done ]]) @@ -716,19 +716,19 @@ OVSDB_CHECK_IDL([self-linking idl, consistent ops], "row": {"k": ["uuid", "#0#"]}}]']], [[000: empty 001: {"error":null,"result":[{"uuid":["uuid","<0>"]}]} -002: i=0 k=0 ka=[] l2= uuid=<0> +002: table link1: i=0 k=0 ka=[] l2= uuid=<0> 003: {"error":null,"result":[{"uuid":["uuid","<1>"]},{"uuid":["uuid","<2>"]}]} -004: i=0 k=0 ka=[] l2= uuid=<0> -004: i=1 k=2 ka=[] l2= uuid=<1> -004: i=2 k=1 ka=[] l2= uuid=<2> +004: table link1: i=0 k=0 ka=[] l2= uuid=<0> +004: table link1: i=1 k=2 ka=[] l2= uuid=<1> +004: table link1: i=2 k=1 ka=[] l2= uuid=<2> 005: {"error":null,"result":[{"count":1}]} -006: i=0 k=0 ka=[] l2= uuid=<0> -006: i=1 k=1 ka=[] l2= uuid=<1> -006: i=2 k=1 ka=[] l2= uuid=<2> +006: table link1: i=0 k=0 ka=[] l2= uuid=<0> +006: table link1: i=1 k=1 ka=[] l2= uuid=<1> +006: table link1: i=2 k=1 ka=[] l2= uuid=<2> 007: {"error":null,"result":[{"count":3}]} -008: i=0 k=0 ka=[] l2= uuid=<0> -008: i=1 k=0 ka=[] l2= uuid=<1> -008: i=2 k=0 ka=[] l2= uuid=<2> +008: table link1: i=0 k=0 ka=[] l2= uuid=<0> +008: table link1: i=1 k=0 ka=[] l2= uuid=<1> +008: table link1: i=2 k=0 ka=[] l2= uuid=<2> 009: done ]]) @@ -767,12 +767,12 @@ OVSDB_CHECK_IDL([self-linking idl, inconsistent ops], [[000: empty 001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"details":"Table link1 column k row <0> references nonexistent row <1> in table link1.","error":"referential integrity violation"}]} 002: {"error":null,"result":[{"uuid":["uuid","<2>"]},{"uuid":["uuid","<3>"]}]} -003: i=1 k=1 ka=[] l2= uuid=<2> -003: i=2 k=1 ka=[] l2= uuid=<3> +003: table link1: i=1 k=1 ka=[] l2= uuid=<2> +003: table link1: i=2 k=1 ka=[] l2= uuid=<3> 004: {"error":null,"result":[{"count":2},{"details":"Table link1 column k row references nonexistent row <4> in table link1.","error":"referential integrity violation"}]} 005: {"error":null,"result":[{"count":1},{"details":"cannot delete link1 row <2> because of 1 remaining reference(s)","error":"referential integrity violation"}]} 006: {"error":null,"result":[{"count":1}]} -007: i=1 k=1 ka=[] l2= uuid=<2> +007: table link1: i=1 k=1 ka=[] l2= uuid=<2> 008: {"error":null,"result":[{"count":1}]} 009: empty 010: done @@ -815,15 +815,15 @@ OVSDB_CHECK_IDL([self-linking idl, sets], "where": []}]']], [[000: empty 001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]},{"uuid":["uuid","<2>"]},{"uuid":["uuid","<3>"]}]} -002: i=0 k=0 ka=[0] l2= uuid=<0> -002: i=1 k=0 ka=[1] l2= uuid=<1> -002: i=2 k=0 ka=[2] l2= uuid=<2> -002: i=3 k=0 ka=[3] l2= uuid=<3> +002: table link1: i=0 k=0 ka=[0] l2= uuid=<0> +002: table link1: i=1 k=0 ka=[1] l2= uuid=<1> +002: table link1: i=2 k=0 ka=[2] l2= uuid=<2> +002: table link1: i=3 k=0 ka=[3] l2= uuid=<3> 003: {"error":null,"result":[{"count":4}]} -004: i=0 k=0 ka=[0 1 2 3] l2= uuid=<0> -004: i=1 k=0 ka=[0 1 2 3] l2= uuid=<1> -004: i=2 k=0 ka=[0 1 2 3] l2= uuid=<2> -004: i=3 k=0 ka=[0 1 2 3] l2= uuid=<3> +004: table link1: i=0 k=0 ka=[0 1 2 3] l2= uuid=<0> +004: table link1: i=1 k=0 ka=[0 1 2 3] l2= uuid=<1> +004: table link1: i=2 k=0 ka=[0 1 2 3] l2= uuid=<2> +004: table link1: i=3 k=0 ka=[0 1 2 3] l2= uuid=<3> 005: {"error":null,"result":[{"count":1},{"details":"Table link1 column ka row <2> references nonexistent row <4> in table link1.","error":"referential integrity violation"}]} 006: {"error":null,"result":[{"count":4}]} 007: empty @@ -843,8 +843,8 @@ OVSDB_CHECK_IDL([external-linking idl, consistent ops], "uuid-name": "row1"}]']], [[000: empty 001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]}]} -002: i=0 l1= uuid=<0> -002: i=1 k=1 ka=[] l2=0 uuid=<1> +002: table link1: i=1 k=1 ka=[] l2=0 uuid=<1> +002: table link2: i=0 l1= uuid=<0> 003: done ]]) @@ -867,10 +867,10 @@ OVSDB_CHECK_IDL([singleton idl, constraints], "row": {"name": "bar"}}]']], [[000: empty 001: {"error":null,"result":[{"uuid":["uuid","<0>"]}]} -002: name=foo uuid=<0> +002: table singleton: name=foo uuid=<0> 003: {"error":null,"result":[{"uuid":["uuid","<1>"]},{"details":"transaction causes \"singleton\" table to contain 2 rows, greater than the schema-defined limit of 1 row(s)","error":"constraint violation"}]} 004: {"error":null,"result":[{"count":1},{"uuid":["uuid","<2>"]}]} -005: name=bar uuid=<2> +005: table singleton: name=bar uuid=<2> 006: done ]]) @@ -879,8 +879,8 @@ OVSDB_CHECK_IDL_PY([external-linking idl, insert ops], [['linktest']], [[000: empty 001: commit, status=success -002: i=1 k=1 ka=[1] l2= uuid=<0> -002: i=2 k=1 ka=[1 2] l2= uuid=<1> +002: table link1: i=1 k=1 ka=[1] l2= uuid=<0> +002: table link1: i=2 k=1 ka=[1 2] l2= uuid=<1> 003: done ]]) @@ -889,7 +889,7 @@ OVSDB_CHECK_IDL_PY([getattr idl, insert ops], [['getattrtest']], [[000: empty 001: commit, status=success -002: i=2 k=2 ka=[] l2= uuid=<0> +002: table link1: i=2 k=2 ka=[] l2= uuid=<0> 003: done ]]) @@ -902,11 +902,11 @@ OVSDB_CHECK_IDL_PY([row-from-json idl, whats this], "table": "simple", "row": {}}]']], [['notifytest insert 2, notifytest set 1 b 1, notifytest delete 0']], - [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> -000: i=1 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2> + [[000: table simple: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> +000: table simple: i=1 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2> 001: commit, status=success, events=create|2|None, delete|0|None, update|1|b -002: i=1 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2> -002: i=2 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<3> +002: table simple: i=1 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2> +002: table simple: i=2 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<3> 003: done ]]) @@ -946,19 +946,19 @@ AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 idl uni AT_CHECK([sort stdout | uuidfilt], [0], [[000: empty 001: {"error":null,"result":[{"uuid":["uuid","<0>"]}]} -002: i=0 k=0 ka=[] l2= uuid=<0> +002: table link1: i=0 k=0 ka=[] l2= uuid=<0> 003: {"error":null,"result":[{"uuid":["uuid","<1>"]},{"uuid":["uuid","<2>"]}]} -004: i=0 k=0 ka=[] l2= uuid=<0> -004: i=1 k=2 ka=[] l2= uuid=<1> -004: i=2 k=1 ka=[] l2= uuid=<2> +004: table link1: i=0 k=0 ka=[] l2= uuid=<0> +004: table link1: i=1 k=2 ka=[] l2= uuid=<1> +004: table link1: i=2 k=1 ka=[] l2= uuid=<2> 005: {"error":null,"result":[{"count":1}]} -006: i=0 k=0 ka=[] l2= uuid=<0> -006: i=1 k=1 ka=[] l2= uuid=<1> -006: i=2 k=1 ka=[] l2= uuid=<2> +006: table link1: i=0 k=0 ka=[] l2= uuid=<0> +006: table link1: i=1 k=1 ka=[] l2= uuid=<1> +006: table link1: i=2 k=1 ka=[] l2= uuid=<2> 007: {"error":null,"result":[{"count":3}]} -008: i=0 k=0 ka=[] l2= uuid=<0> -008: i=1 k=0 ka=[] l2= uuid=<1> -008: i=2 k=0 ka=[] l2= uuid=<2> +008: table link1: i=0 k=0 ka=[] l2= uuid=<0> +008: table link1: i=1 k=0 ka=[] l2= uuid=<1> +008: table link1: i=2 k=0 ka=[] l2= uuid=<2> 009: done ]]) @@ -1022,11 +1022,11 @@ OVSDB_CHECK_IDL_FETCH_COLUMNS([simple idl, initially populated], "row": {}}]']], [?simple:i,r!], ['fetch 0 r'], - [[000: i=0 uuid=<0> -000: i=1 uuid=<1> + [[000: table simple: i=0 uuid=<0> +000: table simple: i=1 uuid=<1> 001: commit, status=success -002: i=0 r=0 uuid=<0> -002: i=1 uuid=<1> +002: table simple: i=0 r=0 uuid=<0> +002: table simple: i=1 uuid=<1> 003: done ]]) @@ -1098,28 +1098,28 @@ OVSDB_CHECK_IDL_WO_MONITOR_COND([simple idl disable monitor-cond], 'reconnect']], [[000: empty 001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]}]} -002: i=0 r=0 b=false s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> -002: i=1 r=2 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0> +002: table simple: i=0 r=0 b=false s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> +002: table simple: i=1 r=2 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0> 003: {"error":null,"result":[{"count":2}]} -004: i=0 r=0 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> -004: i=1 r=2 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0> +004: table simple: i=0 r=0 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> +004: table simple: i=1 r=2 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0> 005: {"error":null,"result":[{"count":2}]} -006: i=0 r=123.5 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> -006: i=1 r=123.5 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0> +006: table simple: i=0 r=123.5 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> +006: table simple: i=1 r=123.5 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0> 007: {"error":null,"result":[{"uuid":["uuid","<6>"]}]} -008: i=-1 r=125 b=false s= u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> -008: i=0 r=123.5 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> -008: i=1 r=123.5 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0> +008: table simple: i=-1 r=125 b=false s= u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> +008: table simple: i=0 r=123.5 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> +008: table simple: i=1 r=123.5 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0> 009: {"error":null,"result":[{"count":2}]} -010: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> -010: i=0 r=123.5 b=true s=newstring u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> -010: i=1 r=123.5 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0> +010: table simple: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> +010: table simple: i=0 r=123.5 b=true s=newstring u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> +010: table simple: i=1 r=123.5 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0> 011: {"error":null,"result":[{"count":1}]} -012: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> -012: i=1 r=123.5 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0> +012: table simple: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> +012: table simple: i=1 r=123.5 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0> 013: reconnect -014: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> -014: i=1 r=123.5 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0> +014: table simple: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> +014: table simple: i=1 r=123.5 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<4> <5>] uuid=<0> 015: done ]]) @@ -1162,13 +1162,12 @@ OVSDB_CHECK_IDL_TRACK([track, simple idl, initially populated], "table": "simple", "where": [], "row": {"b": true}}]']], - [[000: i=1 r=2 b=true s=mystring u=<0> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<1> <2>] uuid=<3> -000: inserted row: uuid=<3> -000: updated columns: b ba i ia r ra s sa u ua + [[000: table simple: inserted row: i=1 r=2 b=true s=mystring u=<0> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<1> <2>] uuid=<3> +000: table simple: updated columns: b ba i ia r ra s sa u ua 001: {"error":null,"result":[{"count":2}]} -002: i=0 r=0 b=true s= u=<4> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<5> -002: i=1 r=2 b=true s=mystring u=<0> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<1> <2>] uuid=<3> -002: updated columns: b +002: table simple: i=0 r=0 b=true s= u=<4> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<5> +002: table simple: i=1 r=2 b=true s=mystring u=<0> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<1> <2>] uuid=<3> +002: table simple: updated columns: b 003: done ]]) @@ -1209,19 +1208,17 @@ OVSDB_CHECK_IDL_TRACK([track, simple idl, initially populated, orphan weak refer "table": "simple6", "where": []}]']], [[000: change conditions -001: inserted row: uuid=<0> -001: name=first_row weak_ref=[] uuid=<0> -001: updated columns: name weak_ref +001: table simple6: inserted row: name=first_row weak_ref=[] uuid=<0> +001: table simple6: updated columns: name weak_ref 002: change conditions -003: i=0 r=0 b=false s=row1_s u=<1> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2> -003: inserted row: uuid=<2> -003: name=first_row weak_ref=[<2>] uuid=<0> -003: updated columns: s +003: table simple6: name=first_row weak_ref=[<1>] uuid=<0> +003: table simple: inserted row: i=0 r=0 b=false s=row1_s u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> +003: table simple: updated columns: s 004: {"error":null,"result":[{"count":1}]} -005: name=new_name weak_ref=[<2>] uuid=<0> -005: updated columns: name +005: table simple6: name=new_name weak_ref=[<1>] uuid=<0> +005: table simple6: updated columns: name 006: {"error":null,"result":[{"count":1}]} -007: i=0 r=0 b=false s=row1_s u=<1> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2> +007: table simple: i=0 r=0 b=false s=row1_s u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> 008: done ]]) @@ -1253,27 +1250,22 @@ OVSDB_CHECK_IDL_TRACK([track, simple idl, initially populated, orphan rows, cond "table": "simple6", "where": []}]']], [[000: change conditions -001: inserted row: uuid=<0> -001: name=first_row weak_ref=[] uuid=<0> -001: updated columns: name weak_ref +001: table simple6: inserted row: name=first_row weak_ref=[] uuid=<0> +001: table simple6: updated columns: name weak_ref 002: change conditions -003: i=0 r=0 b=false s=row0_s u=<1> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2> -003: inserted row: uuid=<2> -003: name=first_row weak_ref=[<2>] uuid=<0> -003: updated columns: s +003: table simple6: name=first_row weak_ref=[<1>] uuid=<0> +003: table simple: inserted row: i=0 r=0 b=false s=row0_s u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> +003: table simple: updated columns: s 004: change conditions -005: i=0 r=0 b=false s=row1_s u=<1> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<3> -005: inserted row: uuid=<3> -005: updated columns: s +005: table simple: inserted row: i=0 r=0 b=false s=row1_s u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<3> +005: table simple: updated columns: s 006: change conditions -007: deleted row: uuid=<3> -007: i=0 r=0 b=false s=row0_s u=<1> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2> -007: i=0 r=0 b=false s=row1_s u=<1> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<3> -007: inserted row: uuid=<2> -007: name=first_row weak_ref=[<2>] uuid=<0> -007: updated columns: s +007: table simple6: name=first_row weak_ref=[<1>] uuid=<0> +007: table simple: deleted row: i=0 r=0 b=false s=row1_s u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<3> +007: table simple: inserted row: i=0 r=0 b=false s=row0_s u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> +007: table simple: updated columns: s 008: {"error":null,"result":[{"count":1}]} -009: i=0 r=0 b=false s=row0_s u=<1> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2> +009: table simple: i=0 r=0 b=false s=row0_s u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> 010: done ]]) @@ -1330,34 +1322,31 @@ OVSDB_CHECK_IDL_TRACK([track, simple idl, initially empty, various ops], 'reconnect']], [[000: empty 001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]}]} -002: i=1 r=2 b=true s=mystring u=<2> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<3> <4>] uuid=<0> -002: inserted row: uuid=<0> -002: updated columns: b ba i ia r ra s sa u ua +002: table simple: inserted row: i=1 r=2 b=true s=mystring u=<2> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<3> <4>] uuid=<0> +002: table simple: updated columns: b ba i ia r ra s sa u ua 003: {"error":null,"result":[{"count":2}]} -004: i=0 r=0 b=true s= u=<5> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> -004: updated columns: b +004: table simple: i=0 r=0 b=true s= u=<5> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> +004: table simple: updated columns: b 005: {"error":null,"result":[{"count":2}]} -006: i=0 r=123.5 b=true s= u=<5> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> -006: i=1 r=123.5 b=true s=mystring u=<2> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<3> <4>] uuid=<0> -006: updated columns: r -006: updated columns: r +006: table simple: i=0 r=123.5 b=true s= u=<5> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> +006: table simple: i=1 r=123.5 b=true s=mystring u=<2> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<3> <4>] uuid=<0> +006: table simple: updated columns: r +006: table simple: updated columns: r 007: {"error":null,"result":[{"uuid":["uuid","<6>"]}]} -008: i=-1 r=125 b=false s= u=<5> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> -008: inserted row: uuid=<6> -008: updated columns: ba i ia r ra +008: table simple: inserted row: i=-1 r=125 b=false s= u=<5> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> +008: table simple: updated columns: ba i ia r ra 009: {"error":null,"result":[{"count":2}]} -010: i=-1 r=125 b=false s=newstring u=<5> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> -010: i=0 r=123.5 b=true s=newstring u=<5> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> -010: updated columns: s -010: updated columns: s +010: table simple: i=-1 r=125 b=false s=newstring u=<5> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> +010: table simple: i=0 r=123.5 b=true s=newstring u=<5> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> +010: table simple: updated columns: s +010: table simple: updated columns: s 011: {"error":null,"result":[{"count":1}]} -012: deleted row: uuid=<1> -012: i=0 r=123.5 b=true s=newstring u=<5> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> +012: table simple: deleted row: i=0 r=123.5 b=true s=newstring u=<5> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> 013: reconnect -014: i=-1 r=125 b=false s=newstring u=<5> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> -014: i=1 r=123.5 b=true s=mystring u=<2> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<3> <4>] uuid=<0> -014: updated columns: b ba i ia r ra s sa u ua -014: updated columns: ba i ia r ra s +014: table simple: inserted row: i=-1 r=125 b=false s=newstring u=<5> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6> +014: table simple: inserted row: i=1 r=123.5 b=true s=mystring u=<2> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<3> <4>] uuid=<0> +014: table simple: updated columns: b ba i ia r ra s sa u ua +014: table simple: updated columns: ba i ia r ra s 015: done ]]) @@ -1397,16 +1386,16 @@ OVSDB_CHECK_IDL_PY([partial-map idl], "row":{"name":"myString1","smap":["map",[["key1","value1"],["key2","value2"]]]} }]'] ], [?simple2:name,smap,imap 'partialmapinsertelement' 'partialmapinsertmultipleelements' 'partialmapdelelements' 'partialmapmutatenew'], -[[000: name=myString1 smap=[(key1 value1) (key2 value2)] imap=[] +[[000: table simple2: name=myString1 smap=[(key1 value1) (key2 value2)] imap=[] uuid=<0> 001: commit, status=success -002: name=String2 smap=[(key1 myList1) (key2 value2)] imap=[(3 myids2)] +002: table simple2: name=String2 smap=[(key1 myList1) (key2 value2)] imap=[(3 myids2)] uuid=<0> 003: commit, status=success -004: name=String2 smap=[(key1 myList1) (key2 myList2) (key3 myList3) (key4 myList4)] imap=[(3 myids2)] +004: table simple2: name=String2 smap=[(key1 myList1) (key2 myList2) (key3 myList3) (key4 myList4)] imap=[(3 myids2)] uuid=<0> 005: commit, status=success -006: name=String2 smap=[(key2 myList2)] imap=[(3 myids2)] +006: table simple2: name=String2 smap=[(key2 myList2)] imap=[(3 myids2)] uuid=<0> 007: commit, status=success -008: name=String2 smap=[(key2 myList2)] imap=[(3 myids2)] -008: name=String2New smap=[(key1 newList1) (key2 newList2)] imap=[] +008: table simple2: name=String2 smap=[(key2 myList2)] imap=[(3 myids2)] uuid=<0> +008: table simple2: name=String2New smap=[(key1 newList1) (key2 newList2)] imap=[] uuid=<1> 009: done ]]) @@ -1414,11 +1403,11 @@ OVSDB_CHECK_IDL_PY([partial-map update set refmap idl], [['["idltest", {"op":"insert", "table":"simple3", "row":{"name":"myString1"}}, {"op":"insert", "table":"simple5", "row":{"name":"myString2"}}]']], ['partialmapmutateirefmap'], -[[000: name=myString1 uset=[] -000: name=myString2 irefmap=[] +[[000: table simple3: name=myString1 uset=[] uuid=<0> +000: table simple5: name=myString2 irefmap=[] uuid=<1> 001: commit, status=success -002: name=myString1 uset=[] -002: name=myString2 irefmap=[(1 <0>)] +002: table simple3: name=myString1 uset=[] uuid=<0> +002: table simple5: name=myString2 irefmap=[(1 <0>)] uuid=<1> 003: done ]]) @@ -1441,17 +1430,17 @@ OVSDB_CHECK_IDL_PARTIAL_UPDATE_SET_COLUMN([set, simple3 idl-partial-update-set-c ], [], [[000: Getting records -001: name=mySet1 uset=[[<0>],[<1>]] uref=[] +001: table simple3: name=mySet1 uset=[[<0>],[<1>]] uref=[] uuid=<2> 002: After rename+add new value -003: name=String2 uset=[[<0>],[<1>],[<2>]] uref=[] +003: table simple3: name=String2 uset=[[<0>],[<1>],[<3>]] uref=[] uuid=<2> 004: After add new value -005: name=String2 uset=[[<0>],[<1>],[<2>],[<3>]] uref=[] +005: table simple3: name=String2 uset=[[<0>],[<1>],[<3>],[<4>]] uref=[] uuid=<2> 006: After delete value -007: name=String2 uset=[[<0>],[<1>],[<3>]] uref=[] +007: table simple3: name=String2 uset=[[<0>],[<1>],[<4>]] uref=[] uuid=<2> 008: After trying to delete a deleted value -009: name=String2 uset=[[<0>],[<1>],[<3>]] uref=[] +009: table simple3: name=String2 uset=[[<0>],[<1>],[<4>]] uref=[] uuid=<2> 010: After add to other table + set of strong ref -011: name=String2 uset=[[<0>],[<1>],[<3>]] uref=[[<4>]] +011: table simple3: name=String2 uset=[[<0>],[<1>],[<4>]] uref=[[<5>]] uuid=<2> 012: End test ]]) @@ -1463,22 +1452,22 @@ OVSDB_CHECK_IDL_PY([partial-set idl], "mutations": [["uset", "insert", ["set", [["uuid", "000d2f6a-76af-412f-b59d-e7bcd3e84eff"]]]]]}]'] ], ['partialrenamesetadd' 'partialduplicateadd' 'partialsetdel' 'partialsetref' 'partialsetoverrideops' 'partialsetadddelete' 'partialsetmutatenew'], -[[000: name=mySet1 uset=[<0> <1>] +[[000: table simple3: name=mySet1 uset=[<0> <1>] uuid=<2> 001: commit, status=success -002: name=String2 uset=[<0> <1> <2>] +002: table simple3: name=String2 uset=[<0> <1> <3>] uuid=<2> 003: commit, status=success -004: name=String2 uset=[<0> <1> <2> <3>] +004: table simple3: name=String2 uset=[<0> <1> <3> <4>] uuid=<2> 005: commit, status=success -006: name=String2 uset=[<0> <1> <3>] +006: table simple3: name=String2 uset=[<0> <1> <4>] uuid=<2> 007: commit, status=success -008: name=String2 uset=[<0> <1> <3>] +008: table simple3: name=String2 uset=[<0> <1> <4>] uuid=<2> 009: commit, status=success -010: name=String2 uset=[<3>] +010: table simple3: name=String2 uset=[<4>] uuid=<2> 011: commit, status=success -012: name=String2 uset=[<4> <5>] +012: table simple3: name=String2 uset=[<5> <6>] uuid=<2> 013: commit, status=success -014: name=String2 uset=[<4> <5>] -014: name=String3 uset=[<6>] +014: table simple3: name=String2 uset=[<5> <6>] uuid=<2> +014: table simple3: name=String3 uset=[<7>] uuid=<8> 015: done ]]) @@ -1498,13 +1487,13 @@ OVSDB_CHECK_IDL_NOTIFY([simple link idl verify notify], "uuid-name": "l2row", "row": {"i": 2, "l1": ["set", [["named-uuid", "l1row"]]]}}]']], [[000: empty -000: event:create, row={uuid=<0>}, updates=None -000: event:create, row={uuid=<1>}, updates=None +000: event:create, row={}, uuid=<0>, updates=None +000: event:create, row={}, uuid=<1>, updates=None 001: {"error":null,"result":[{"uuid":["uuid","<2>"]},{"uuid":["uuid","<3>"]}]} -002: event:create, row={i=1 uuid=<2> l2=[<3>]}, updates=None -002: event:create, row={i=2 uuid=<3> l1=[<2>]}, updates=None -002: i=1 k=1 ka=[] l2=2 uuid=<2> -002: i=2 l1=1 uuid=<3> +002: event:create, row={i=1 l2=[<3>]}, uuid=<2>, updates=None +002: event:create, row={i=2 l1=[<2>]}, uuid=<3>, updates=None +002: table link1: i=1 k=1 ka=[] l2=2 uuid=<2> +002: table link2: i=2 l1=1 uuid=<3> 003: done ]]) @@ -1560,44 +1549,44 @@ OVSDB_CHECK_IDL_NOTIFY([simple idl verify notify], "where": [["i", "==", 0]]}]' \ 'reconnect']], [[000: empty -000: event:create, row={uuid=<0>}, updates=None -000: event:create, row={uuid=<1>}, updates=None +000: event:create, row={}, uuid=<0>, updates=None +000: event:create, row={}, uuid=<1>, updates=None 001: {"error":null,"result":[{"uuid":["uuid","<2>"]},{"uuid":["uuid","<3>"]}]} -002: event:create, row={i=0 r=0 b=false s= u=<4> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<3>}, updates=None -002: event:create, row={i=1 r=2 b=true s=mystring u=<5> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<6> <7>] uuid=<2>}, updates=None -002: i=0 r=0 b=false s= u=<4> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<3> -002: i=1 r=2 b=true s=mystring u=<5> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<6> <7>] uuid=<2> +002: event:create, row={i=0 r=0 b=false s= u=<4> ia=[] ra=[] ba=[] sa=[] ua=[]}, uuid=<3>, updates=None +002: event:create, row={i=1 r=2 b=true s=mystring u=<5> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<6> <7>]}, uuid=<2>, updates=None +002: table simple: i=0 r=0 b=false s= u=<4> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<3> +002: table simple: i=1 r=2 b=true s=mystring u=<5> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<6> <7>] uuid=<2> 003: {"error":null,"result":[{"count":2}]} -004: event:update, row={i=1 r=2 b=false s=mystring u=<5> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<6> <7>] uuid=<2>}, updates={b=true uuid=<2>} -004: i=0 r=0 b=false s= u=<4> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<3> -004: i=1 r=2 b=false s=mystring u=<5> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<6> <7>] uuid=<2> +004: event:update, row={i=1 r=2 b=false s=mystring u=<5> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<6> <7>]}, uuid=<2>, updates={b=true} +004: table simple: i=0 r=0 b=false s= u=<4> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<3> +004: table simple: i=1 r=2 b=false s=mystring u=<5> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<6> <7>] uuid=<2> 005: {"error":null,"result":[{"count":2}]} -006: event:update, row={i=0 r=123.5 b=false s= u=<4> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<3>}, updates={r=0 uuid=<3>} -006: event:update, row={i=1 r=123.5 b=false s=mystring u=<5> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<6> <7>] uuid=<2>}, updates={r=2 uuid=<2>} -006: i=0 r=123.5 b=false s= u=<4> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<3> -006: i=1 r=123.5 b=false s=mystring u=<5> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<6> <7>] uuid=<2> +006: event:update, row={i=0 r=123.5 b=false s= u=<4> ia=[] ra=[] ba=[] sa=[] ua=[]}, uuid=<3>, updates={r=0} +006: event:update, row={i=1 r=123.5 b=false s=mystring u=<5> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<6> <7>]}, uuid=<2>, updates={r=2} +006: table simple: i=0 r=123.5 b=false s= u=<4> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<3> +006: table simple: i=1 r=123.5 b=false s=mystring u=<5> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<6> <7>] uuid=<2> 007: {"error":null,"result":[{"uuid":["uuid","<8>"]}]} -008: event:create, row={i=-1 r=125 b=false s= u=<4> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<8>}, updates=None -008: i=-1 r=125 b=false s= u=<4> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<8> -008: i=0 r=123.5 b=false s= u=<4> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<3> -008: i=1 r=123.5 b=false s=mystring u=<5> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<6> <7>] uuid=<2> +008: event:create, row={i=-1 r=125 b=false s= u=<4> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[]}, uuid=<8>, updates=None +008: table simple: i=-1 r=125 b=false s= u=<4> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<8> +008: table simple: i=0 r=123.5 b=false s= u=<4> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<3> +008: table simple: i=1 r=123.5 b=false s=mystring u=<5> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<6> <7>] uuid=<2> 009: {"error":null,"result":[{"count":2}]} -010: event:update, row={i=-1 r=125 b=false s=newstring u=<4> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<8>}, updates={s= uuid=<8>} -010: event:update, row={i=0 r=123.5 b=false s=newstring u=<4> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<3>}, updates={s= uuid=<3>} -010: i=-1 r=125 b=false s=newstring u=<4> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<8> -010: i=0 r=123.5 b=false s=newstring u=<4> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<3> -010: i=1 r=123.5 b=false s=mystring u=<5> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<6> <7>] uuid=<2> +010: event:update, row={i=-1 r=125 b=false s=newstring u=<4> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[]}, uuid=<8>, updates={s=} +010: event:update, row={i=0 r=123.5 b=false s=newstring u=<4> ia=[] ra=[] ba=[] sa=[] ua=[]}, uuid=<3>, updates={s=} +010: table simple: i=-1 r=125 b=false s=newstring u=<4> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<8> +010: table simple: i=0 r=123.5 b=false s=newstring u=<4> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<3> +010: table simple: i=1 r=123.5 b=false s=mystring u=<5> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<6> <7>] uuid=<2> 011: {"error":null,"result":[{"count":1}]} -012: event:delete, row={i=0 r=123.5 b=false s=newstring u=<4> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<3>}, updates=None -012: i=-1 r=125 b=false s=newstring u=<4> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<8> -012: i=1 r=123.5 b=false s=mystring u=<5> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<6> <7>] uuid=<2> +012: event:delete, row={i=0 r=123.5 b=false s=newstring u=<4> ia=[] ra=[] ba=[] sa=[] ua=[]}, uuid=<3>, updates=None +012: table simple: i=-1 r=125 b=false s=newstring u=<4> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<8> +012: table simple: i=1 r=123.5 b=false s=mystring u=<5> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<6> <7>] uuid=<2> 013: reconnect -014: event:create, row={i=-1 r=125 b=false s=newstring u=<4> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<8>}, updates=None -014: event:create, row={i=1 r=123.5 b=false s=mystring u=<5> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<6> <7>] uuid=<2>}, updates=None -014: event:create, row={uuid=<0>}, updates=None -014: event:create, row={uuid=<1>}, updates=None -014: i=-1 r=125 b=false s=newstring u=<4> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<8> -014: i=1 r=123.5 b=false s=mystring u=<5> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<6> <7>] uuid=<2> +014: event:create, row={i=-1 r=125 b=false s=newstring u=<4> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[]}, uuid=<8>, updates=None +014: event:create, row={i=1 r=123.5 b=false s=mystring u=<5> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<6> <7>]}, uuid=<2>, updates=None +014: event:create, row={}, uuid=<0>, updates=None +014: event:create, row={}, uuid=<1>, updates=None +014: table simple: i=-1 r=125 b=false s=newstring u=<4> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<8> +014: table simple: i=1 r=123.5 b=false s=mystring u=<5> ia=[1 2 3] ra=[-0.5] ba=[true] sa=[abc def] ua=[<6> <7>] uuid=<2> 015: done ]]) @@ -1910,10 +1899,10 @@ OVSDB_CHECK_IDL_COMPOUND_INDEX_WITH_REF([set, simple3 idl-compound-index-with-re [], [], [[000: After add to other table + set of strong ref -001: name= uset=[] uref=[[<0>]] +001: table simple3: name= uset=[] uref=[[<0>]] uuid=<1> 002: check simple4: not empty 003: Query using index with reference -004: name= uset=[] uref=[[<0>]] +004: table simple3: name= uset=[] uref=[[<0>]] uuid=<1> 005: After delete 007: check simple4: empty 008: End test @@ -2010,11 +1999,11 @@ OVSDB_CHECK_CLUSTER_IDL_C([simple idl, monitor_cond_since, cluster disconnect], [[000: change conditions 001: empty 002: change conditions -003: i=2 r=1 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> +003: table simple: i=2 r=1 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> 004: change conditions 005: reconnect -006: i=2 r=1 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> +006: table simple: i=2 r=1 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> 007: {"error":null,"result":[{"count":1}]} -008: i=1 r=2 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2> +008: table simple: i=1 r=2 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2> 009: done ]]) diff --git a/tests/test-ovsdb.c b/tests/test-ovsdb.c index 15433e3472..14a8d74a2a 100644 --- a/tests/test-ovsdb.c +++ b/tests/test-ovsdb.c @@ -1861,6 +1861,23 @@ print_and_log(const char *format, ...) free(message); } +static char * +format_idl_row(const struct ovsdb_idl_row *row, int step, const char *contents) +{ + const char *change_str = + !ovsdb_idl_track_is_set(row->table) + ? "" + : ovsdb_idl_row_get_seqno(row, OVSDB_IDL_CHANGE_INSERT) > 0 + ? "inserted row: " + : ovsdb_idl_row_get_seqno(row, OVSDB_IDL_CHANGE_DELETE) > 0 + ? "deleted row: " + : ""; + + return xasprintf("%03d: table %s: %s%s uuid=" UUID_FMT, + step, row->table->class_->name, change_str, contents, + UUID_ARGS(&row->uuid)); +} + static void print_idl_row_updated_simple(const struct idltest_simple *s, int step) { @@ -1871,7 +1888,9 @@ print_idl_row_updated_simple(const struct idltest_simple *s, int step) } } if (updates.length) { - print_and_log("%03d: updated columns:%s", step, ds_cstr(&updates)); + print_and_log("%03d: table %s: updated columns:%s", + step, s->header_.table->class_->name, + ds_cstr(&updates)); ds_destroy(&updates); } } @@ -1886,7 +1905,9 @@ print_idl_row_updated_link1(const struct idltest_link1 *l1, int step) } } if (updates.length) { - print_and_log("%03d: updated columns:%s", step, ds_cstr(&updates)); + print_and_log("%03d: table %s: updated columns:%s", + step, l1->header_.table->class_->name, + ds_cstr(&updates)); ds_destroy(&updates); } } @@ -1901,7 +1922,26 @@ print_idl_row_updated_link2(const struct idltest_link2 *l2, int step) } } if (updates.length) { - print_and_log("%03d: updated columns:%s", step, ds_cstr(&updates)); + print_and_log("%03d: table %s: updated columns:%s", + step, l2->header_.table->class_->name, + ds_cstr(&updates)); + ds_destroy(&updates); + } +} + +static void +print_idl_row_updated_simple3(const struct idltest_simple3 *s3, int step) +{ + struct ds updates = DS_EMPTY_INITIALIZER; + for (size_t i = 0; i < IDLTEST_SIMPLE3_N_COLUMNS; i++) { + if (idltest_simple3_is_updated(s3, i)) { + ds_put_format(&updates, " %s", idltest_simple3_columns[i].name); + } + } + if (updates.length) { + print_and_log("%03d: table %s: updated columns:%s", + step, s3->header_.table->class_->name, + ds_cstr(&updates)); ds_destroy(&updates); } } @@ -1916,7 +1956,9 @@ print_idl_row_updated_simple6(const struct idltest_simple6 *s6, int step) } } if (updates.length) { - print_and_log("%03d: updated columns:%s", step, ds_cstr(&updates)); + print_and_log("%03d: table %s: updated columns:%s", + step, s6->header_.table->class_->name, + ds_cstr(&updates)); ds_destroy(&updates); } } @@ -1931,7 +1973,9 @@ print_idl_row_updated_singleton(const struct idltest_singleton *sng, int step) } } if (updates.length) { - print_and_log("%03d: updated columns:%s", step, ds_cstr(&updates)); + print_and_log("%03d: table %s: updated columns:%s", + step, sng->header_.table->class_->name, + ds_cstr(&updates)); ds_destroy(&updates); } } @@ -1940,8 +1984,8 @@ static void print_idl_row_simple(const struct idltest_simple *s, int step) { struct ds msg = DS_EMPTY_INITIALIZER; - ds_put_format(&msg, "%03d: i=%"PRId64" r=%g b=%s s=%s u="UUID_FMT" ia=[", - step, s->i, s->r, s->b ? "true" : "false", + ds_put_format(&msg, "i=%"PRId64" r=%g b=%s s=%s u="UUID_FMT" ia=[", + s->i, s->r, s->b ? "true" : "false", s->s, UUID_ARGS(&s->u)); for (size_t i = 0; i < s->n_ia; i++) { ds_put_format(&msg, "%s%"PRId64, i ? " " : "", s->ia[i]); @@ -1962,9 +2006,12 @@ print_idl_row_simple(const struct idltest_simple *s, int step) for (size_t i = 0; i < s->n_ua; i++) { ds_put_format(&msg, "%s"UUID_FMT, i ? " " : "", UUID_ARGS(&s->ua[i])); } - ds_put_format(&msg, "] uuid="UUID_FMT, UUID_ARGS(&s->header_.uuid)); - print_and_log("%s", ds_cstr(&msg)); + ds_put_cstr(&msg, "]"); + + char *row_msg = format_idl_row(&s->header_, step, ds_cstr(&msg)); + print_and_log("%s", row_msg); ds_destroy(&msg); + free(row_msg); print_idl_row_updated_simple(s, step); } @@ -1973,7 +2020,7 @@ static void print_idl_row_link1(const struct idltest_link1 *l1, int step) { struct ds msg = DS_EMPTY_INITIALIZER; - ds_put_format(&msg, "%03d: i=%"PRId64" k=", step, l1->i); + ds_put_format(&msg, "i=%"PRId64" k=", l1->i); if (l1->k) { ds_put_format(&msg, "%"PRId64, l1->k->i); } @@ -1988,9 +2035,11 @@ print_idl_row_link1(const struct idltest_link1 *l1, int step) if (l1->l2) { ds_put_format(&msg, "%"PRId64, l1->l2->i); } - ds_put_format(&msg, " uuid="UUID_FMT, UUID_ARGS(&l1->header_.uuid)); - print_and_log("%s", ds_cstr(&msg)); + + char *row_msg = format_idl_row(&l1->header_, step, ds_cstr(&msg)); + print_and_log("%s", row_msg); ds_destroy(&msg); + free(row_msg); print_idl_row_updated_link1(l1, step); } @@ -1999,30 +2048,63 @@ static void print_idl_row_link2(const struct idltest_link2 *l2, int step) { struct ds msg = DS_EMPTY_INITIALIZER; - ds_put_format(&msg, "%03d: i=%"PRId64" l1=", step, l2->i); + ds_put_format(&msg, "i=%"PRId64" l1=", l2->i); if (l2->l1) { ds_put_format(&msg, "%"PRId64, l2->l1->i); } - ds_put_format(&msg, " uuid="UUID_FMT, UUID_ARGS(&l2->header_.uuid)); - print_and_log("%s", ds_cstr(&msg)); + + char *row_msg = format_idl_row(&l2->header_, step, ds_cstr(&msg)); + print_and_log("%s", row_msg); ds_destroy(&msg); + free(row_msg); print_idl_row_updated_link2(l2, step); } +static void +print_idl_row_simple3(const struct idltest_simple3 *s3, int step) +{ + struct ds msg = DS_EMPTY_INITIALIZER; + size_t i; + + ds_put_format(&msg, "name=%s uset=[", s3->name); + for (i = 0; i < s3->n_uset; i++) { + ds_put_format(&msg, "["UUID_FMT"]%s", + UUID_ARGS(&s3->uset[i]), + i < s3->n_uset - 1 ? "," : ""); + } + ds_put_cstr(&msg, "] uref=["); + for (i = 0; i < s3->n_uref; i++) { + ds_put_format(&msg, "["UUID_FMT"]%s", + UUID_ARGS(&s3->uref[i]->header_.uuid), + i < s3->n_uref -1 ? "," : ""); + } + ds_put_cstr(&msg, "]"); + + char *row_msg = format_idl_row(&s3->header_, step, ds_cstr(&msg)); + print_and_log("%s", row_msg); + ds_destroy(&msg); + free(row_msg); + + print_idl_row_updated_simple3(s3, step); +} + static void print_idl_row_simple6(const struct idltest_simple6 *s6, int step) { struct ds msg = DS_EMPTY_INITIALIZER; - ds_put_format(&msg, "%03d: name=%s ", step, s6->name); + ds_put_format(&msg, "name=%s ", s6->name); ds_put_cstr(&msg, "weak_ref=["); for (size_t i = 0; i < s6->n_weak_ref; i++) { ds_put_format(&msg, "%s"UUID_FMT, i ? " " : "", UUID_ARGS(&s6->weak_ref[i]->header_.uuid)); } - ds_put_format(&msg, "] uuid="UUID_FMT, UUID_ARGS(&s6->header_.uuid)); - print_and_log("%s", ds_cstr(&msg)); + ds_put_cstr(&msg, "]"); + + char *row_msg = format_idl_row(&s6->header_, step, ds_cstr(&msg)); + print_and_log("%s", row_msg); ds_destroy(&msg); + free(row_msg); print_idl_row_updated_simple6(s6, step); } @@ -2030,8 +2112,14 @@ print_idl_row_simple6(const struct idltest_simple6 *s6, int step) static void print_idl_row_singleton(const struct idltest_singleton *sng, int step) { - print_and_log("%03d: name=%s uuid="UUID_FMT, step, sng->name, - UUID_ARGS(&sng->header_.uuid)); + struct ds msg = DS_EMPTY_INITIALIZER; + ds_put_format(&msg, "name=%s", sng->name); + + char *row_msg = format_idl_row(&sng->header_, step, ds_cstr(&msg)); + print_and_log("%s", row_msg); + ds_destroy(&msg); + free(row_msg); + print_idl_row_updated_singleton(sng, step); } @@ -2076,51 +2164,18 @@ print_idl_track(struct ovsdb_idl *idl, int step) IDLTEST_SIMPLE_FOR_EACH_TRACKED (s, idl) { print_idl_row_simple(s, step); - if (idltest_simple_is_deleted(s)) { - print_and_log("%03d: deleted row: uuid="UUID_FMT, step, - UUID_ARGS(&s->header_.uuid)); - } else if (idltest_simple_is_new(s)) { - print_and_log("%03d: inserted row: uuid="UUID_FMT, step, - UUID_ARGS(&s->header_.uuid)); - } n++; } IDLTEST_LINK1_FOR_EACH_TRACKED (l1, idl) { - if (idltest_link1_is_deleted(l1)) { - print_and_log("%03d: deleted row: uuid="UUID_FMT, step, - UUID_ARGS(&l1->header_.uuid)); - } else { - print_idl_row_link1(l1, step); - if (idltest_link1_is_new(l1)) { - print_and_log("%03d: inserted row: uuid="UUID_FMT, step, - UUID_ARGS(&l1->header_.uuid)); - } - } + print_idl_row_link1(l1, step); n++; } IDLTEST_LINK2_FOR_EACH_TRACKED (l2, idl) { - if (idltest_link2_is_deleted(l2)) { - print_and_log("%03d: deleted row: uuid="UUID_FMT, step, - UUID_ARGS(&l2->header_.uuid)); - } else { - print_idl_row_link2(l2, step); - if (idltest_link2_is_new(l2)) { - print_and_log("%03d: inserted row: uuid="UUID_FMT, step, - UUID_ARGS(&l2->header_.uuid)); - } - - } + print_idl_row_link2(l2, step); n++; } IDLTEST_SIMPLE6_FOR_EACH_TRACKED (s6, idl) { print_idl_row_simple6(s6, step); - if (idltest_simple6_is_deleted(s6)) { - print_and_log("%03d: deleted row: uuid="UUID_FMT, step, - UUID_ARGS(&s6->header_.uuid)); - } else if (idltest_simple6_is_new(s6)) { - print_and_log("%03d: inserted row: uuid="UUID_FMT, step, - UUID_ARGS(&s6->header_.uuid)); - } n++; } @@ -2702,27 +2757,6 @@ do_idl_partial_update_map_column(struct ovs_cmdl_context *ctx) printf("%03d: End test\n", step); } -static void -print_idl_row_simple3(const struct idltest_simple3 *s, int step) -{ - size_t i; - const struct ovsdb_datum *uset; - const struct ovsdb_datum *uref; - - uset = idltest_simple3_get_uset(s, OVSDB_TYPE_UUID); - printf("%03d: name=%s uset=[", - step, s->name); - for (i = 0; i < uset->n; i++) { - printf("["UUID_FMT"]%s", UUID_ARGS(&(uset->keys[i].uuid)), i < uset->n-1? ",": ""); - } - uref = idltest_simple3_get_uref(s, OVSDB_TYPE_UUID); - printf("] uref=["); - for (i = 0; i < uref->n; i++) { - printf("["UUID_FMT"]%s", UUID_ARGS(&(uref->keys[i].uuid)), i < uref->n-1? ",": ""); - } - printf("]\n"); -} - static void dump_simple3(struct ovsdb_idl *idl, const struct idltest_simple3 *myRow, diff --git a/tests/test-ovsdb.py b/tests/test-ovsdb.py index 9d3228f234..bc2be6acff 100644 --- a/tests/test-ovsdb.py +++ b/tests/test-ovsdb.py @@ -176,7 +176,7 @@ def get_simple_printable_row_string(row, columns): def get_simple_table_printable_row(row, *additional_columns): simple_columns = ["i", "r", "b", "s", "u", "ia", - "ra", "ba", "sa", "ua", "uuid"] + "ra", "ba", "sa", "ua"] simple_columns.extend(additional_columns) return get_simple_printable_row_string(row, simple_columns) @@ -191,77 +191,90 @@ def get_simple3_table_printable_row(row): return get_simple_printable_row_string(row, simple3_columns) +def get_simple5_table_printable_row(row): + simple5_columns = ["name", "irefmap"] + return get_simple_printable_row_string(row, simple5_columns) + + +def get_link1_table_printable_row(row): + s = ["i=%s k=" % row.i] + if hasattr(row, "k") and row.k: + s.append(str(row.k.i)) + if hasattr(row, "ka"): + s.append(" ka=[") + s.append(' '.join(sorted(str(ka.i) for ka in row.ka))) + s.append("] l2=") + if hasattr(row, "l2") and row.l2: + s.append(str(row.l2[0].i)) + return ''.join(s) + + +def get_link2_table_printable_row(row): + s = "i=%s l1=" % row.i + if hasattr(row, "l1") and row.l1: + s += str(row.l1[0].i) + return s + + +def get_singleton_table_printable_row(row): + return "name=%s" % row.name + + +def print_row(table, row, step, contents): + s = "%03d: table %s: %s " % (step, table, contents) + s += get_simple_printable_row_string(row, ["uuid"]) + print(s) + + def print_idl(idl, step): n = 0 if "simple" in idl.tables: simple = idl.tables["simple"].rows for row in simple.values(): - s = "%03d: " % step - s += get_simple_table_printable_row(row) - print(s) + print_row("simple", row, step, + get_simple_table_printable_row(row)) n += 1 if "simple2" in idl.tables: simple2 = idl.tables["simple2"].rows for row in simple2.values(): - s = "%03d: " % step - s += get_simple2_table_printable_row(row) - print(s) + print_row("simple2", row, step, + get_simple2_table_printable_row(row)) n += 1 if "simple3" in idl.tables: simple3 = idl.tables["simple3"].rows for row in simple3.values(): - s = "%03d: " % step - s += get_simple3_table_printable_row(row) - print(s) + print_row("simple3", row, step, + get_simple3_table_printable_row(row)) n += 1 if "simple5" in idl.tables: simple5 = idl.tables["simple5"].rows for row in simple5.values(): - s = "%03d: " % step - s += get_simple_printable_row_string(row, ["name", "irefmap"]) - print(s) + print_row("simple5", row, step, + get_simple5_table_printable_row(row)) n += 1 if "link1" in idl.tables: l1 = idl.tables["link1"].rows for row in l1.values(): - s = ["%03d: i=%s k=" % (step, row.i)] - if hasattr(row, "k") and row.k: - s.append(str(row.k.i)) - if hasattr(row, "ka"): - s.append(" ka=[") - s.append(' '.join(sorted(str(ka.i) for ka in row.ka))) - s.append("] l2=") - if hasattr(row, "l2") and row.l2: - s.append(str(row.l2[0].i)) - if hasattr(row, "uuid"): - s.append(" uuid=%s" % row.uuid) - print(''.join(s)) + print_row("link1", row, step, + get_link1_table_printable_row(row)) n += 1 if "link2" in idl.tables: l2 = idl.tables["link2"].rows for row in l2.values(): - s = ["%03d:" % step] - s.append(" i=%s l1=" % row.i) - if hasattr(row, "l1") and row.l1: - s.append(str(row.l1[0].i)) - if hasattr(row, "uuid"): - s.append(" uuid=%s" % row.uuid) - print(''.join(s)) + print_row("link2", row, step, + get_link2_table_printable_row(row)) n += 1 if "singleton" in idl.tables: sng = idl.tables["singleton"].rows for row in sng.values(): - s = ["%03d:" % step] - s.append(" name=%s" % row.name) - if hasattr(row, "uuid"): - s.append(" uuid=%s" % row.uuid) - print(''.join(s)) + print_row("singleton", row, step, + get_singleton_table_printable_row(row)) n += 1 if not n: @@ -640,8 +653,8 @@ def do_idl(schema_file, remote, *commands): def mock_notify(event, row, updates=None): output = "%03d: " % step output += "event:" + str(event) + ", row={" - output += get_simple_table_printable_row(row, - 'l2', 'l1') + "}, updates=" + output += get_simple_table_printable_row(row, 'l2', 'l1') + "}, " + output += get_simple_printable_row_string(row, ["uuid"]) + ", updates=" if updates is None: output += "None" else: From patchwork Fri Apr 2 15:49:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dumitru Ceara X-Patchwork-Id: 1461778 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.137; helo=smtp4.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=QwKW5FWB; dkim-atps=neutral Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FBkyK2SkJz9sRK for ; Sat, 3 Apr 2021 02:49:45 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 3142E41916; Fri, 2 Apr 2021 15:49:41 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id O4ehbNpofBjW; Fri, 2 Apr 2021 15:49:37 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp4.osuosl.org (Postfix) with ESMTP id 9D69F414DC; Fri, 2 Apr 2021 15:49:36 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 7385DC000C; Fri, 2 Apr 2021 15:49:36 +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 EC95AC000A for ; Fri, 2 Apr 2021 15:49:34 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 9816784A99 for ; Fri, 2 Apr 2021 15:49:32 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp1.osuosl.org (amavisd-new); dkim=pass (1024-bit key) header.d=redhat.com Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id L5HFYVKto7ie for ; Fri, 2 Apr 2021 15:49:30 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by smtp1.osuosl.org (Postfix) with ESMTPS id 4F1B5834F4 for ; Fri, 2 Apr 2021 15:49:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617378569; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PcPdrUJgwH8hyylbI7l4Ws+nlUKvdlKmGByYD5bhfWs=; b=QwKW5FWBCxwRY357XisSbb5MohNxPjU9+/gD4Lo06xucwB4+OXEm1+TKa/73SqS9VVaXHV NnthIboRxhiBaHQTu1jivAOgN7PXg+xW6py+UEbyQjNVoXamBMV3GUpX4Shi2FUDOSDEp1 ZtPI1pfJdwUPeeUxawxU5uDsDmxX04Q= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-514-2fWmMJMgMpCjhI-A2cIs0g-1; Fri, 02 Apr 2021 11:49:26 -0400 X-MC-Unique: 2fWmMJMgMpCjhI-A2cIs0g-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 61AA6814339; Fri, 2 Apr 2021 15:49:25 +0000 (UTC) Received: from dceara.remote.csb (ovpn-112-193.ams2.redhat.com [10.36.112.193]) by smtp.corp.redhat.com (Postfix) with ESMTP id 692D410013C1; Fri, 2 Apr 2021 15:49:21 +0000 (UTC) From: Dumitru Ceara To: dev@openvswitch.org Date: Fri, 2 Apr 2021 17:49:16 +0200 Message-Id: <20210402154858.7879.57588.stgit@dceara.remote.csb> In-Reply-To: <20210402154605.7879.66878.stgit@dceara.remote.csb> References: <20210402154605.7879.66878.stgit@dceara.remote.csb> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dceara@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Cc: i.maximets@ovn.org, dceara@redhat.com Subject: [ovs-dev] [PATCH branch-2.13 3/4] ovsdb-idl: Preserve references for deleted rows. 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" 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=} b = {B._uuid=, B.ref_a=} 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=} - for table B: - updated records: b = {B._uuid=, B.ref_a=[]} 2. row 'a' and row 'b' are deleted in the same update: - for table A: - deleted records: a = {A._uuid=} - for table B: - deleted records: b = {B._uuid=, B.ref_a=} 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=, 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 Acked-by: Han Zhou Signed-off-by: Ilya Maximets (cherry picked from commit 95689f1668181661fd69321aada81b339d1afbf3) --- lib/ovsdb-idl.c | 129 ++++++++++++++++----- tests/ovsdb-idl.at | 312 ++++++++++++++++++++++++++++++++++++++++++++++++--- tests/test-ovsdb.c | 64 ++++++++++ tests/test-ovsdb.py | 28 ++++- 4 files changed, 480 insertions(+), 53 deletions(-) diff --git a/lib/ovsdb-idl.c b/lib/ovsdb-idl.c index ef2fb4c2fc..d6439a2151 100644 --- a/lib/ovsdb-idl.c +++ b/lib/ovsdb-idl.c @@ -219,6 +219,9 @@ struct ovsdb_idl_db { /* Last db txn id, used for fast resync through monitor_cond_since */ struct uuid last_id; + struct ovs_list deleted_untracked_rows; /* Stores rows deleted in the + * current run, that are not yet + * added to the track_list. */ }; static void ovsdb_idl_db_track_clear(struct ovsdb_idl_db *, bool flush_all); @@ -334,6 +337,7 @@ static void ovsdb_idl_delete_row(struct ovsdb_idl_row *); static bool ovsdb_idl_modify_row(struct ovsdb_idl_row *, const struct json *); static bool ovsdb_idl_modify_row_by_diff(struct ovsdb_idl_row *, const struct json *); +static void ovsdb_idl_reparse_deleted(struct ovsdb_idl_db *); static bool ovsdb_idl_row_is_orphan(const struct ovsdb_idl_row *); static struct ovsdb_idl_row *ovsdb_idl_row_create__( @@ -350,6 +354,10 @@ static void ovsdb_idl_row_unparse(struct ovsdb_idl_row *); static void ovsdb_idl_row_clear_old(struct ovsdb_idl_row *); static void ovsdb_idl_row_clear_new(struct ovsdb_idl_row *); static void ovsdb_idl_row_clear_arcs(struct ovsdb_idl_row *, bool destroy_dsts); +static void ovsdb_idl_row_reparse_backrefs(struct ovsdb_idl_row *); +static void ovsdb_idl_row_track_change(struct ovsdb_idl_row *, + enum ovsdb_idl_change); +static void ovsdb_idl_row_untrack_change(struct ovsdb_idl_row *); static void ovsdb_idl_db_txn_abort_all(struct ovsdb_idl_db *); static void ovsdb_idl_txn_abort_all(struct ovsdb_idl *); @@ -434,6 +442,7 @@ ovsdb_idl_db_init(struct ovsdb_idl_db *db, const struct ovsdb_idl_class *class, db->monitor_id = json_array_create_2(json_string_create("monid"), json_string_create(class->database)); hmap_init(&db->outstanding_txns); + ovs_list_init(&db->deleted_untracked_rows); } /* Creates and returns a connection to database 'remote', which should be in a @@ -614,6 +623,14 @@ ovsdb_idl_db_clear(struct ovsdb_idl_db *db) bool changed = false; size_t i; + /* Process deleted rows, removing them from the 'deleted_untracked_rows' + * list and reparsing their backrefs. + */ + ovsdb_idl_reparse_deleted(db); + + /* Cleanup all rows; each row gets added to its own table's + * 'track_list'. + */ for (i = 0; i < db->class_->n_tables; i++) { struct ovsdb_idl_table *table = &db->tables[i]; struct ovsdb_idl_row *row, *next_row; @@ -631,18 +648,27 @@ ovsdb_idl_db_clear(struct ovsdb_idl_db *db) ovsdb_idl_row_unparse(row); } LIST_FOR_EACH_SAFE (arc, next_arc, src_node, &row->src_arcs) { + ovs_list_remove(&arc->src_node); + ovs_list_remove(&arc->dst_node); + free(arc); + } + LIST_FOR_EACH_SAFE (arc, next_arc, dst_node, &row->dst_arcs) { + ovs_list_remove(&arc->src_node); + ovs_list_remove(&arc->dst_node); free(arc); } - /* No need to do anything with dst_arcs: some node has those arcs - * as forward arcs and will destroy them itself. */ ovsdb_idl_row_destroy(row); } } + + /* Free rows deleted from tables with change tracking disabled. */ ovsdb_idl_row_destroy_postprocess(db); db->cond_seqno = 0; + /* Free rows deleted from tables with change tracking enabled. */ ovsdb_idl_db_track_clear(db, true); + ovs_assert(ovs_list_is_empty(&db->deleted_untracked_rows)); if (changed) { db->change_seqno++; @@ -926,6 +952,7 @@ ovsdb_idl_run(struct ovsdb_idl *idl) ovsdb_idl_process_msg(idl, msg); jsonrpc_msg_destroy(msg); } + ovsdb_idl_reparse_deleted(&idl->data); ovsdb_idl_row_destroy_postprocess(&idl->data); } @@ -1950,13 +1977,8 @@ ovsdb_idl_db_track_clear(struct ovsdb_idl_db *db, bool flush_all) free(row->updated); row->updated = NULL; } + ovsdb_idl_row_untrack_change(row); - row->change_seqno[OVSDB_IDL_CHANGE_INSERT] = - row->change_seqno[OVSDB_IDL_CHANGE_MODIFY] = - row->change_seqno[OVSDB_IDL_CHANGE_DELETE] = 0; - - ovs_list_remove(&row->track_node); - ovs_list_init(&row->track_node); if (ovsdb_idl_row_is_orphan(row)) { ovsdb_idl_row_unparse(row); if (row->tracked_old_datum) { @@ -2526,6 +2548,32 @@ ovsdb_idl_db_parse_update(struct ovsdb_idl_db *db, } } +/* Reparses references to rows that have been deleted in the current IDL run. + * + * To ensure that reference sources that are deleted are not reparsed, + * this function must be called after all updates have been processed in + * the current IDL run, i.e., after all calls to ovsdb_idl_parse_update(). + */ +static void +ovsdb_idl_reparse_deleted(struct ovsdb_idl_db *db) +{ + struct ovsdb_idl_row *row, *next; + + LIST_FOR_EACH_SAFE (row, next, track_node, &db->deleted_untracked_rows) { + ovsdb_idl_row_untrack_change(row); + ovsdb_idl_row_reparse_backrefs(row); + + /* Orphan rows that are still unreferenced or are part of tables that + * have change tracking enabled should be added to their table's + * 'track_list'. + */ + if (ovs_list_is_empty(&row->dst_arcs) + || ovsdb_idl_track_is_set(row->table)) { + ovsdb_idl_row_track_change(row, OVSDB_IDL_CHANGE_DELETE); + } + } +} + static struct ovsdb_idl_row * ovsdb_idl_get_row(struct ovsdb_idl_table *table, const struct uuid *uuid) { @@ -2565,6 +2613,7 @@ ovsdb_idl_process_update(struct ovsdb_idl_table *table, if (!row) { ovsdb_idl_insert_row(ovsdb_idl_row_create(table, uuid), new); } else if (ovsdb_idl_row_is_orphan(row)) { + ovsdb_idl_row_untrack_change(row); ovsdb_idl_insert_row(row, new); } else { VLOG_WARN_RL(&semantic_rl, "cannot add existing row "UUID_FMT" to " @@ -2662,13 +2711,8 @@ add_tracked_change_for_references(struct ovsdb_idl_row *row) if (ovs_list_is_empty(&ref->track_node) && ovsdb_idl_track_is_set(ref->table)) { - ovs_list_push_back(&ref->table->track_list, - &ref->track_node); - - ref->change_seqno[OVSDB_IDL_CHANGE_MODIFY] - = ref->table->change_seqno[OVSDB_IDL_CHANGE_MODIFY] - = ref->table->db->change_seqno + 1; + ovsdb_idl_row_track_change(ref, OVSDB_IDL_CHANGE_MODIFY); add_tracked_change_for_references(ref); } } @@ -3261,6 +3305,32 @@ ovsdb_idl_row_reparse_backrefs(struct ovsdb_idl_row *row) } } +static void +ovsdb_idl_row_track_change(struct ovsdb_idl_row *row, + enum ovsdb_idl_change change) +{ + row->change_seqno[change] + = row->table->change_seqno[change] + = row->table->db->change_seqno + 1; + if (ovs_list_is_empty(&row->track_node)) { + ovs_list_push_back(&row->table->track_list, &row->track_node); + } +} + +static void +ovsdb_idl_row_untrack_change(struct ovsdb_idl_row *row) +{ + if (ovs_list_is_empty(&row->track_node)) { + return; + } + + row->change_seqno[OVSDB_IDL_CHANGE_INSERT] = + row->change_seqno[OVSDB_IDL_CHANGE_MODIFY] = + row->change_seqno[OVSDB_IDL_CHANGE_DELETE] = 0; + ovs_list_remove(&row->track_node); + ovs_list_init(&row->track_node); +} + static struct ovsdb_idl_row * ovsdb_idl_row_create__(const struct ovsdb_idl_table_class *class) { @@ -3287,22 +3357,26 @@ ovsdb_idl_row_create(struct ovsdb_idl_table *table, const struct uuid *uuid) return row; } +/* If 'row' is not referenced anymore, removes 'row' from the table hmap, + * clears the old datum and adds 'row' to the table's track_list. + * + * If 'row' is still referenced, i.e., became "orphan", queues 'row' for + * reparsing after all updates have been processed by adding it to the + * 'deleted_untracked_rows' list. + */ static void ovsdb_idl_row_destroy(struct ovsdb_idl_row *row) { - if (row) { - ovsdb_idl_row_clear_old(row); + ovsdb_idl_row_clear_old(row); + if (ovs_list_is_empty(&row->dst_arcs)) { hmap_remove(&row->table->rows, &row->hmap_node); ovsdb_idl_destroy_all_map_op_lists(row); ovsdb_idl_destroy_all_set_op_lists(row); - if (ovsdb_idl_track_is_set(row->table)) { - row->change_seqno[OVSDB_IDL_CHANGE_DELETE] - = row->table->change_seqno[OVSDB_IDL_CHANGE_DELETE] - = row->table->db->change_seqno + 1; - } - if (ovs_list_is_empty(&row->track_node)) { - ovs_list_push_back(&row->table->track_list, &row->track_node); - } + ovsdb_idl_row_track_change(row, OVSDB_IDL_CHANGE_DELETE); + } else { + ovsdb_idl_row_untrack_change(row); + ovs_list_push_back(&row->table->db->deleted_untracked_rows, + &row->track_node); } } @@ -3394,12 +3468,7 @@ ovsdb_idl_delete_row(struct ovsdb_idl_row *row) { ovsdb_idl_remove_from_indexes(row); ovsdb_idl_row_clear_arcs(row, true); - ovsdb_idl_row_clear_old(row); - if (ovs_list_is_empty(&row->dst_arcs)) { - ovsdb_idl_row_destroy(row); - } else { - ovsdb_idl_row_reparse_backrefs(row); - } + ovsdb_idl_row_destroy(row); } /* Returns true if a column with mode OVSDB_IDL_MODE_RW changed, false diff --git a/tests/ovsdb-idl.at b/tests/ovsdb-idl.at index 20db5442ba..97c3ff5d76 100644 --- a/tests/ovsdb-idl.at +++ b/tests/ovsdb-idl.at @@ -141,7 +141,7 @@ m4_define([OVSDB_CHECK_IDL_REGISTER_COLUMNS_PY], AT_CHECK([ovsdb_start_idltest]) m4_if([$2], [], [], [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])]) - AT_CHECK([$PYTHON3 $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema unix:socket ?simple:b,ba,i,ia,r,ra,s,sa,u,ua?link1:i,k,ka,l2?link2:i,l1?singleton:name $3], + AT_CHECK([$PYTHON3 $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema unix:socket ?simple:b,ba,i,ia,r,ra,s,sa,u,ua?simple3:name,uset,uref?simple4:name?simple6:name,weak_ref?link1:i,k,ka,l2?link2:i,l1?singleton:name $3], [0], [stdout], [ignore]) AT_CHECK([sort stdout | uuidfilt]m4_if([$6],,, [[| $6]]), [0], [$4]) @@ -874,6 +874,35 @@ OVSDB_CHECK_IDL([singleton idl, constraints], 006: done ]]) +dnl This test creates a database with references and checks that deleting both +dnl source and destination rows of a reference in a single update doesn't leak +dnl rows that got orphaned when processing the update. +OVSDB_CHECK_IDL([simple idl, references, multiple deletes], + [['["idltest", + {"op": "insert", + "table": "simple", + "row": {"s": "row0_s"}, + "uuid-name": "weak_row0"}, + {"op": "insert", + "table": "simple6", + "row": {"name": "first_row", + "weak_ref": ["set", + [["named-uuid", "weak_row0"]] + ]}}]']], + [['["idltest", + {"op": "delete", + "table": "simple", + "where": [["s", "==", "row0_s"]]}, + {"op": "delete", + "table": "simple6", + "where": [["name", "==", "first_row"]]}]']], + [[000: table simple6: name=first_row weak_ref=[<0>] uuid=<1> +000: table simple: i=0 r=0 b=false s=row0_s u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<0> +001: {"error":null,"result":[{"count":1},{"count":1}]} +002: empty +003: done +]]) + OVSDB_CHECK_IDL_PY([external-linking idl, insert ops], [], [['linktest']], @@ -1257,6 +1286,7 @@ OVSDB_CHECK_IDL_TRACK([track, simple idl, initially populated, orphan rows, cond 003: table simple: inserted row: i=0 r=0 b=false s=row0_s u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> 003: table simple: updated columns: s 004: change conditions +005: table simple: deleted row: i=0 r=0 b=false s=row0_s u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> 005: table simple: inserted row: i=0 r=0 b=false s=row1_s u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<3> 005: table simple: updated columns: s 006: change conditions @@ -1269,6 +1299,244 @@ OVSDB_CHECK_IDL_TRACK([track, simple idl, initially populated, orphan rows, cond 010: done ]]) +dnl This test checks that deleting the destination of a weak reference +dnl without deleting the source, through monitor condition change, updates +dnl the source tracked record. +OVSDB_CHECK_IDL_TRACK([track, simple idl, initially populated, references, conditional delete], + [['["idltest", + {"op": "insert", + "table": "simple", + "row": {"s": "row0_s", "i": 0}, + "uuid-name": "weak_row0"}, + {"op": "insert", + "table": "simple", + "row": {"s": "row1_s", "i": 1}, + "uuid-name": "weak_row1"}, + {"op": "insert", + "table": "simple6", + "row": {"name": "first_row", + "weak_ref": ["set", + [["named-uuid", "weak_row0"], + ["named-uuid", "weak_row1"]] + ]}}]']], + [['condition simple []' \ + 'condition simple [["s","==","row0_s"]]' \ + 'condition simple [["s","==","row1_s"]]' \ + '["idltest", + {"op": "update", + "table": "simple6", + "where": [], + "row": {"name": "new_name"}}]' \ + '["idltest", + {"op": "delete", + "table": "simple6", + "where": []}]']], + [[000: change conditions +001: table simple6: inserted row: name=first_row weak_ref=[] uuid=<0> +001: table simple6: updated columns: name weak_ref +002: change conditions +003: table simple6: name=first_row weak_ref=[<1>] uuid=<0> +003: table simple: inserted row: i=0 r=0 b=false s=row0_s u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> +003: table simple: updated columns: s +004: change conditions +005: table simple6: name=first_row weak_ref=[<3>] uuid=<0> +005: table simple: deleted row: i=0 r=0 b=false s=row0_s u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> +005: table simple: inserted row: i=1 r=0 b=false s=row1_s u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<3> +005: table simple: updated columns: i s +006: {"error":null,"result":[{"count":1}]} +007: table simple6: name=new_name weak_ref=[<3>] uuid=<0> +007: table simple6: updated columns: name +008: {"error":null,"result":[{"count":1}]} +009: table simple: i=1 r=0 b=false s=row1_s u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<3> +010: done +]]) + +dnl This test checks that deleting the destination of a reference updates the +dnl source tracked record. +OVSDB_CHECK_IDL_TRACK([track, simple idl, initially populated, references, single delete], + [['["idltest", + {"op": "insert", + "table": "simple", + "row": {"s": "row0_s"}, + "uuid-name": "uuid_row0_s"}, + {"op": "insert", + "table": "simple6", + "row": {"name": "row0_s6", + "weak_ref": ["set", + [["named-uuid", "uuid_row0_s"]] + ]}}]']], + [['condition simple [true];simple6 [true]' \ + '["idltest", + {"op": "delete", + "table": "simple", + "where": []}]' \ + '["idltest", + {"op": "insert", + "table": "simple", + "row": {"s": "row0_s"}}]']], + [[000: change conditions +001: table simple6: inserted row: name=row0_s6 weak_ref=[<0>] uuid=<1> +001: table simple6: updated columns: name weak_ref +001: table simple: inserted row: i=0 r=0 b=false s=row0_s u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<0> +001: table simple: updated columns: s +002: {"error":null,"result":[{"count":1}]} +003: table simple6: name=row0_s6 weak_ref=[] uuid=<1> +003: table simple6: updated columns: weak_ref +003: table simple: deleted row: i=0 r=0 b=false s=row0_s u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<0> +004: {"error":null,"result":[{"uuid":["uuid","<3>"]}]} +005: table simple6: name=row0_s6 weak_ref=[] uuid=<1> +005: table simple: inserted row: i=0 r=0 b=false s=row0_s u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<3> +005: table simple: updated columns: s +006: done +]]) + +dnl This test checks that deleting both the destination and source of the +dnl reference doesn't remove the reference in the source tracked record. +OVSDB_CHECK_IDL_TRACK([track, simple idl, initially populated, weak references, multiple deletes], + [['["idltest", + {"op": "insert", + "table": "simple", + "row": {"s": "row0_s"}, + "uuid-name": "uuid_row0_s"}, + {"op": "insert", + "table": "simple6", + "row": {"name": "row0_s6", + "weak_ref": ["set", + [["named-uuid", "uuid_row0_s"]] + ]}}]']], + [['condition simple [true];simple6 [true]' \ + '["idltest", + {"op": "delete", + "table": "simple", + "where": []}, + {"op": "delete", + "table": "simple6", + "where": []}]' \ + '["idltest", + {"op": "insert", + "table": "simple", + "row": {"s": "row0_s"}}]']], + [[000: change conditions +001: table simple6: inserted row: name=row0_s6 weak_ref=[<0>] uuid=<1> +001: table simple6: updated columns: name weak_ref +001: table simple: inserted row: i=0 r=0 b=false s=row0_s u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<0> +001: table simple: updated columns: s +002: {"error":null,"result":[{"count":1},{"count":1}]} +003: table simple6: deleted row: name=row0_s6 weak_ref=[<0>] uuid=<1> +003: table simple: deleted row: i=0 r=0 b=false s=row0_s u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<0> +004: {"error":null,"result":[{"uuid":["uuid","<3>"]}]} +005: table simple: inserted row: i=0 r=0 b=false s=row0_s u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<3> +005: table simple: updated columns: s +006: done +]]) + +dnl This test checks that deleting both the destination and source of the +dnl reference doesn't remove the reference in the source tracked record. +OVSDB_CHECK_IDL_TRACK([track, simple idl, initially populated, strong references, multiple deletes], + [['["idltest", + {"op": "insert", + "table": "simple4", + "row": {"name": "row0_s4"}, + "uuid-name": "uuid_row0_s4"}, + {"op": "insert", + "table": "simple3", + "row": {"name": "row0_s3", + "uref": ["set", + [["named-uuid", "uuid_row0_s4"]] + ]}}]']], + [['condition simple [true];simple3 [true];simple4 [true]' \ + '["idltest", + {"op": "delete", + "table": "simple3", + "where": []}, + {"op": "delete", + "table": "simple4", + "where": []}]' \ + '["idltest", + {"op": "insert", + "table": "simple", + "row": {"s": "row0_s"}}]']], + [[000: change conditions +001: table simple3: inserted row: name=row0_s3 uset=[] uref=[<0>] uuid=<1> +001: table simple3: updated columns: name uref +001: table simple4: inserted row: name=row0_s4 uuid=<0> +001: table simple4: updated columns: name +002: {"error":null,"result":[{"count":1},{"count":1}]} +003: table simple3: deleted row: name=row0_s3 uset=[] uref=[<0>] uuid=<1> +003: table simple4: deleted row: name=row0_s4 uuid=<0> +004: {"error":null,"result":[{"uuid":["uuid","<2>"]}]} +005: table simple: inserted row: i=0 r=0 b=false s=row0_s u=<3> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2> +005: table simple: updated columns: s +006: done +]]) + +dnl This test checks that changing conditions to not include the target of +dnl a strong reference also updates the source row when change tracking is +dnl enabled. +OVSDB_CHECK_IDL_TRACK([track, simple idl, initially populated, strong references, conditional], + [['["idltest", + {"op": "insert", + "table": "simple4", + "row": {"name": "row0_s4"}, + "uuid-name": "uuid_row0_s4"}, + {"op": "insert", + "table": "simple3", + "row": {"name": "row0_s3", + "uref": ["set", + [["named-uuid", "uuid_row0_s4"]] + ]}}]']], + [['condition simple [true];simple3 [true];simple4 [true]' \ + 'condition simple4 []' \ + '["idltest", + {"op": "insert", + "table": "simple", + "row": {"s": "row0_s"}}]']], + [[000: change conditions +001: table simple3: inserted row: name=row0_s3 uset=[] uref=[<0>] uuid=<1> +001: table simple3: updated columns: name uref +001: table simple4: inserted row: name=row0_s4 uuid=<0> +001: table simple4: updated columns: name +002: change conditions +003: table simple4: deleted row: name=row0_s4 uuid=<0> +004: {"error":null,"result":[{"uuid":["uuid","<2>"]}]} +005: table simple3: name=row0_s3 uset=[] uref=[] uuid=<1> +005: table simple: inserted row: i=0 r=0 b=false s=row0_s u=<3> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2> +005: table simple: updated columns: s +006: done +]]) + +dnl This test checks that changing conditions to not include the target of +dnl a strong reference also updates the source row when change tracking is +dnl disabled. +OVSDB_CHECK_IDL([simple idl, initially populated, strong references, conditional], + [['["idltest", + {"op": "insert", + "table": "simple4", + "row": {"name": "row0_s4"}, + "uuid-name": "uuid_row0_s4"}, + {"op": "insert", + "table": "simple3", + "row": {"name": "row0_s3", + "uref": ["set", + [["named-uuid", "uuid_row0_s4"]] + ]}}]']], + [['condition simple [true];simple3 [true];simple4 [true]' \ + 'condition simple4 []' \ + '["idltest", + {"op": "insert", + "table": "simple", + "row": {"s": "row0_s"}}]']], + [[000: change conditions +001: table simple3: name=row0_s3 uset=[] uref=[<0>] uuid=<1> +001: table simple4: name=row0_s4 uuid=<0> +002: change conditions +003: table simple3: name=row0_s3 uset=[] uref=[] uuid=<1> +004: {"error":null,"result":[{"uuid":["uuid","<2>"]}]} +005: table simple3: name=row0_s3 uset=[] uref=[] uuid=<1> +005: table simple: i=0 r=0 b=false s=row0_s u=<3> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2> +006: done +]]) + OVSDB_CHECK_IDL_TRACK([track, simple idl, initially empty, various ops], [], [['["idltest", @@ -1403,10 +1671,10 @@ OVSDB_CHECK_IDL_PY([partial-map update set refmap idl], [['["idltest", {"op":"insert", "table":"simple3", "row":{"name":"myString1"}}, {"op":"insert", "table":"simple5", "row":{"name":"myString2"}}]']], ['partialmapmutateirefmap'], -[[000: table simple3: name=myString1 uset=[] uuid=<0> +[[000: table simple3: name=myString1 uset=[] uref=[] uuid=<0> 000: table simple5: name=myString2 irefmap=[] uuid=<1> 001: commit, status=success -002: table simple3: name=myString1 uset=[] uuid=<0> +002: table simple3: name=myString1 uset=[] uref=[] uuid=<0> 002: table simple5: name=myString2 irefmap=[(1 <0>)] uuid=<1> 003: done ]]) @@ -1430,17 +1698,17 @@ OVSDB_CHECK_IDL_PARTIAL_UPDATE_SET_COLUMN([set, simple3 idl-partial-update-set-c ], [], [[000: Getting records -001: table simple3: name=mySet1 uset=[[<0>],[<1>]] uref=[] uuid=<2> +001: table simple3: name=mySet1 uset=[<0>,<1>] uref=[] uuid=<2> 002: After rename+add new value -003: table simple3: name=String2 uset=[[<0>],[<1>],[<3>]] uref=[] uuid=<2> +003: table simple3: name=String2 uset=[<0>,<1>,<3>] uref=[] uuid=<2> 004: After add new value -005: table simple3: name=String2 uset=[[<0>],[<1>],[<3>],[<4>]] uref=[] uuid=<2> +005: table simple3: name=String2 uset=[<0>,<1>,<3>,<4>] uref=[] uuid=<2> 006: After delete value -007: table simple3: name=String2 uset=[[<0>],[<1>],[<4>]] uref=[] uuid=<2> +007: table simple3: name=String2 uset=[<0>,<1>,<4>] uref=[] uuid=<2> 008: After trying to delete a deleted value -009: table simple3: name=String2 uset=[[<0>],[<1>],[<4>]] uref=[] uuid=<2> +009: table simple3: name=String2 uset=[<0>,<1>,<4>] uref=[] uuid=<2> 010: After add to other table + set of strong ref -011: table simple3: name=String2 uset=[[<0>],[<1>],[<4>]] uref=[[<5>]] uuid=<2> +011: table simple3: name=String2 uset=[<0>,<1>,<4>] uref=[<5>] uuid=<2> 012: End test ]]) @@ -1452,22 +1720,26 @@ OVSDB_CHECK_IDL_PY([partial-set idl], "mutations": [["uset", "insert", ["set", [["uuid", "000d2f6a-76af-412f-b59d-e7bcd3e84eff"]]]]]}]'] ], ['partialrenamesetadd' 'partialduplicateadd' 'partialsetdel' 'partialsetref' 'partialsetoverrideops' 'partialsetadddelete' 'partialsetmutatenew'], -[[000: table simple3: name=mySet1 uset=[<0> <1>] uuid=<2> +[[000: table simple3: name=mySet1 uset=[<0> <1>] uref=[] uuid=<2> 001: commit, status=success -002: table simple3: name=String2 uset=[<0> <1> <3>] uuid=<2> +002: table simple3: name=String2 uset=[<0> <1> <3>] uref=[] uuid=<2> 003: commit, status=success -004: table simple3: name=String2 uset=[<0> <1> <3> <4>] uuid=<2> +004: table simple3: name=String2 uset=[<0> <1> <3> <4>] uref=[] uuid=<2> 005: commit, status=success -006: table simple3: name=String2 uset=[<0> <1> <4>] uuid=<2> +006: table simple3: name=String2 uset=[<0> <1> <4>] uref=[] uuid=<2> 007: commit, status=success -008: table simple3: name=String2 uset=[<0> <1> <4>] uuid=<2> +008: table simple3: name=String2 uset=[<0> <1> <4>] uref=[<5>] uuid=<2> +008: table simple4: name=test uuid=<5> 009: commit, status=success -010: table simple3: name=String2 uset=[<4>] uuid=<2> +010: table simple3: name=String2 uset=[<4>] uref=[<5>] uuid=<2> +010: table simple4: name=test uuid=<5> 011: commit, status=success -012: table simple3: name=String2 uset=[<5> <6>] uuid=<2> +012: table simple3: name=String2 uset=[<6> <7>] uref=[<5>] uuid=<2> +012: table simple4: name=test uuid=<5> 013: commit, status=success -014: table simple3: name=String2 uset=[<5> <6>] uuid=<2> -014: table simple3: name=String3 uset=[<7>] uuid=<8> +014: table simple3: name=String2 uset=[<6> <7>] uref=[<5>] uuid=<2> +014: table simple3: name=String3 uset=[<8>] uref=[] uuid=<9> +014: table simple4: name=test uuid=<5> 015: done ]]) @@ -1899,10 +2171,10 @@ OVSDB_CHECK_IDL_COMPOUND_INDEX_WITH_REF([set, simple3 idl-compound-index-with-re [], [], [[000: After add to other table + set of strong ref -001: table simple3: name= uset=[] uref=[[<0>]] uuid=<1> +001: table simple3: name= uset=[] uref=[<0>] uuid=<1> 002: check simple4: not empty 003: Query using index with reference -004: table simple3: name= uset=[] uref=[[<0>]] uuid=<1> +004: table simple3: name= uset=[] uref=[<0>] uuid=<1> 005: After delete 007: check simple4: empty 008: End test diff --git a/tests/test-ovsdb.c b/tests/test-ovsdb.c index 14a8d74a2a..a886f971e7 100644 --- a/tests/test-ovsdb.c +++ b/tests/test-ovsdb.c @@ -1946,6 +1946,23 @@ print_idl_row_updated_simple3(const struct idltest_simple3 *s3, int step) } } +static void +print_idl_row_updated_simple4(const struct idltest_simple4 *s4, int step) +{ + struct ds updates = DS_EMPTY_INITIALIZER; + for (size_t i = 0; i < IDLTEST_SIMPLE4_N_COLUMNS; i++) { + if (idltest_simple4_is_updated(s4, i)) { + ds_put_format(&updates, " %s", idltest_simple4_columns[i].name); + } + } + if (updates.length) { + print_and_log("%03d: table %s: updated columns:%s", + step, s4->header_.table->class_->name, + ds_cstr(&updates)); + ds_destroy(&updates); + } +} + static void print_idl_row_updated_simple6(const struct idltest_simple6 *s6, int step) { @@ -2069,13 +2086,13 @@ print_idl_row_simple3(const struct idltest_simple3 *s3, int step) ds_put_format(&msg, "name=%s uset=[", s3->name); for (i = 0; i < s3->n_uset; i++) { - ds_put_format(&msg, "["UUID_FMT"]%s", + ds_put_format(&msg, UUID_FMT"%s", UUID_ARGS(&s3->uset[i]), i < s3->n_uset - 1 ? "," : ""); } ds_put_cstr(&msg, "] uref=["); for (i = 0; i < s3->n_uref; i++) { - ds_put_format(&msg, "["UUID_FMT"]%s", + ds_put_format(&msg, UUID_FMT"%s", UUID_ARGS(&s3->uref[i]->header_.uuid), i < s3->n_uref -1 ? "," : ""); } @@ -2089,6 +2106,20 @@ print_idl_row_simple3(const struct idltest_simple3 *s3, int step) print_idl_row_updated_simple3(s3, step); } +static void +print_idl_row_simple4(const struct idltest_simple4 *s4, int step) +{ + struct ds msg = DS_EMPTY_INITIALIZER; + ds_put_format(&msg, "name=%s", s4->name); + + char *row_msg = format_idl_row(&s4->header_, step, ds_cstr(&msg)); + print_and_log("%s", row_msg); + ds_destroy(&msg); + free(row_msg); + + print_idl_row_updated_simple4(s4, step); +} + static void print_idl_row_simple6(const struct idltest_simple6 *s6, int step) { @@ -2126,6 +2157,9 @@ print_idl_row_singleton(const struct idltest_singleton *sng, int step) static void print_idl(struct ovsdb_idl *idl, int step) { + const struct idltest_simple3 *s3; + const struct idltest_simple4 *s4; + const struct idltest_simple6 *s6; const struct idltest_simple *s; const struct idltest_link1 *l1; const struct idltest_link2 *l2; @@ -2144,6 +2178,18 @@ print_idl(struct ovsdb_idl *idl, int step) print_idl_row_link2(l2, step); n++; } + IDLTEST_SIMPLE3_FOR_EACH (s3, idl) { + print_idl_row_simple3(s3, step); + n++; + } + IDLTEST_SIMPLE4_FOR_EACH (s4, idl) { + print_idl_row_simple4(s4, step); + n++; + } + IDLTEST_SIMPLE6_FOR_EACH (s6, idl) { + print_idl_row_simple6(s6, step); + n++; + } IDLTEST_SINGLETON_FOR_EACH (sng, idl) { print_idl_row_singleton(sng, step); n++; @@ -2156,6 +2202,8 @@ print_idl(struct ovsdb_idl *idl, int step) static void print_idl_track(struct ovsdb_idl *idl, int step) { + const struct idltest_simple3 *s3; + const struct idltest_simple4 *s4; const struct idltest_simple6 *s6; const struct idltest_simple *s; const struct idltest_link1 *l1; @@ -2174,6 +2222,14 @@ print_idl_track(struct ovsdb_idl *idl, int step) print_idl_row_link2(l2, step); n++; } + IDLTEST_SIMPLE3_FOR_EACH_TRACKED (s3, idl) { + print_idl_row_simple3(s3, step); + n++; + } + IDLTEST_SIMPLE4_FOR_EACH_TRACKED (s4, idl) { + print_idl_row_simple4(s4, step); + n++; + } IDLTEST_SIMPLE6_FOR_EACH_TRACKED (s6, idl) { print_idl_row_simple6(s6, step); n++; @@ -2404,6 +2460,10 @@ find_table_class(const char *name) return &idltest_table_link1; } else if (!strcmp(name, "link2")) { return &idltest_table_link2; + } else if (!strcmp(name, "simple3")) { + return &idltest_table_simple3; + } else if (!strcmp(name, "simple4")) { + return &idltest_table_simple4; } else if (!strcmp(name, "simple6")) { return &idltest_table_simple6; } diff --git a/tests/test-ovsdb.py b/tests/test-ovsdb.py index bc2be6acff..72a319123e 100644 --- a/tests/test-ovsdb.py +++ b/tests/test-ovsdb.py @@ -164,6 +164,8 @@ def get_simple_printable_row_string(row, columns): for k, v in value.items()) if isinstance(value, (list, tuple)): value = sorted((row_to_uuid(v) for v in value)) + elif isinstance(value, list): + value = sorted(row_to_uuid(v) for v in value) s += "%s=%s " % (column, value) s = s.strip() s = re.sub('""|,|u?\'', "", s) @@ -187,15 +189,25 @@ def get_simple2_table_printable_row(row): def get_simple3_table_printable_row(row): - simple3_columns = ["name", "uset"] + simple3_columns = ["name", "uset", "uref"] return get_simple_printable_row_string(row, simple3_columns) +def get_simple4_table_printable_row(row): + simple4_columns = ["name"] + return get_simple_printable_row_string(row, simple4_columns) + + def get_simple5_table_printable_row(row): simple5_columns = ["name", "irefmap"] return get_simple_printable_row_string(row, simple5_columns) +def get_simple6_table_printable_row(row): + simple6_columns = ["name", "weak_ref"] + return get_simple_printable_row_string(row, simple6_columns) + + def get_link1_table_printable_row(row): s = ["i=%s k=" % row.i] if hasattr(row, "k") and row.k: @@ -249,6 +261,13 @@ def print_idl(idl, step): get_simple3_table_printable_row(row)) n += 1 + if "simple4" in idl.tables: + simple4 = idl.tables["simple4"].rows + for row in simple4.values(): + print_row("simple4", row, step, + get_simple4_table_printable_row(row)) + n += 1 + if "simple5" in idl.tables: simple5 = idl.tables["simple5"].rows for row in simple5.values(): @@ -256,6 +275,13 @@ def print_idl(idl, step): get_simple5_table_printable_row(row)) n += 1 + if "simple6" in idl.tables: + simple6 = idl.tables["simple6"].rows + for row in simple6.values(): + print_row("simple6", row, step, + get_simple6_table_printable_row(row)) + n += 1 + if "link1" in idl.tables: l1 = idl.tables["link1"].rows for row in l1.values(): From patchwork Fri Apr 2 15:49:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dumitru Ceara X-Patchwork-Id: 1461779 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=smtp1.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=AGtqZ6Pu; dkim-atps=neutral Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FBkyY4VQvz9sRK for ; Sat, 3 Apr 2021 02:49:57 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 656EC84A99; Fri, 2 Apr 2021 15:49:55 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id WbGUy3pNZO0L; Fri, 2 Apr 2021 15:49:54 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp1.osuosl.org (Postfix) with ESMTP id A0D3E84AB1; Fri, 2 Apr 2021 15:49:53 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 79C37C000C; Fri, 2 Apr 2021 15:49:53 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 1DD4FC000C for ; Fri, 2 Apr 2021 15:49:52 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id DB3256078D for ; Fri, 2 Apr 2021 15:49:45 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp3.osuosl.org (amavisd-new); dkim=pass (1024-bit key) header.d=redhat.com Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 67j7BPtVwqDC for ; Fri, 2 Apr 2021 15:49:44 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by smtp3.osuosl.org (Postfix) with ESMTPS id 8CCD7605FF for ; Fri, 2 Apr 2021 15:49:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617378583; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7XeQAi4YRYtwAZhhkLjHYHSHfkaDgHO2l3QIbupWzyA=; b=AGtqZ6PuPv9+y+d695HS0fK7PbASn3NjOzIQXDZMc8Ohts/AHScC2bRpIZwiSJYZDBZOmO itHxC6R5Zvolr/8rLCqWk08jWbreczdekcNuBnPgMh4OsV2K26LBDtWQYEwL3Z0WpjzzYn gXUgAVlBL4PiF7cNs0qxLDhjMejOMxE= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-481-nW-9tGpXNE2X19l5etcd0A-1; Fri, 02 Apr 2021 11:49:41 -0400 X-MC-Unique: nW-9tGpXNE2X19l5etcd0A-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AFD771005D4F; Fri, 2 Apr 2021 15:49:40 +0000 (UTC) Received: from dceara.remote.csb (ovpn-112-193.ams2.redhat.com [10.36.112.193]) by smtp.corp.redhat.com (Postfix) with ESMTP id BA9D65FCA6; Fri, 2 Apr 2021 15:49:37 +0000 (UTC) From: Dumitru Ceara To: dev@openvswitch.org Date: Fri, 2 Apr 2021 17:49:34 +0200 Message-Id: <20210402154931.7879.26974.stgit@dceara.remote.csb> In-Reply-To: <20210402154605.7879.66878.stgit@dceara.remote.csb> References: <20210402154605.7879.66878.stgit@dceara.remote.csb> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dceara@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Cc: i.maximets@ovn.org, dceara@redhat.com Subject: [ovs-dev] [PATCH branch-2.13 4/4] ovsdb-idl: Mark arc sources as updated when destination is deleted. 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" 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=} b = {B._uuid=, B.ref_a=} 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 Acked-by: Han Zhou Signed-off-by: Ilya Maximets (cherry picked from commit ac85cdb38c1f33e7952bc4c0347d6c7873fb56a1) --- lib/ovsdb-idl.c | 3 +++ tests/ovsdb-idl.at | 2 ++ 2 files changed, 5 insertions(+) diff --git a/lib/ovsdb-idl.c b/lib/ovsdb-idl.c index d6439a2151..2fc8a91e37 100644 --- a/lib/ovsdb-idl.c +++ b/lib/ovsdb-idl.c @@ -445,6 +445,8 @@ ovsdb_idl_db_init(struct ovsdb_idl_db *db, const struct ovsdb_idl_class *class, ovs_list_init(&db->deleted_untracked_rows); } +static void add_tracked_change_for_references(struct ovsdb_idl_row *); + /* Creates and returns a connection to database 'remote', which should be in a * form acceptable to jsonrpc_session_open(). The connection will maintain an * in-memory replica of the remote database whose schema is described by @@ -2561,6 +2563,7 @@ ovsdb_idl_reparse_deleted(struct ovsdb_idl_db *db) LIST_FOR_EACH_SAFE (row, next, track_node, &db->deleted_untracked_rows) { ovsdb_idl_row_untrack_change(row); + add_tracked_change_for_references(row); ovsdb_idl_row_reparse_backrefs(row); /* Orphan rows that are still unreferenced or are part of tables that diff --git a/tests/ovsdb-idl.at b/tests/ovsdb-idl.at index 97c3ff5d76..a1daf9a137 100644 --- a/tests/ovsdb-idl.at +++ b/tests/ovsdb-idl.at @@ -1286,6 +1286,7 @@ OVSDB_CHECK_IDL_TRACK([track, simple idl, initially populated, orphan rows, cond 003: table simple: inserted row: i=0 r=0 b=false s=row0_s u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> 003: table simple: updated columns: s 004: change conditions +005: table simple6: name=first_row weak_ref=[] uuid=<0> 005: table simple: deleted row: i=0 r=0 b=false s=row0_s u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> 005: table simple: inserted row: i=0 r=0 b=false s=row1_s u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<3> 005: table simple: updated columns: s @@ -1497,6 +1498,7 @@ OVSDB_CHECK_IDL_TRACK([track, simple idl, initially populated, strong references 001: table simple4: inserted row: name=row0_s4 uuid=<0> 001: table simple4: updated columns: name 002: change conditions +003: table simple3: name=row0_s3 uset=[] uref=[] uuid=<1> 003: table simple4: deleted row: name=row0_s4 uuid=<0> 004: {"error":null,"result":[{"uuid":["uuid","<2>"]}]} 005: table simple3: name=row0_s3 uset=[] uref=[] uuid=<1>