Repository navigation
FIX: Align the data of zset_elem_item to 8 bytes - #1052
Merged
Merged
Conversation
Collaborator
예전 RISC CPU / Unix 환경에서 이러한 문제가 실제로 많았습니다. |
jhpark816
approved these changes
Nov 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🔗 Related Issue
⌨️ What I did
zset_elem_item의data가 8바이트 정렬되도록hval뒤에 4바이트reserved를 추가했습니다.zset_elem_item은 hash tree에 연결되기 위해next,hval을htree_elem_item과 같은 위치에 둡니다.그 결과
data가 offset 20에서 시작해,data맨 앞의 uint64 score가 8바이트 정렬되지 않았습니다.bplus tree는 score를
UINT64_COMP등으로*(const uint64_t *)역참조해 비교하므로, 정렬되지 않은 주소에서 uint64를 읽게 됩니다.x86_64, ARM64는 정렬되지 않은 읽기를 하드웨어가 처리해 실제 동작에는 문제가 없지만, C 표준상 정의되지 않은 동작이라 컴파일러 최적화나 다른 플랫폼에서 문제가 될 수 있어 수정했습니다.