-
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
INTERNAL: Fix the invalid allowable range of run options #732
Conversation
memcached.c
Outdated
" greater than 0 and less than memlimit.\n"); | ||
"The value of sticky(gummed) memory limit" | ||
" cannot be less than 0" | ||
" and must be greater than memlimit.\n"); |
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.
The value of memory limit ... must be greater than sticky_limit.
The value of sticky(gummed) memory limit ... must be greater than memlimit.
둘 다 서로 자기가 더 높은 값이어야 한다고 되어 있는데요. 어느 쪽이 더 높은 값이어야 하나요?
@ing-eoking |
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.
리뷰 완료
@@ -15182,8 +15182,9 @@ int main (int argc, char **argv) | |||
settings.maxbytes = (size_t)cache_memory_limit * 1024 * 1024; | |||
if (cache_memory_limit < 0 || settings.maxbytes < settings.sticky_limit) { | |||
mc_logger->log(EXTENSION_LOG_WARNING, NULL, | |||
"The value of memory limit must be" | |||
" greater than 0 and sticky_limit.\n"); |
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.
cache_memory_limit <= 0
조건으로 비교하고,
cache_memory_limit와 sticky_memory_limit 간의 validataion check는
옵션 파싱이 끝난 다음에 수행해야 할 것 같습니다.
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.
이럴게 하자는 의미입니다.
if (cache_memory_limit <= 0) {
mc_logger->log(EXTENSION_LOG_WARNING, NULL,
"The value of memory limit must be greater than 0.\n");
return 1;
}
@@ -15199,8 +15200,9 @@ int main (int argc, char **argv) | |||
settings.sticky_limit = (size_t)sticky_memory_limit * 1024 * 1024; | |||
if (sticky_memory_limit < 0 || settings.sticky_limit > settings.maxbytes) { | |||
mc_logger->log(EXTENSION_LOG_WARNING, NULL, | |||
"The value of sticky(gummed) memory limit must be" | |||
" greater than 0 and less than memlimit.\n"); |
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.
여기서도 sticky_memory_limit <= 0
이어야 할 것 같습니다.
0은 default value로 sticky 허용하지 않음을 의미합니다.
0으로 설정하는 것도 의미가 없기 때문에 <= 0
조건을 사용하는 것이 좋겠습니다.
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.c
Outdated
settings.maxbytes < settings.sticky_limit) { | ||
mc_logger->log(EXTENSION_LOG_WARNING, NULL, | ||
"The value of memory limit" | ||
" and must be greater than 0 and sticky_limit.\n"); |
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.
The value of memory limit and must be greater than 0 and sticky_limit.
문장이 이상해 보입니다.
4686452
to
40c27b7
Compare
if (settings.maxbytes <= 0 || settings.sticky_limit <= 0 ||
settings.maxbytes < settings.sticky_limit) 3 조건을 포함하고 있는 메시지로 변경해야할 것 같습니다. 이러면 문장이 조금 길어지는데, 수식으로 표현할까요? |
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.
리뷰 완료
@@ -15182,8 +15182,9 @@ int main (int argc, char **argv) | |||
settings.maxbytes = (size_t)cache_memory_limit * 1024 * 1024; | |||
if (cache_memory_limit < 0 || settings.maxbytes < settings.sticky_limit) { | |||
mc_logger->log(EXTENSION_LOG_WARNING, NULL, | |||
"The value of memory limit must be" | |||
" greater than 0 and sticky_limit.\n"); |
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.
이럴게 하자는 의미입니다.
if (cache_memory_limit <= 0) {
mc_logger->log(EXTENSION_LOG_WARNING, NULL,
"The value of memory limit must be greater than 0.\n");
return 1;
}
@@ -15199,8 +15200,9 @@ int main (int argc, char **argv) | |||
settings.sticky_limit = (size_t)sticky_memory_limit * 1024 * 1024; | |||
if (sticky_memory_limit < 0 || settings.sticky_limit > settings.maxbytes) { | |||
mc_logger->log(EXTENSION_LOG_WARNING, NULL, | |||
"The value of sticky(gummed) memory limit must be" | |||
" greater than 0 and less than memlimit.\n"); |
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.c
Outdated
"The value of memory limit must be" | ||
" greater than 0 and sticky_limit.\n"); | ||
return 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.
여기는 아래와 같이 수정하자는 얘기입니다.
if (settings.maxbytes < settings.sticky_limit) {
mc_logger->log(EXTENSION_LOG_WARNING, NULL,
"The value of memory limit cannot be smaller than sticky_limit.\n");
return 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.
settings.sticky_limit == 0
은 가능하며, 정상적인 값입니다.
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는 memlimit = 0 값을 허용하였는 지를 확인 바랍니다.
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에서 아래와 같이 구동했을 때, 간단한 K/V에서 문제없었습니다.
./memcached -E .libs/default_engine.so -p 13579 -m 0
settings.sticky_limit == 0은 가능하며, 정상적인 값입니다.
CI 테스트 실패함을 확인했습니다. 위의 방식으로 수정하겠습니다.
8ee948b
to
dee614f
Compare
commit message도 아래와 같이 수정하시죠.
|
오픈소스 memcached의 memlimit 허용 범위에 대하여오픈소스 memcached에 memlimit을 0으로 설정하여 구동할 경우 아래와 같은 에러가 출력됩니다.
오픈소스 memcached 에서는 memlimit의 크기가 Max Item Size 보다 2배 이상 설정하게끔 구현되어 있습니다. if (settings.item_size_max < ITEM_SIZE_MAX_LOWER_LIMIT) { // ITEM_SIZE_MAX_LOWER_LIMIT = 1024
fprintf(stderr, "Item max size cannot be less than 1024 bytes.\n");
exit(EX_USAGE);
}
if (settings.item_size_max > (settings.maxbytes / 2)) {
fprintf(stderr, "Cannot set item size limit higher than 1/2 of memory max.\n");
exit(EX_USAGE);
} |
memcached 의 몇몇 구동옵션에서 허용되지 않는 수(음수)를 줄 수 있는 현상을 수정 또는 관련 로그 메시지를 수정합니다.
추가적으로 Memory Limit(maxbytes)옵션인 -m 옵션에서 0을 허용하고 있어,
slabs 모듈 확인 결과 할당 과정에서 아래의 로직을 확인할 수 있었습니다.
mem_limit(maxbytes)를 0으로 설정한 경우는 메모리에 대한 제한을 두지 않기 위한 용도인가요?