Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion engines/default/coll_list.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ static list_elem_item *do_list_elem_alloc(const uint32_t nbytes, const void *coo
assert(elem->slabs_clsid > 0);

elem->refcount = 0;
elem->nbytes = nbytes;
elem->nbytes = (uint16_t)nbytes;
elem->status = ELEM_STATUS_UNLINKED; /* unlinked state */
}
return elem;
Expand Down
2 changes: 1 addition & 1 deletion engines/default/coll_set.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ static set_elem_item *do_set_elem_alloc(const uint32_t nbytes, const void *cooki
assert(elem->slabs_clsid > 0);

elem->refcount = 0;
elem->nbytes = nbytes;
elem->nbytes = (uint16_t)nbytes;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์งˆ๋ฌธ์ž…๋‹ˆ๋‹ค.
์ฃผ์–ด์ง„ nbytes ๊ฐ’์ด 65536 ์ดํ•˜์ž„์ด ๋ณด์žฅ๋˜๋‚˜์š”?
list element ์ชฝ๋„ ๋งˆ์ฐฌ๊ฐ€์ง€์ž…๋‹ˆ๋‹ค.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

elem->status = ELEM_STATUS_UNLINKED; /* unlinked state */
}
return elem;
Expand Down
31 changes: 17 additions & 14 deletions engines/default/item_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,10 @@ typedef struct _list_elem_item {
uint16_t refcount;
uint8_t slabs_clsid; /* which slab class we're in */
uint8_t status; /* element lifecycle state: linked(in-list) or unlinked(removed but referenced) */
uint16_t reserved; /* reserved space */
uint16_t nbytes; /**< The total size of the data (in bytes) */
struct _list_elem_item *next; /* next chain in double linked list */
struct _list_elem_item *prev; /* prev chain in double linked list */
uint32_t nbytes; /**< The total size of the data (in bytes) */
char value[]; /**< the data itself */
} list_elem_item;

Expand All @@ -183,9 +184,10 @@ typedef struct _set_elem_item {
uint16_t refcount;
uint8_t slabs_clsid; /* which slab class we're in */
uint8_t status; /* element lifecycle state: linked(in-set) or unlinked(removed but referenced) */
uint32_t hval; /* hash value */
uint16_t reserved; /* reserved space */
uint16_t nbytes; /**< The total size of the data (in bytes) */
struct _set_elem_item *next; /* hash chain next */
uint32_t nbytes; /**< The total size of the data (in bytes) */
uint32_t hval; /* hash value */
char value[]; /**< the data itself */
} set_elem_item;

Expand All @@ -194,10 +196,11 @@ typedef struct _map_elem_item {
uint16_t refcount;
uint8_t slabs_clsid; /* which slab class we're in */
uint8_t status; /* element lifecycle state: linked(in-map) or unlinked(removed but referenced) */
uint32_t hval; /* hash value */
struct _map_elem_item *next; /* hash chain next */
uint8_t nfield; /**< The total size of the field (in bytes) */
uint8_t nfield; /**< The total size of the field (in bytes) */
uint8_t reserved; /* reserved space */
uint16_t nbytes; /**< The total size of the data (in bytes) */
struct _map_elem_item *next; /* hash chain next */
uint32_t hval; /* hash value */
unsigned char data[]; /* data: <field, value> */
} map_elem_item;

Expand Down Expand Up @@ -301,14 +304,14 @@ typedef struct _btree_indx_node {
} btree_indx_node;

typedef struct _btree_meta_info {
int32_t mcnt; /* maximum count */
int32_t ccnt; /* current count */
uint8_t ovflact; /* overflow action */
uint8_t mflags; /* sticky, readable, trimmed flags */
uint16_t itdist; /* distance from hash item (unit: sizeof(size_t)) */
uint32_t stotal; /* total space */
uint8_t bktype; /* bkey type : BKEY_TYPE_UINT64 or BKEY_TYPE_BINARY */
uint8_t dummy[7]; /* reserved space */
int32_t mcnt; /* maximum count */
int32_t ccnt; /* current count */
uint8_t ovflact; /* overflow action */
uint8_t mflags; /* sticky, readable, trimmed flags */
uint16_t itdist; /* distance from hash item (unit: sizeof(size_t)) */
uint32_t stotal; /* total space */
uint8_t bktype; /* bkey type : BKEY_TYPE_UINT64 or BKEY_TYPE_BINARY */
uint8_t reserved[7]; /* reserved space */
bkey_t maxbkeyrange;
btree_indx_node *root;
} btree_meta_info;
Expand Down
Loading