summaryrefslogtreecommitdiff
path: root/vtep
diff options
context:
space:
mode:
authorIlya Maximets <i.maximets@ovn.org>2022-09-21 22:50:49 +0200
committerIlya Maximets <i.maximets@ovn.org>2022-12-06 16:21:54 +0100
commitb8bf410a5c94173da02279b369d75875c4035959 (patch)
tree19b768539d3d28076bc289321ba5b0b5ae7dfb18 /vtep
parenta77c7796f23a76190b61e2109a009df980253b0f (diff)
downloadopenvswitch-b8bf410a5c94173da02279b369d75875c4035959.tar.gz
db-ctl-base: Use partial map/set updates for last add/set commands.
Currently, command to add one item into a large set generates the transaction with the full new content of that set plus 'wait' operation for the full old content of that set. So, if we're adding one new load-balancer into a load-balancer group in OVN using ovn-nbctl, transaction will include all the existing load-balancers from that groups twice. IDL supports partial updates for sets and maps. The problem with that is changes are not visible to the IDL user until the transaction is committed. That will cause problems for chained ctl commands. However, we still can optimize the very last command in the list. It makes sense to do, since it's a common case for manual invocations. Updating the 'add' command as well as 'set' for a case where we're actually adding one new element to the map. One downside is that we can't check the set size without examining it and checking for duplicates, so allowing the transaction to be sent and constraints to be checked on the server side in that case. Not touching 'remove' operation for now, since removals may have different type, e.g. if elements from the map are removed by the key. The function will likely need to be fully re-written to accommodate all the corner cases. Acked-by: Dumitru Ceara <dceara@redhat.com> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Diffstat (limited to 'vtep')
-rw-r--r--vtep/vtep-ctl.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/vtep/vtep-ctl.c b/vtep/vtep-ctl.c
index 99c4adcd5..e5d99714d 100644
--- a/vtep/vtep-ctl.c
+++ b/vtep/vtep-ctl.c
@@ -2207,9 +2207,9 @@ static const struct ctl_table_class tables[VTEPREC_N_TABLES] = {
static void
vtep_ctl_context_init_command(struct vtep_ctl_context *vtepctl_ctx,
- struct ctl_command *command)
+ struct ctl_command *command, bool last_command)
{
- ctl_context_init_command(&vtepctl_ctx->base, command);
+ ctl_context_init_command(&vtepctl_ctx->base, command, last_command);
vtepctl_ctx->verified_ports = false;
}
@@ -2304,7 +2304,8 @@ do_vtep_ctl(const char *args, struct ctl_command *commands,
}
vtep_ctl_context_init(&vtepctl_ctx, NULL, idl, txn, vtep_global, symtab);
for (c = commands; c < &commands[n_commands]; c++) {
- vtep_ctl_context_init_command(&vtepctl_ctx, c);
+ vtep_ctl_context_init_command(&vtepctl_ctx, c,
+ c == &commands[n_commands - 1]);
if (c->syntax->run) {
(c->syntax->run)(&vtepctl_ctx.base);
}