-
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: Remove dummy fetch in the get API #334
Conversation
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.
๋ฆฌ๋ทฐ ์๋ฃ
*value_length= memcached_string_length(&result->value); | ||
if (flags) | ||
*flags= result->item_flags; | ||
} |
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_fetch_result() != NULL ๊ฒฝ์ฐ๊ฐ 2ํ ์ด์ ๋ฐ์ํ๋ ๊ฒฝ์ฐ๋ ๊ณ ๋ คํ์์ฃ .
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
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_fetch_result() != NULL ๊ฒฝ์ฐ๊ฐ 2ํ ์ด์ ๋ฐ์ํ๋ ๊ฒฝ์ฐ๋ ๊ณ ๋ คํ์์ฃ .
์์ ์ ์ด๋ ๊ฒ ์ฝ๋ฉํธ ํ์ง๋ง, ์ด๋ฌํ ๊ฒฝ์ฐ๊ฐ ๋ฐ์ํ์ง ์๋๋ค๊ณ ๋ณด๋ ๊ฒ์ด ๋ง๊ฒ ์ฃ ?
๋ง์ฝ์ SW ๋ฒ๊ทธ๋ฅผ ๊ณ ๋ คํ๋๋ผ๋ END ์ด์ ์ ๊ฐ์ฅ ๋ง์ง๋ง ๊ฐ์ ๋ฐํํ๋ฉด ๋ ๊ฒ ๊ฐ์ต๋๋ค.
*error = ENGINE_SUCCESS;
while (memcached_fetch_result(ptr, result, error) != NULL)
{
value= memcached_string_take_value(&result->value);
if (value_length)
*value_length= memcached_string_length(&result->value);
if (flags)
*flags= result->item_flags;
}
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.
while loop ์์ ์๋ ์ฝ๋๊ฐ ์์ด์ผ ํ์ฃ ?
if (value)
memcached_free(value);
if (success_occurred) | ||
{ | ||
*error= 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.
success_occurred ๊ฒฝ์ฐ๋ value != NULL ์ํ์
๋๋ค.
success_occurred ๋ณ์๊ฐ ํ์ ์์ ๊ฒ ๊ฐ์ต๋๋ค.
๊ทธ๋ฆฌ๊ณ , ์ด๋ฌํ ์ฝ๋๋ value == NULL
๊ฒฝ์ฐ์ ๋ํ ์ฒ๋ฆฌ ์ฝ๋ ๋ค์์ ์์นํ๋ ๊ฒ์ด ์ข๊ฒ ์ต๋๋ค.
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.
value์ ๋น ๋ฌธ์์ด์ ์ ์ฅํ์ ๊ฒฝ์ฐ, value == NULL
์ด ๋ ์ ์์ต๋๋ค.
์ฉ์ด๋ฅผ success_occurred์์ is_value_fetched๋ก ๋ณ๊ฒฝํ์ต๋๋ค.
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
์ง๋ฌธ์
๋๋ค.
- value == ""(๋น ๋ฌธ์์ด)์ ์ ์ฅํ๊ณ ๋์, ์ด๋ฅผ ์กฐํํ๋ฉด ๋น ๋ฌธ์์ด์ด ๋ฆฌํด๋์ด์ผ ํ์ง ์๋์?
- value == NULL๋ก ํด์ ์ ์ฅํ ์ ์๋์?
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.
result->value์๋ ๋น ๋ฌธ์์ด์ด ๋ค์ด๊ฐ๋๋ฐ, ์ด๋ฅผ ๋ค์ value์ copyํ์ฌ ๋ฃ๋ ๊ณผ์ ์์ NULL๋ก ๋ณํ๋ฉ๋๋ค.
memcached_string_take_value ํจ์ ๋ด๋ถ ๋์์์ ๋ฌธ์์ด์ ๊ธธ์ด๊ฐ 0์ด๋ฉด NULL์ ๋ฐํํ๋๋ก ๋์ด ์๊ธฐ ๋๋ฌธ์
๋๋ค
if (not memcached_string_length(string))
return NULL;
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.
value == NULL๋ก ํด์ ์ ์ฅํ ์ ์๋์?
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.
value == NULL๋ก ํด์ ์ ์ฅํ ์ ์๋์?
๋ถ๊ฐ๋ฅํฉ๋๋ค. ์๋ฒ ์ธก์์๋ value์ NULL ๊ฐ์ ์ ์ฅํ ์ ์์ผ๋ฉฐ,
ํด๋ผ์ด์ธํธ ์ธก์๋ NULL Value๋ฅผ ์ฒ๋ฆฌํ๋ ๊ธฐ๋ฅ์ด ์์ต๋๋ค.
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.
value = NULL, value_length = 0์ผ๋ก ํ์ฌ set ํ๋ฉด ์ด๋ค ์ค๋ฅ๊ฐ ๋ฐ์ํ๋์?
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.
value_length๊ฐ 0์ด๋ฏ๋ก ๋น๋ฌธ์์ด์ด ๋ค์ด๊ฐ๊ฒ ๋ฉ๋๋ค.
memcached_set(memc, "i", 1, NULL, 0, 0, 0);
/* telnet */
get i
VALUE i 0 0
END
@ing-eoking ์ต์ ํ ํด ์ฃผ์ธ์. |
63f1421
to
887b064
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.
๋ฆฌ๋ทฐ ์๋ฃ
*value_length= memcached_string_length(&result->value); | ||
if (flags) | ||
*flags= result->item_flags; | ||
} |
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_fetch_result() != NULL ๊ฒฝ์ฐ๊ฐ 2ํ ์ด์ ๋ฐ์ํ๋ ๊ฒฝ์ฐ๋ ๊ณ ๋ คํ์์ฃ .
์์ ์ ์ด๋ ๊ฒ ์ฝ๋ฉํธ ํ์ง๋ง, ์ด๋ฌํ ๊ฒฝ์ฐ๊ฐ ๋ฐ์ํ์ง ์๋๋ค๊ณ ๋ณด๋ ๊ฒ์ด ๋ง๊ฒ ์ฃ ?
๋ง์ฝ์ SW ๋ฒ๊ทธ๋ฅผ ๊ณ ๋ คํ๋๋ผ๋ END ์ด์ ์ ๊ฐ์ฅ ๋ง์ง๋ง ๊ฐ์ ๋ฐํํ๋ฉด ๋ ๊ฒ ๊ฐ์ต๋๋ค.
*error = ENGINE_SUCCESS;
while (memcached_fetch_result(ptr, result, error) != NULL)
{
value= memcached_string_take_value(&result->value);
if (value_length)
*value_length= memcached_string_length(&result->value);
if (flags)
*flags= result->item_flags;
}
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.
๋ฆฌ๋ทฐ ์๋ฃ
*value_length= memcached_string_length(&result->value); | ||
if (flags) | ||
*flags= result->item_flags; | ||
} |
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.
while loop ์์ ์๋ ์ฝ๋๊ฐ ์์ด์ผ ํ์ฃ ?
if (value)
memcached_free(value);
assert_msg(ptr->query_id >= query_id +1, "Programmer error, the query_id was not incremented."); | ||
//assert_msg(ptr->query_id == query_id +1, "Programmer error, the query_id was not incremented."); | ||
|
||
/* This is for historical reasons */ | ||
if (*error == MEMCACHED_END) | ||
if (is_value_fetched) |
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_value_fetched ๋ผ๋ ๋ณ์๊ฐ ํ์ํ๊ฐ์?
์๋์ ๊ฐ์ด ๊ฒ์ฌํ๋ฉด ๋์ง ์๋์?
if (value)
๋ฉ๋ชจ๋ฆฌ ํด์ ๋ก์ง ์ถ๊ฐํ๊ฒ ์ต๋๋ค.
success์ธ ์ํฉ์์๋ value๊ฐ NULL์ด ๋ ์ ์์ด์ ์์ต๋๋ค. |
๐ Related Issue
โจ๏ธ What I did
ํ์ฌ CentOS7 ํ๊ฒฝ์์ ํ ์คํธ๋ฅผ ์งํํ๋ ๊ฒฝ์ฐ, develop ๋ธ๋์น์์๋ ๋์ผํ๊ฒ ์๋์ ํ ์คํธ๊ฐ ์คํจํฉ๋๋ค.์์ mop_upsert API๋ฅผ ๊ฐ๋ฐํ๋ ๊ณผ์ ์์ ๋ฌธ์ ๊ฐ ์์๋ ๊ฒ์ผ๋ก ๋ณด์ด๋ฉฐ, ์์ธ ๋ถ์์ค์ ์์ต๋๋ค.mop upsert
๊ฐ ์๋ ๊ตฌ๋ฒ์ ์ด๋ผ ์๊ธด ๋ฌธ์ ์์ต๋๋ค.