Copilot commented on code in PR #13645:
URL: https://github.com/apache/trafficserver/pull/13645#discussion_r3946223972


##########
src/proxy/logging/Log.cc:
##########
@@ -304,6 +304,13 @@ struct LoggingFlushContinuation : public Continuation {
   }
 };
 
+void
+Log::register_field(LogField *field)
+{
+  global_field_list.add(field);
+  field_symbol_hash.emplace(field->symbol(), field);
+}

Review Comment:
   Log::register_field() can still leave global_field_list and 
field_symbol_hash out of sync if the hash insertion fails (e.g., duplicate 
symbol): the field is always added to the list, but emplace() may not insert. 
Consider inserting into the hash first and only adding to the list when 
insertion succeeds (and otherwise log + delete the new field) to keep the 
helper’s “single source of truth” invariant true in all cases.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to