-
Notifications
You must be signed in to change notification settings - Fork 16
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
INTERNAL: add a function to generate a bkey string #326
Conversation
82010a6
to
8a2737c
Compare
562cf42
to
efe58d1
Compare
bd943db
to
76b7318
Compare
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.
์ผ๋ถ ๋ฆฌ๋ทฐ
libmemcached/collection.cc
Outdated
@@ -215,6 +215,59 @@ static inline bool space_separated_keys_is_supported(memcached_server_write_inst | |||
return false; | |||
} | |||
|
|||
static int generate_str_bkey_from_query(memcached_coll_query_st *query, | |||
char *buffer, const int buffer_length, | |||
bool support_range, bool *is_descending) |
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.
is_descending ์ธ์๋ฅผ ์ ๊ฑฐํฉ์๋ค.
smget ๋ก์ง์ ๋ณด๋, result ๊ฐ์ฒด๋ฅผ ์ค์ ํ๊ธฐ ์ํ ์ฉ๋์ธ ๋ฐ,
์ด ๋ถ๋ถ์ ๋ค๋ฃจ๋ ๋ณ๋ ํจ์๋ฅผ ๋๋ ๊ฒ์ด ๋์ ๊ฒ ๊ฐ์ต๋๋ค.
์ฐธ๊ณ ๋ก, result ๊ฐ์ฒด๋ฅผ ์ค์ ํ๋ ์ฝ๋๋ฅผ ๋จผ์ ๋ฆฌํฉํ ๋งํด์ผ
ํ์ฌ์ PR์ ๋ฐ์ํ ์ ์์ ๊ฒ ๊ฐ์ต๋๋ค.
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.
๋ฆฌ๋ทฐ ์๋ฃ
@ing-eoking ๋ฆฌ๋ทฐํด์ผ ํ๋ ์ํ๊ฐ ๋๋ฉด, noti ์ฝ๋ฉํธ๋ฅผ ๋จ๊ฒจ์ฃผ์ธ์. |
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.
์ผ๋ถ ๋ฆฌ๋ทฐ
libmemcached/collection.cc
Outdated
} | ||
else if (MEMCACHED_COLL_QUERY_BOP_EXT == query->type) | ||
write_length= generate_str_bkey_from_query(query, buffer, buffer_length, false, rc); | ||
if (rc != MEMCACHED_SUCCESS) |
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.
์๋์ ๊ฐ์ด write_length ๊ฐ์ผ๋ก ์คํจ ์ฌ๋ถ๋ฅผ ํ๋จํ ์ ์๊ฒ ํ๋ฉด ์ข๊ฒ ์ต๋๋ค.
๊ทธ๋ฆฌ๊ณ , ์ด๋ค ์ค๋ฅ๋ ์ค์ ํด ๋๋ ๊ฒ๋ ๊ด์ฐฎ์ ๊ฒ ๊ฐ์ต๋๋ค.
if (write_length < 0)
{
return memcached_set_error(*ptr, rc, MEMCACHED_AT,
memcached_literal_param("Invalid bkey query.\n"));
}
์ฐธ๊ณ ๋ก, ๋ฆฌํด ๊ฐ์ด rc ์๋ค๋ฉด, ์๋ ํํ์ ์กฐ๊ฑด์ด ์ข์ ๊ฒ์ ๋๋ค.
if (rc != MEMCACHED_SUCCESS)
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.
๋ฆฌ๋ทฐ ์๋ฃ
libmemcached/collection.cc
Outdated
bkey_str, MEMCACHED_COLL_MAX_BYTE_STRING_LENGTH); | ||
|
||
write_length= snprintf(buffer, buffer_length, " 0x%s", bkey_str); | ||
if (rc == MEMCACHED_INVALID_ARGUMENTS) |
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.
MEMCACHED_INVALID_ARGUMENTS ์ค๋ฅ๋ง ๋ก๊ทธ๋ฅผ ๋จ๊ธธ ํ์๊ฐ ์๋์?
๋ ๋ค ๋จ๊ธฐ๊ฑฐ๋ ๋ ๋ค ๋จ๊ธฐ์ง ์๋ ๊ฒ์ด ์ข๊ฒ ์ต๋๋ค.
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.
์ถ๊ฐ ๋ฆฌ๋ทฐ
์์ PR (#331) ์ด merge๋ ์ํ์ด๋ฏ๋ก, |
libmemcached/collection.cc
Outdated
@@ -215,6 +215,60 @@ static inline bool space_separated_keys_is_supported(memcached_server_write_inst | |||
return false; | |||
} | |||
|
|||
static int generate_str_bkey_from_query(memcached_coll_query_st *query, | |||
char *buffer, const int buffer_length, | |||
bool support_range, memcached_return_t &rc) |
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.
rc pointer type ์ฌ์ฉํ๋ฉด ์ข๊ฒ ์ต๋๋ค.
char *buffer, const int buffer_length, | ||
bool support_range, memcached_return_t *rc) | ||
{ | ||
int write_length= -1; |
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.
์๋ฌ ๋ฐ์ํ์ง ์์์ ๋๋ rc ๊ฐ์ ์ค์ ํด ์ฃผ๋ ๊ฒ์ด ๋ง์ ๋ณด์ ๋๋ค.
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.
generate_str_bkey_from_query
๋ ๋ด๋ถ ํจ์์ด๋ฉฐ, rc ๊ฐ์ด ์ด๋ฏธ ํน์ ๊ฐ์ผ๋ก ์ค์ ๋์์์ ๊ฐ์ ํฉ๋๋ค.
๊ธฐ์กด์ ์ค์ ๋ rc ๊ฐ์ ๋ค์ ์ค์ ํ ํ์๋ ์์ ๊ฒ ๊ฐ์ต๋๋ค.
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.
์ด๋ฏธ ์ค์ ๋ rc ํน์ ๊ฐ์ ๋ฌด์์ธ๊ฐ์?
์๋ฌ๊ฐ ๋ฐ์ํ์ง ์์๋๋ฐ ๊ธฐ ์ค์ ๋ rc๊ฐ์ ๋ฎ์ด์ฐ๊ฒ ๋๋ฉด ๋ฌธ์ ๊ฐ ์๊ณ ,
์๋ฌ๊ฐ ๋ฐ์ํ์ ๋๋ ๊ธฐ์กด rc๊ฐ์ ๋ฌด์ํ๊ณ ์๋ก์ด ๊ฐ์ผ๋ก ๋ณ๊ฒฝํด๋ ๋ฌธ์ ๊ฐ ์๋ ๊ฒ์ธ๊ฐ์?
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.
rc ๊ฐ์ ์ค์ ํ๋ ๊ฒ์๋ ๋ฌธ์ ๊ฐ ์์ง๋ง, generate_str_bkey_from_query ํจ์๋ ๊ฐ์ฅ ์ด๊ธฐ์ ํธ์ถ๋๋ ํจ์๊ฐ ์๋๋ฏ๋ก, ์ด ํจ์๊ฐ ํธ์ถ๋ ๋ rc ๊ฐ์ ์ด๋ฏธ ์ด๊ธฐํ๋์ด ์๋ค๊ณ ๊ฐ์ ํ๊ณ ์์ต๋๋ค.
์๋ฌ ๋ฐ์ ์ฌ๋ถ๋ ๋ฆฌํด๊ฐ์ด -1์ธ์ง๋ฅผ ํตํด ํ์ธํ ์ ์์ผ๋ฉฐ, rc ๊ฐ์ ์๋ฌ์ ๋ ๊ตฌ์ฒด์ ์ธ ์์ธ์ ์ ๊ณตํ๋ ์ฉ๋๋ก ์ฌ์ฉ๋ฉ๋๋ค.
๋ฐ๋ผ์, ์๋ฌ๊ฐ ๋ฐ์ํ์ง ์์ ์ํฉ์์ rc ๊ฐ์ ๋ค์ ์ค์ ํ ํ์๋ ์๋ค๊ณ ์๊ฐํฉ๋๋ค.
๋ง์ฝ write_length์ rc ๋ ๊ฐ์ generate_str_bkey_from_query ํจ์์ ๋ฆฌํด๊ฐ์ผ๋ก ์ฒ๋ฆฌํ๋ค๊ณ ๋ณธ๋ค๋ฉด, ์คํ๋ ค rc๋ฅผ ๋ฆฌํดํ๊ณ write_length๋ฅผ ํฌ์ธํฐ ์ธ์๋ก ๋ฐ๋ ๋ฐฉ์์ด ๋ ๊น๋ํ์ ๊ฒ์ ๋๋ค.
rc๋ผ๋ ์ฉ์ด๋ ํผ๋์ ์ผ์ผํฌ ์ ์์ผ๋ฏ๋ก, ์ด๋ฅผ error๋ผ๋ ์ฉ์ด๋ก ๋ณ๊ฒฝํ๋ ํธ์ด ์ข์ ๊ฒ ๊ฐ์ต๋๋ค.
๐ Related Issue
โจ๏ธ What I did