-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FEATURE : Add block allocator for more efficient memory management(task/eblock) #113
Closed
Closed
Changes from 5 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
06d95da
FEATURE : Add block allocator for moere efficient memory management
jooho812 2c3285b
CLEANUP : change the range type of bop gbp
jooho812 2de0288
CLEANUP : add btree_elem_mget
jooho812 1ba8c5c
Merge branch 'task/eblock' into jooho812/block_allocator
jooho812 bd09794
CLEANUP : reflected minwoojin reviews
jooho812 5cb240b
CLEANUP : reflected minwoojin review
jooho812 c110481
CLEANUP : reflected minwoojin review3
jooho812 9d37f89
CLEANUP : reflected jhpark816 review
jooho812 6341ad4
CLEANUP : reflected minwoojin review
jooho812 88bdb04
CLEANUP : reflected reviews
jooho812 17aaf07
CLEANUP : modified eblk_add_elem_with_posi
jooho812 c8e71d8
CLEANUP : reflected minwoojin review
jooho812 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -777,13 +777,23 @@ default_btree_elem_alloc(ENGINE_HANDLE* handle, const void* cookie, | |
return ret; | ||
} | ||
|
||
#ifdef USE_EBLOCK_RESULT | ||
static void | ||
default_btree_elem_release(ENGINE_HANDLE* handle, const void *cookie, | ||
eitem *eitem, EITEM_TYPE type) | ||
{ | ||
struct default_engine *engine = get_handle(handle); | ||
btree_elem_release(engine, eitem, type); | ||
} | ||
#else | ||
static void | ||
default_btree_elem_release(ENGINE_HANDLE* handle, const void *cookie, | ||
eitem **eitem_array, const int eitem_count) | ||
{ | ||
struct default_engine *engine = get_handle(handle); | ||
btree_elem_release(engine, (btree_elem_item**)eitem_array, eitem_count); | ||
} | ||
#endif | ||
|
||
static ENGINE_ERROR_CODE | ||
default_btree_elem_insert(ENGINE_HANDLE* handle, const void* cookie, | ||
|
@@ -879,7 +889,11 @@ default_btree_elem_get(ENGINE_HANDLE* handle, const void* cookie, | |
const bkey_range *bkrange, const eflag_filter *efilter, | ||
const uint32_t offset, const uint32_t req_count, | ||
const bool delete, const bool drop_if_empty, | ||
#ifdef USE_EBLOCK_RESULT | ||
eblock_result_t *eblk_ret, | ||
#else | ||
eitem** eitem_array, uint32_t* eitem_count, | ||
#endif | ||
uint32_t *access_count, uint32_t* flags, | ||
bool* dropped_trimmed, uint16_t vbucket) | ||
{ | ||
|
@@ -890,12 +904,36 @@ default_btree_elem_get(ENGINE_HANDLE* handle, const void* cookie, | |
if (delete) ACTION_BEFORE_WRITE(cookie, key, nkey); | ||
ret = btree_elem_get(engine, key, nkey, bkrange, efilter, | ||
offset, req_count, delete, drop_if_empty, | ||
#ifdef USE_EBLOCK_RESULT | ||
eblk_ret, EBLOCK_RESULT_SINGLE, | ||
#else | ||
(btree_elem_item**)eitem_array, eitem_count, | ||
#endif | ||
access_count, flags, dropped_trimmed); | ||
if (delete) ACTION_AFTER_WRITE(cookie, ret); | ||
return ret; | ||
} | ||
|
||
#ifdef USE_EBLOCK_RESULT | ||
static ENGINE_ERROR_CODE | ||
default_btree_elem_mget(ENGINE_HANDLE* handle, const void* cookie, | ||
const token_t *key_tokens, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. numkeys는 key_tokens 바로다음에 오는게 나을 것 같습니다. |
||
const bkey_range *bkrange, const eflag_filter *efilter, | ||
const uint32_t offset, const uint32_t req_count, | ||
eblock_result_t *eblk_ret, uint32_t numkeys, | ||
uint32_t *access_count, uint16_t vbucket) | ||
{ | ||
struct default_engine *engine = get_handle(handle); | ||
ENGINE_ERROR_CODE ret; | ||
VBUCKET_GUARD(engine, vbucket); | ||
|
||
ret = btree_elem_mget(engine, key_tokens, bkrange, efilter, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 이부분도 key_tokens 다음 numkeys가 나오는게 나을 것 같습니다. |
||
offset, req_count, | ||
eblk_ret, numkeys, access_count); | ||
return ret; | ||
} | ||
#endif | ||
|
||
static ENGINE_ERROR_CODE | ||
default_btree_elem_count(ENGINE_HANDLE* handle, const void* cookie, | ||
const void* key, const int nkey, | ||
|
@@ -932,17 +970,27 @@ default_btree_posi_find_with_get(ENGINE_HANDLE* handle, const void* cookie, | |
const char *key, const size_t nkey, | ||
const bkey_range *bkrange, | ||
ENGINE_BTREE_ORDER order, const uint32_t count, | ||
#ifdef USE_EBLOCK_RESULT | ||
int *position, eblock_result_t *eblk_ret, | ||
uint32_t *eitem_index, | ||
#else | ||
int *position, eitem **eitem_array, | ||
uint32_t *eitem_count, uint32_t *eitem_index, | ||
#endif | ||
uint32_t *flags, uint16_t vbucket) | ||
{ | ||
struct default_engine *engine = get_handle(handle); | ||
ENGINE_ERROR_CODE ret; | ||
VBUCKET_GUARD(engine, vbucket); | ||
|
||
ret = btree_posi_find_with_get(engine, key, nkey, bkrange, order, count, | ||
#ifdef USE_EBLOCK_RESULT | ||
position, eblk_ret, | ||
eitem_index, flags); | ||
#else | ||
position, (btree_elem_item**)eitem_array, | ||
eitem_count, eitem_index, flags); | ||
#endif | ||
return ret; | ||
} | ||
|
||
|
@@ -951,15 +999,23 @@ default_btree_elem_get_by_posi(ENGINE_HANDLE* handle, const void* cookie, | |
const char *key, const size_t nkey, | ||
ENGINE_BTREE_ORDER order, | ||
uint32_t from_posi, uint32_t to_posi, | ||
#ifdef USE_EBLOCK_RESULT | ||
eblock_result_t *eblk_ret, | ||
#else | ||
eitem **eitem_array, uint32_t *eitem_count, | ||
#endif | ||
uint32_t *flags, uint16_t vbucket) | ||
{ | ||
struct default_engine *engine = get_handle(handle); | ||
ENGINE_ERROR_CODE ret; | ||
VBUCKET_GUARD(engine, vbucket); | ||
|
||
ret = btree_elem_get_by_posi(engine, key, nkey, order, from_posi, to_posi, | ||
#ifdef USE_EBLOCK_RESULT | ||
eblk_ret, | ||
#else | ||
(btree_elem_item**)eitem_array, eitem_count, | ||
#endif | ||
flags); | ||
return ret; | ||
} | ||
|
@@ -973,10 +1029,16 @@ default_btree_elem_smget_old(ENGINE_HANDLE* handle, const void* cookie, | |
const bkey_range *bkrange, | ||
const eflag_filter *efilter, | ||
const uint32_t offset, const uint32_t count, | ||
#ifdef USE_EBLOCK_RESULT | ||
eblock_result_t *eblk_ret, | ||
uint32_t* kfnd_array, | ||
uint32_t* flag_array, | ||
#else | ||
eitem** eitem_array, | ||
uint32_t* kfnd_array, | ||
uint32_t* flag_array, | ||
uint32_t* eitem_count, | ||
#endif | ||
uint32_t* missed_key_array, | ||
uint32_t* missed_key_count, | ||
bool *trimmed, bool *duplicated, | ||
|
@@ -987,8 +1049,13 @@ default_btree_elem_smget_old(ENGINE_HANDLE* handle, const void* cookie, | |
VBUCKET_GUARD(engine, vbucket); | ||
|
||
ret = btree_elem_smget_old(engine, karray, kcount, bkrange, efilter, | ||
#ifdef USE_EBLOCK_RESULT | ||
offset, count, eblk_ret, | ||
kfnd_array, flag_array, | ||
#else | ||
offset, count, (btree_elem_item**)eitem_array, | ||
kfnd_array, flag_array, eitem_count, | ||
#endif | ||
missed_key_array, missed_key_count, | ||
trimmed, duplicated); | ||
return ret; | ||
|
@@ -1591,6 +1658,9 @@ create_instance(uint64_t interface, GET_SERVER_API get_server_api, | |
.btree_elem_delete = default_btree_elem_delete, | ||
.btree_elem_arithmetic = default_btree_elem_arithmetic, | ||
.btree_elem_get = default_btree_elem_get, | ||
#ifdef USE_EBLOCK_RESULT | ||
.btree_elem_mget = default_btree_elem_mget, | ||
#endif | ||
.btree_elem_count = default_btree_elem_count, | ||
.btree_posi_find = default_btree_posi_find, | ||
.btree_posi_find_with_get = default_btree_posi_find_with_get, | ||
|
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
posi 라는 값이
eblock result에 들어가는 전체 element들에서의 위치 값이기 때문에,
어떤 mblock과 그 mblock 내에서의 index 값이 계산되어야 합니다.
위 코드는 어떤 mblock인지를 찾지 않고
단순히 tail block에 넣는 것을 가정하고 있네요.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이 함수를 만든게 bop pwg연산 때문에 만들었고 이 연산에서 validation check할때 element 갯수를 100개로 제한하고 있어서 현재는 어떤 mblock인지 찾을 필요없이 그냥 넣으면 될 것 같아서 주석과 assert문만 넣어두었는데 어떤 mblock인지 찾는걸 추가해 둘까요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
예. 어떤 mblock인지를 확인하는 것이 보다 안전해 보여요.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
반영해두겠습니다.