Skip to content

Conversation

@singsangssong
Copy link
Contributor

๐Ÿ”— Related Issue

โŒจ๏ธ What I did

๊ธฐ์กด์— engine ์„ค์ •๋งŒ ๊ฐ€๋Šฅํ–ˆ๋˜ config file ์„ค์ • ๊ธฐ๋Šฅ์„ ํ™•์žฅํ•˜์—ฌ, engine์™ธ์˜ ๋‹ค๋ฅธ ์„ค์ •๋„ ํŒŒ์ผ ํ˜•ํƒœ๋กœ ๊ฐ€๋Šฅํ•˜๊ฒŒ ํ•˜๋„๋ก ํ•ฉ๋‹ˆ๋‹ค.
(-e config_file=/config_file1.conf)

  1. ๊ตฌ๋™์‹œ ์˜ต์…˜์„ ์ง์ ‘ ์ „๋‹ฌํ•˜๋Š” ๋Œ€์‹ , config file ๊ฒฝ๋กœ๋ฅผ ์ธ์ž๋กœ ๋„˜๊ฒจ ์ดˆ๊ธฐ ์„ค์ •์„ ์ž๋™์œผ๋กœ ์ ์šฉํ•˜๋„๋ก ํ•ฉ๋‹ˆ๋‹ค.
    (๋Œ€๋ถ€๋ถ„์˜ ํ”„๋กœ๊ทธ๋žจ์—์„œ ์ฐจ์šฉํ•˜๋Š” ๋ฐฉ์‹)
    • main()์‹คํ–‰์‹œ, ๊ตฌ๋™์˜ต์…˜์„ ํ™•์ธํ•˜๊ธฐ ์ „์— ์ฒซ๋ฒˆ์งธ ์ธ์ž๋ฅผ config file๊ฒฝ๋กœ๋ฅผ ์ธ์‹ํ•˜๋„๋ก ๊ธฐ๋Šฅ์„ ํ™•์žฅํ•ฉ๋‹ˆ๋‹ค.
./memcached /path/to/arcus.conf
  1. try_load_config_file()์„ ๊ตฌํ˜„ํ•˜์—ฌ, .confํŒŒ์ผ์„ ๋ผ์ธ ๋‹จ์œ„๋กœ ์ฝ์–ด์„œ ๋ชจ๋“  ๊ฐ’์„ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค.

    • getopt์˜ optind๋ฅผ ๋™์ ์œผ๋กœ ์กฐ์ •ํ•˜์—ฌ config file๊ณผ ๊ตฌ๋™์˜ต์…˜์„ ํ˜ผ์šฉํ• ๋•Œ, ๊ตฌ๋™ ์˜ต์…˜๊ฐ’์ด ๋ฎ์–ด์”Œ์–ด์ง€๋„๋ก ํ•ฉ๋‹ˆ๋‹ค.
  2. https://github.com/jam2in/arcus-works/issues/808 ๋ฅผ ํ†ตํ•œ old_opts ์ค‘๋ณต ํ•ด๊ฒฐ

    • ๊ธฐ์กด์—๋Š” getopt(๊ตฌ๋™์˜ต์…˜๊ฐ’ ์„ค์ •)๋ฃจํ”„ ๋‚ด์—์„œ settings ์ „์—ญ ๊ตฌ์กฐ์ฒด์™€ old_opts ๋ฌธ์ž์—ด ์ƒ์„ฑ์„ ๋™์‹œ์— ์ˆ˜ํ–‰ํ•˜๊ธฐ์—, config file๊ณผ ๊ตฌ๋™์˜ต์…˜์„ ๋™์‹œ์— ์ˆ˜ํ–‰ํ•˜๋ฉด old_opts์— ์ค‘๋ณต๋œ ๊ฐ’์ด ๋“ค์–ด๊ฐ”์Šต๋‹ˆ๋‹ค.
    • ์ด์— config_file๊ณผ ๊ตฌ๋™์˜ต์…˜ ๋ชจ๋‘ settings ์ „์—ญ ๊ตฌ์กฐ์ฒด๋งŒ ์—…๋ฐ์ดํŠธ๋ฅผ ์ˆ˜ํ–‰ํ•˜๊ณ , ํŒŒ์‹ฑ์ดํ›„์— old_opts ๋ฌธ์ž์—ด์„ ์ž‘์„ฑํ•˜๋„๋ก ํ–ˆ์Šต๋‹ˆ๋‹ค.

@singsangssong singsangssong force-pushed the task/config branch 3 times, most recently from e3f1fad to 8e7a0ae Compare November 19, 2025 03:08
@ing-eoking ing-eoking self-requested a review November 19, 2025 07:41
@ing-eoking ing-eoking marked this pull request as draft November 20, 2025 06:42
@singsangssong singsangssong force-pushed the task/config branch 4 times, most recently from fcbee46 to 59f4850 Compare November 21, 2025 04:30
@ing-eoking ing-eoking marked this pull request as ready for review November 21, 2025 05:07
@singsangssong singsangssong force-pushed the task/config branch 2 times, most recently from 48127cd to 98e554d Compare November 21, 2025 06:23
@singsangssong singsangssong force-pushed the task/config branch 2 times, most recently from a532173 to 333add5 Compare November 21, 2025 08:52
@ing-eoking
Copy link
Collaborator

