Conversation
| #include "swoc/Scalar.h" | ||
|
|
||
| HostDBRecord * | ||
| HostDBRecord::alloc(swoc::TextView query_name, unsigned int rr_count, size_t srv_name_size) |
There was a problem hiding this comment.
Note: this is duplicated change with in HostDB.cc. However, this avoids issue with ld. #12851
There was a problem hiding this comment.
Pull request overview
This PR adds port number tracking to HostDBRecord to improve the clarity of traffic_ctl hostdb status output. Since port is part of the hash key calculation but wasn't previously stored in the record, it was unclear which entry corresponded to which port in the output.
Changes:
- Added
_portfield toHostDBRecordclass to store the port number - Updated
HostDBRecord::alloc()signature to accept port parameter - Enhanced JSON output with "port" and "hash_key" fields for better record identification
- Added empty partition filtering to avoid outputting empty partitions in JSON
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| include/iocore/hostdb/HostDBProcessor.h | Added _port private field, port() getter method, and updated alloc() signature with port parameter |
| src/iocore/hostdb/HostDB.cc | Updated alloc() implementation to initialize _port field and modified callsites to pass port values |
| src/iocore/hostdb/test_HostFile.cc | Updated test version of alloc() to match new signature |
| src/mgmt/rpc/handlers/hostdb/HostDB.cc | Added port and hash_key to JSON output metadata and added empty partition filtering |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
To clarify HostDB records by
traffic_ctl hostdb statuscmd.Prior to the change, port is one of key to calculate hash. However, HostDBRecord doesn't store it, so in the list of HostDBRecored, it was unclear which entry is which.
New
traffic_ctl hostdb statusresult is below.portandhash_keyis the new fields.