You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@trafficserver.apache.org by GitBox <gi...@apache.org> on 2023/01/13 22:26:19 UTC

[GitHub] [trafficserver] bneradt commented on a diff in pull request #9306: Updated warning message for adding duplicated remap entries

bneradt commented on code in PR #9306:
URL: https://github.com/apache/trafficserver/pull/9306#discussion_r1070130973


##########
proxy/http/remap/UrlRewrite.cc:
##########
@@ -769,7 +769,7 @@ UrlRewrite::TableInsert(std::unique_ptr<URLTable> &h_table, url_mapping *mapping
     h_table->emplace(src_host, ht_contents);
   }
   if (!ht_contents->Insert(mapping)) {
-    Warning("Could not insert new mapping");
+    Warning("Could not insert new mapping: duplicated entry exists.");

Review Comment:
   It's not immediately obvious here that the only reason that `Insert` would return false is that there is a duplicate. Looking at [the code](https://github.com/apache/trafficserver/blob/f1ece8382a54fcbc7e3416e427b26d25b3177986/include/tscore/Trie.h#L169), as I'm sure you did, that seems to be the case. Let's add a comment assuring the reader of the code that this is true:
   
   ```
   // Trie::Insert only fails due to an attempt to add a duplicate entry.
   ```



-- 
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: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org