ํ˜น์‹œ ์ด๋ฒˆ PR๊ณผ ๋น„๊ตํ•ด๋ณผ ์ˆ˜ ์žˆ๋„๋ก, try_load_config_file ํ•จ์ˆ˜๋ฅผ ๋”ฐ๋กœ ๋ถ„๋ฆฌํ•˜์ง€ ์•Š๊ณ  ๋กœ์ง์„ main์— ์ง์ ‘ ๊ตฌํ˜„ํ•œ ๊ฒฝ์šฐ๋„ ํ•œ ๋ฒˆ ๋งŒ๋“ค์–ด ๋ณผ ์ˆ˜ ์žˆ์„๊นŒ์š”?

@singsangssong
Copy link
Contributor Author

ํ˜„์žฌ ์ปค๋ฐ‹์€ ๋”ฐ๋กœ ํ•จ์ˆ˜๋ฅผ ๋ถ„๋ฆฌํ•˜์ง€ ์•Š๊ณ , main๋‚ด์— ๋ชจ๋“  ์ฝ”๋“œ๋ฅผ ๋„ฃ์€ ๊ตฌ์กฐ์ž…๋‹ˆ๋‹ค.
๋งŒ์•ฝ ์ด์ „์ฒ˜๋Ÿผ ํ•จ์ˆ˜๋กœ ๋ฌถ์–ด๋‘” ๊ฒƒ์ด ๋” ๊ฐ€๋…์„ฑ์ด ๋†’๋‹ค๋ฉด ์ด์ „ ์ปค๋ฐ‹์œผ๋กœ ๋ณต๊ตฌ์‹œ์ผœ๋‘๊ฒ ์Šต๋‹ˆ๋‹ค.

if (access_mask_str != NULL) {
settings.access = strtol(access_mask_str, NULL, 8);
free(access_mask_str);
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

verbose ๊ด€๋ จ ์ฒ˜๋ฆฌ๋„ ์ถ”๊ฐ€ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

if (settings.verbose > 0) {
  perform_callbacks(ON_LOG_LEVEL, NULL, NULL);
}

{ .key = "eviction", .datatype = DT_BOOL, .value.dt_bool = (bool*)&settings.evict_to_free },
{ .key = "sticky_limit", .datatype = DT_SIZE, .value.dt_size = &settings.sticky_limit },
{ .key = "factor", .datatype = DT_FLOAT, .value.dt_float = (float*)&settings.factor },
{ .key = "chunk_size", .datatype = DT_SIZE, .value.dt_size = (size_t*)&settings.chunk_size },
Copy link
Collaborator

Choose a reason for hiding this comment

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

chunk_size๋Š” dt_size ํƒ€์ž…์ธ ์ด์œ ๊ฐ€ ์žˆ๋‚˜์š”?

{ .key = "sticky_limit", .datatype = DT_SIZE, .value.dt_size = &settings.sticky_limit },
{ .key = "factor", .datatype = DT_FLOAT, .value.dt_float = (float*)&settings.factor },
{ .key = "chunk_size", .datatype = DT_SIZE, .value.dt_size = (size_t*)&settings.chunk_size },
{ .key = "prefix_delimiter", .datatype = DT_CHAR, .value.dt_char = &settings.prefix_delimiter},
Copy link
Collaborator

@ing-eoking ing-eoking Nov 25, 2025

Choose a reason for hiding this comment

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

๋งˆ์ง€๋ง‰์— ๋„์–ด์“ฐ๊ธฐ๋ฅผ ์ถ”๊ฐ€ํ•˜๋Š” ๊ฒƒ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.

๊ตฌ๋™ ์˜ต์…˜์—์„œ๋Š” prefix_delimiter๋ฅผ ์„ค์ •ํ•˜๋ฉด stats.detail_enabled๋„ ์ž๋™์œผ๋กœ ์ผœ์ง€์ง€๋งŒ,
์ด ๋ถ€๋ถ„๊ณผ๋Š” ๋ณ„๊ฐœ๋กœ config ํŒŒ์ผ์—์„œ๋Š” ๋‘ ์˜ต์…˜์„ ๊ฐ๊ฐ ๋…๋ฆฝ๋œ ์ธ์ž๋กœ ๋ฐ›๋Š” ๋ฐฉ์‹์ด ๊ดœ์ฐฎ์„ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.

{ .key = "detail_enabled", .datatype = DT_BOOL,   .value.dt_bool   = &settings.detail_enabled},

@ing-eoking
Copy link
Collaborator

ํ˜„์žฌ ํ•œ ๊ฐ€์ง€ ๋ฒ„๊ทธ๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค.
engine, arcus_zk ๋“ฑ DT_STRING์œผ๋กœ ์ƒˆ๋กœ ํ• ๋‹นํ•œ ๋ฉ”๋ชจ๋ฆฌ์— ๋Œ€ํ•ด free ์ฒ˜๋ฆฌ๊ฐ€ ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.

์ง€๊ธˆ์€ ๊น”๋”ํ•œ ๋ฐฉ์‹์ด ๋ฐ”๋กœ ๋– ์˜ค๋ฅด์ง€๋Š” ์•Š์ง€๋งŒ, ํ˜น์‹œ ๋จผ์ € ์•„์ด๋””์–ด๊ฐ€ ์žˆ์œผ์‹œ๋ฉด ์ ์šฉํ•ด์ฃผ์‹œ๋ฉด ์ข‹๊ฒ ์Šต๋‹ˆ๋‹ค.
์ €๋„ ์กฐ๊ธˆ ๋” ๊ณ ๋ฏผํ•ด ๋ณด๊ณ  ์ƒ๊ฐ๋‚˜๋Š” ๊ฒƒ์ด ์žˆ์œผ๋ฉด ๋ง์”€๋“œ๋ฆฌ๊ฒ ์Šต๋‹ˆ๋‹ค.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants