add request head to getGCState#234
Conversation
📝 WalkthroughWalkthroughThe Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/pd/Client.cc (1)
371-374: Attach the allocated header before mutating request-specific fields.Line 371 holds an owning raw pointer until Line 374. Attach it immediately, then mutate the request-owned header; this also removes the redundant
cluster_idassignment becauserequestHeader()already sets it.♻️ Proposed refactor
- auto * header = requestHeader(); - header->set_cluster_id(cluster_id); - header->set_caller_id("tiflash"); - request.set_allocated_header(header); + request.set_allocated_header(requestHeader()); + request.mutable_header()->set_caller_id("tiflash");🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/pd/Client.cc` around lines 371 - 374, Obtain the header via requestHeader(), immediately call request.set_allocated_header(header) to transfer ownership, then mutate request-owned fields (e.g., call header->set_caller_id("tiflash")); remove the redundant header->set_cluster_id(cluster_id) because requestHeader() already initializes cluster_id. This ensures no lingering owning raw pointer and that mutations happen on the request-owned header.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/pd/Client.cc`:
- Around line 371-374: Obtain the header via requestHeader(), immediately call
request.set_allocated_header(header) to transfer ownership, then mutate
request-owned fields (e.g., call header->set_caller_id("tiflash")); remove the
redundant header->set_cluster_id(cluster_id) because requestHeader() already
initializes cluster_id. This ensures no lingering owning raw pointer and that
mutations happen on the request-owned header.
|
@JaySon-Huang: adding LGTM is restricted to approvers and reviewers in OWNERS files. DetailsIn response to this: Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
@wfxr: adding LGTM is restricted to approvers and reviewers in OWNERS files. DetailsIn response to this: Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: 3pointer, cfzjywxk, gengliqi, JaySon-Huang, wfxr The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/merge |
|
/retest |
|
/merge |
Signed-off-by: Calvin Neo <calvinneo1995@gmail.com>
Summary by CodeRabbit