KeDeng has posted comments on this change. ( 
http://gerrit.cloudera.org:8080/23061 )

Change subject: [Compile]Fix unaligned pointer warning in CBTree
......................................................................


Patch Set 3:

(3 comments)

http://gerrit.cloudera.org:8080/#/c/23061/2//COMMIT_MSG
Commit Message:

http://gerrit.cloudera.org:8080/#/c/23061/2//COMMIT_MSG@9
PS2, Line 9: When building Kudu wit
> nit: The warning appears on x86 platforms as well.
You're absolutely right — I’ve updated the commit message to clarify that the 
warning appears on both ARM and x86 platforms, though the impact (e.g., 
misaligned access crashing) is more severe on ARM.


http://gerrit.cloudera.org:8080/#/c/23061/2//COMMIT_MSG@23
PS2, Line 23:
> If you are not using it, better to leave it out from here to avoid any conf
Good point. Since the final implementation uses memcpy() directly, I've updated 
the commit message to reflect the actual fix and removed the unused 
alternatives to avoid confusion.


http://gerrit.cloudera.org:8080/#/c/23061/2/src/kudu/tablet/concurrent_btree.h
File src/kudu/tablet/concurrent_btree.h:

http://gerrit.cloudera.org:8080/#/c/23061/2/src/kudu/tablet/concurrent_btree.h@606
PS2, Line 606: num_children_ = new_num_children;
> question: How does this step ensure alignment safety?
Thanks for pointing this out — you're correct. Casting through uintptr_t 
doesn't ensure proper alignment if the source is already unaligned (as is the 
case with packed members). Based on this, I’ve dropped the use of 
Release_Store() entirely.

Since num_children_ is only accessed under exclusive locking, atomic operations 
are unnecessary. The updated patch uses a simple memcpy() to safely write the 
new value without triggering unaligned access or violating aliasing rules.



--
To view, visit http://gerrit.cloudera.org:8080/23061
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ib8e6f7b0d3516409ae99e4c846f839b6868b3deb
Gerrit-Change-Number: 23061
Gerrit-PatchSet: 3
Gerrit-Owner: KeDeng <[email protected]>
Gerrit-Reviewer: Ashwani Raina <[email protected]>
Gerrit-Reviewer: KeDeng <[email protected]>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Zoltan Chovan <[email protected]>
Gerrit-Reviewer: Zoltan Martonka <[email protected]>
Gerrit-Comment-Date: Fri, 04 Jul 2025 09:31:43 +0000
Gerrit-HasComments: Yes

Reply via email to