summaryrefslogtreecommitdiff
path: root/ovsdb
diff options
context:
space:
mode:
authorDumitru Ceara <dceara@redhat.com>2022-05-16 13:15:24 +0200
committerIlya Maximets <i.maximets@ovn.org>2022-05-30 23:04:17 +0200
commit2c24daa099f39a24febf96891694cb000ac62bf8 (patch)
tree45db0b7fb57de305959f680c5d6ab0cd56dc90cb /ovsdb
parent3ecfaf136181e6fccc4b23dcea6816244d0b5277 (diff)
downloadopenvswitch-2c24daa099f39a24febf96891694cb000ac62bf8.tar.gz
raft: Don't use HMAP_FOR_EACH_SAFE when logging commands.
There's no need to do that because we're not changing the hmap. Also, if DEBUG logging is disabled there's no need to iterate at all. Fixes: 5a9b53a51ec9 ("ovsdb raft: Fix duplicated transaction execution when leader failover.") Signed-off-by: Dumitru Ceara <dceara@redhat.com> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Diffstat (limited to 'ovsdb')
-rw-r--r--ovsdb/raft.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/ovsdb/raft.c b/ovsdb/raft.c
index f9fa6443b..856d083f2 100644
--- a/ovsdb/raft.c
+++ b/ovsdb/raft.c
@@ -2285,8 +2285,12 @@ raft_command_initiate(struct raft *raft,
static void
log_all_commands(struct raft *raft)
{
+ if (!VLOG_IS_DBG_ENABLED()) {
+ return;
+ }
+
struct raft_command *cmd;
- HMAP_FOR_EACH_SAFE (cmd, hmap_node, &raft->commands) {
+ HMAP_FOR_EACH (cmd, hmap_node, &raft->commands) {
VLOG_DBG("raft command eid: "UUID_FMT, UUID_ARGS(&cmd->eid));
}
}