Skip to content
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

CLEANUP: Refactor includes #787

Merged
merged 1 commit into from
Oct 23, 2024

Conversation

cheesecrust
Copy link

@cheesecrust cheesecrust commented Oct 22, 2024

๐Ÿ”— Related Issue

โŒจ๏ธ What I did

  • ํ—ค๋”ํŒŒ์ผ ๋‹จ๋…์œผ๋กœ ์ปดํŒŒ์ผ์ด ๊ฐ€๋Šฅํ•˜๋„๋ก ๋ณ€๊ฒฝ
  • lqdetect.h์˜ include ์œ„์น˜๋ฅผ memcached.h ์—์„œ memcached.c๋กœ ๋ณ€๊ฒฝํ•˜์˜€์Šต๋‹ˆ๋‹ค.

Copy link
Collaborator

@jhpark816 jhpark816 left a comment

Choose a reason for hiding this comment

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

์ผ๋ถ€ ๋ฆฌ๋ทฐ

lqdetect.c Outdated
uint32_t offset, uint32_t count, const bool delete, const bool drop_if_empty)
{
if (access_count >= lqdetect.stats.threshold) {
struct lq_detect_argument argument;
int nwrite = do_make_bkeystring(argument.query, bkrange, efilter);
int nwrite = do_make_bkeystring(argument.query, (bkey_range*)bkrange, (eflag_filter*)efilter);
Copy link
Collaborator

@jhpark816 jhpark816 Oct 22, 2024

Choose a reason for hiding this comment

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

bkey_range, eflag_filter, ENGINE_BTREE_ORDER ๋“ฑ์€ ๊ทธ๋Œ€๋กœ ์œ ์ง€ํ•ฉ์‹œ๋‹ค.
memcached header files์„ includeํ•˜๋Š” ์ฝ”๋“œ๋ฅผ ๋ชจ๋‘ ์ œ๊ฑฐํ•˜๋Š” ๊ฒƒ์€ ์ด ๊ฒฝ์šฐ์—๋Š” ๋งž์ง€ ์•Š๋Š” ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.

Copy link
Author

Choose a reason for hiding this comment

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

๋ฐ˜์˜ํ•˜์˜€์Šต๋‹ˆ๋‹ค.

lqdetect.c Show resolved Hide resolved
@cheesecrust cheesecrust force-pushed the cleanup/refactor-include branch from b79063f to 9e33576 Compare October 23, 2024 01:16
@jhpark816 jhpark816 requested a review from namsic October 23, 2024 01:45
@jhpark816
Copy link
Collaborator

@namsic ๋ฆฌ๋ทฐ ๋ฐ”๋ž๋‹ˆ๋‹ค.

lqdetect.c Outdated
{
mc_logger = logger;
mc_logger = (EXTENSION_LOGGER_DESCRIPTOR*)logger;
Copy link
Collaborator

Choose a reason for hiding this comment

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

์•„๋ž˜ ํ•ญ๋ชฉ์— ๋Œ€ํ•ด ์˜๊ฒฌ ์ฃผ์‹œ๋ฉด ์ข‹๊ฒ ์Šต๋‹ˆ๋‹ค.

  • mc_logger ์‚ฌ์šฉํ•˜๋Š” ๊ณณ์ด ์—†๋Š”๋ฐ, ์œ ์ง€ํ•˜๋Š” ๊ฒƒ์ด ์ข‹์€๊ฐ€์š”?

  • ์ธ์ž๋กœ logger ์ „๋‹ฌ๋ฐ›์•„์•ผ ํ•œ๋‹ค๋ฉด, ํ—ค๋”์—์„œ logger.h๋ฅผ includeํ•˜๋Š” ๊ฒƒ์€ ์•„๋ž˜ ๊ด€์ ์—์„œ ๋‚˜์˜์ง€ ์•Š์•„ ๋ณด์ž…๋‹ˆ๋‹ค.
  1. ๋งŒ์•ฝ ์ธ์ž๋กœ ๊ณ ์ •๋˜์ง€ ์•Š์€ ํƒ€์ž…์„ ๋ฐ›๊ณ ์ž ์˜๋„ํ•œ ๊ฒƒ์ด๋ผ๋ฉด void* ํƒ€์ž…์„ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์ด ์œ ์šฉํ•ฉ๋‹ˆ๋‹ค.

  2. ํ•˜์ง€๋งŒ lqdetect_init()์€ ๊ทธ๋Ÿฐ ์„ฑ๊ฒฉ์˜ ํ•จ์ˆ˜๊ฐ€ ์•„๋‹ˆ๊ณ , ํ•ญ์ƒ EXTENTION_LOGGER_DESCRIPTOR๋ฅผ ์ธ์ž๋กœ ๋ฐ›์•„์•ผ ํ•ฉ๋‹ˆ๋‹ค.
    ๋”ฐ๋ผ์„œ ์‚ฌ์šฉ์ž๋Š” lqdetect.h๋ฅผ includeํ•  ๋•Œ ํ•ญ์ƒ extention_logger.h๋„ ํ•จ๊ป˜ includeํ•ด์•ผ๋งŒ ํ•  ๊ฒƒ์ž…๋‹ˆ๋‹ค.

  3. ์ด๋Ÿฐ ์ƒํ™ฉ์—์„œ๋Š” lqdetect.h์—์„œ logger.h๋ฅผ includeํ•˜๋Š” ๊ฒƒ์ด ๋” ์œ ์šฉํ•˜๋‹ค๊ณ  ์ƒ๊ฐํ•ฉ๋‹ˆ๋‹ค.

    • lqdetect.h์—์„œ logger.h์— ์˜์กดํ•˜๊ณ  ์žˆ๋Š” ๊ด€๊ณ„๋ฅผ ๋ช…ํ™•ํžˆ ๋“œ๋Ÿฌ๋ƒ„
    • lqdetect_init()์˜ ์ธ์ž๋กœ EXTENSION_LOGGER_DESCRIPTOR๋ฅผ ๋„˜๊ธด๋‹ค๋Š” ๊ฒƒ์„ ํ˜ธ์ถœํ•˜๋Š” ์ธก์—์„œ ์•Œ ์ˆ˜ ์žˆ์Œ

Copy link
Collaborator

Choose a reason for hiding this comment

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

๋‚˜์ค‘์— ์‚ฌ์šฉํ•  ๋ชฉ์ ์œผ๋กœ mc_logger ์œ ์ง€ํ•˜๋„๋ก ํ•ฉ์‹œ๋‹ค.

Copy link
Collaborator

Choose a reason for hiding this comment

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

์œ„์— ์„ค๋ช…๋œ ๋Œ€๋กœ, ๊ธฐ์กด ์ธํ„ฐํŽ˜์ด์Šค๋ฅผ ๊ทธ๋Œ€๋กœ ์œ ์ง€ํ•˜๋Š” ๊ฒƒ์ด ๋‚˜์„ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.

int lqdetect_init(EXTENSION_LOGGER_DESCRIPTOR *logger)

์ฐธ๊ณ  ์‚ฌํ•ญ์œผ๋กœ,
EXTENSION_LOGGER_DESCRIPTOR๋Š” include/memcached/extension.h ํŒŒ์ผ์— ์žˆ์Šต๋‹ˆ๋‹ค.

Copy link
Author

@cheesecrust cheesecrust Oct 23, 2024

Choose a reason for hiding this comment

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

mc_logger ๋ฅผ ์œ ์ง€ํ•˜๊ณ  lqdetect.h ์—์„œ memcached/extension.h ๋ฅผ include ํ•˜์—ฌ lqdetect_init()์˜ ์„ ์–ธ์„ ๊ธฐ์กด๊ณผ ๋™์ผํ•˜๊ฒŒ ์œ ์ง€ํ•˜๋„๋ก ์ˆ˜์ •ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.

@cheesecrust cheesecrust force-pushed the cleanup/refactor-include branch from 9e33576 to 68c38ef Compare October 23, 2024 03:41
@jhpark816 jhpark816 merged commit 63c8a8d into naver:develop Oct 23, 2024
1 check passed
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