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 <[email protected]>
---
 ovsdb/raft.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/ovsdb/raft.c b/ovsdb/raft.c
index 530c5e5a3d82..c0e6687b484e 100644
--- a/ovsdb/raft.c
+++ b/ovsdb/raft.c
@@ -2266,8 +2266,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));
     }
 }
-- 
2.27.0

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to