diff mbox series

[ovs-dev,v3,11/27] ovn-northd-ddlog: Upgrade to ddlog 0.38.

Message ID 20210507040659.26830-12-blp@ovn.org
State Accepted
Headers show
Series ddlog 5x performance improvement | expand

Commit Message

Ben Pfaff May 7, 2021, 4:06 a.m. UTC
From: Leonid Ryzhyk <lryzhyk@vmware.com>

Upcoming commits will use a new --intern-table option of ovsdb2ddlog,
so we need to upgrade to the version of ddlog that has that feature.

To do so, we need to adapt the code to language changes in ddlog.  This
commit does that for a change in 0.37 in which, when iterating over a
`Group` in a for-loop, the iterator returns `(value, weight)` tuples.

This also adapts ovn-northd-ddlog.c to a slightly updated C API.

Signed-off-by: Leonid Ryzhyk <lryzhyk@vmware.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
---
 NEWS                      |  2 +-
 northd/lrouter.dl         |  2 +-
 northd/ovn-northd-ddlog.c | 21 +++++++++++----------
 3 files changed, 13 insertions(+), 12 deletions(-)

Comments

0-day Robot May 7, 2021, 5:07 a.m. UTC | #1
Bleep bloop.  Greetings Ben Pfaff, I am a robot and I have tried out your patch.
Thanks for your contribution.

I encountered some error that I wasn't expecting.  See the details below.


checkpatch:
WARNING: Unexpected sign-offs from developers who are not authors or co-authors or committers: Ben Pfaff <blp@ovn.org>
Lines checked: 133, Warnings: 1, Errors: 0


Please check this out.  If you feel there has been an error, please email aconole@redhat.com

Thanks,
0-day Robot
diff mbox series

Patch

diff --git a/NEWS b/NEWS
index 67c8b5f8bb38..b8efc28def60 100644
--- a/NEWS
+++ b/NEWS
@@ -5,7 +5,7 @@  Post-v21.03.0
     needed for the southbound database when northbound changes occur.  It is
     expected to scale better than the C implementation, for large deployments.
     (This may take testing and tuning to be effective.)  This version of OVN
-    requires DDLog 0.36.
+    requires DDLog 0.38.
   - Introduce ovn-controller incremental processing engine statistics
   - Introduced parallel processing in ovn-northd with the NB_Global config option
     'use_parallel_build' to enable it.  It is disabled by default.
diff --git a/northd/lrouter.dl b/northd/lrouter.dl
index 312ceb9fcd12..f5738b2cc81d 100644
--- a/northd/lrouter.dl
+++ b/northd/lrouter.dl
@@ -392,7 +392,7 @@  LogicalRouterSnatIP(lr, snat_ip, Some{nat}) :-
 
 function group_to_setunionmap(g: Group<'K1, ('K2,Set<'V>)>): Map<'K2,Set<'V>> {
     var map = map_empty();
-    for (entry in g) {
+    for ((entry, _) in g) {
         (var key, var value) = entry;
         match (map.get(key)) {
             None -> map.insert(key, value),
diff --git a/northd/ovn-northd-ddlog.c b/northd/ovn-northd-ddlog.c
index ca1ab325448c..74f0eaccd5bb 100644
--- a/northd/ovn-northd-ddlog.c
+++ b/northd/ovn-northd-ddlog.c
@@ -79,10 +79,11 @@  static table_id WARNING_TABLE_ID;
 static table_id NB_CFG_TIMESTAMP_ID;
 
 /* Initialize frequently used table ids. */
-static void init_table_ids(void)
+static void
+init_table_ids(ddlog_prog ddlog)
 {
-    WARNING_TABLE_ID = ddlog_get_table_id("helpers::Warning");
-    NB_CFG_TIMESTAMP_ID = ddlog_get_table_id("NbCfgTimestamp");
+    WARNING_TABLE_ID = ddlog_get_table_id(ddlog, "helpers::Warning");
+    NB_CFG_TIMESTAMP_ID = ddlog_get_table_id(ddlog, "NbCfgTimestamp");
 }
 
 struct northd_ctx {
@@ -347,7 +348,8 @@  ddlog_clear(struct northd_ctx *ctx)
     int n_failures = 0;
     for (int i = 0; ctx->input_relations[i]; i++) {
         char *table = xasprintf("%s%s", ctx->prefix, ctx->input_relations[i]);
-        if (ddlog_clear_relation(ctx->ddlog, ddlog_get_table_id(table))) {
+        if (ddlog_clear_relation(ctx->ddlog, ddlog_get_table_id(ctx->ddlog,
+                                                                table))) {
             n_failures++;
         }
         free(table);
@@ -611,7 +613,7 @@  northd_update_probe_interval(struct northd_ctx *nb, struct northd_ctx *sb)
      * Any other value is an explicit probe interval request from the
      * database. */
     int probe_interval = 0;
-    table_id tid = ddlog_get_table_id("Northd_Probe_Interval");
+    table_id tid = ddlog_get_table_id(nb->ddlog, "Northd_Probe_Interval");
     ddlog_delta *probe_delta = ddlog_delta_remove_table(nb->delta, tid);
     ddlog_delta_enumerate(probe_delta, northd_update_probe_interval_cb, (uintptr_t) &probe_interval);
     ddlog_free_delta(probe_delta);
@@ -670,7 +672,7 @@  ddlog_table_update_output(struct ds *ds, ddlog_prog ddlog, ddlog_delta *delta,
         return;
     }
     char *table_name = xasprintf("%s::Out_%s", db, table);
-    ddlog_delta_clear_table(delta, ddlog_get_table_id(table_name));
+    ddlog_delta_clear_table(delta, ddlog_get_table_id(ddlog, table_name));
     free(table_name);
 
     if (!updates[0]) {
@@ -948,7 +950,7 @@  get_database_ops(struct northd_ctx *ctx)
              * We require output-only tables to have an accompanying index
              * named <table>_Index. */
             char *index = xasprintf("%s_Index", table);
-            index_id idxid = ddlog_get_index_id(index);
+            index_id idxid = ddlog_get_index_id(ctx->ddlog, index);
             if (idxid == -1) {
                 VLOG_WARN_RL(&rl, "%s: unknown index", index);
                 free(index);
@@ -1000,7 +1002,7 @@  get_database_ops(struct northd_ctx *ctx)
     static int64_t old_sb_cfg_timestamp = INT64_MIN;
     int64_t new_sb_cfg = old_sb_cfg;
     if (ctx->has_timestamp_columns) {
-        table_id sb_cfg_tid = ddlog_get_table_id("SbCfg");
+        table_id sb_cfg_tid = ddlog_get_table_id(ctx->ddlog, "SbCfg");
         ddlog_delta *sb_cfg_delta = ddlog_delta_remove_table(ctx->delta,
                                                              sb_cfg_tid);
         ddlog_delta_enumerate(sb_cfg_delta, northd_update_sb_cfg_cb,
@@ -1149,8 +1151,6 @@  main(int argc, char *argv[])
     int retval;
     bool exiting;
 
-    init_table_ids();
-
     fatal_ignore_sigpipe();
     ovs_cmdl_proctitle_init(argc, argv);
     set_program_name(argv[0]);
@@ -1180,6 +1180,7 @@  main(int argc, char *argv[])
     if (!ddlog) {
         ovs_fatal(0, "DDlog instance could not be created");
     }
+    init_table_ids(ddlog);
 
     unixctl_command_register("enable-cpu-profiling", "", 0, 0,
                              ovn_northd_enable_cpu_profiling, ddlog);