INTERNAL: Unify elem_item struct layout across collection types#971
Merged
Merged
Conversation
jhpark816
reviewed
May 13, 2026
|
|
||
| elem->refcount = 0; | ||
| elem->nbytes = nbytes; | ||
| elem->nbytes = (uint16_t)nbytes; |
Collaborator
There was a problem hiding this comment.
질문입니다.
주어진 nbytes 값이 65536 이하임이 보장되나요?
list element 쪽도 마찬가지입니다.
Collaborator
Author
There was a problem hiding this comment.
memcached.c의 프로토콜 파싱 단계에서 vlen > settings.max_element_bytes 체크로 검증하고 있으며, settings.max_element_bytes는 엔진 초기화 시 MAXIMUM_MAX_ELEMENT_BYTES(32KB) 이하로 강제됩니다. 따라서 collection 내부까지 내려오는 nbytes는 항상 uint16_t 범위 내임이 보장됩니다.
- 32 * 1024 = 32,768
- uint16_t (0~65,535)
// item_base.h
#define MAXIMUM_MAX_ELEMENT_BYTES (32*1024)
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
uint16_t로 사용하던nbytes를 list, set에도 동일하게 적용하여 모든 elem_item의nbytes타입을uint16_t로 통일하였습니다.reserved필드로 명시적으로 표현하였습니다.char value[]와unsigned char data[]선언 방식의 차이를 확인하였습니다.char value[]로 선언하였으며,unsigned char data[]로 선언하고 변수명도data로 구분하고 있었습니다.