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

INTERNAL: Fix a smget handling about trimmed result without bkey #286

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

ing-eoking
Copy link
Collaborator

@ing-eoking ing-eoking commented Mar 21, 2024

๐Ÿ”— Related Issue

  • jam2in/arcus-works#480

โŒจ๏ธ What I did

  • smget(new) ์—ฐ์‚ฐ ์‹œ VALUE ๊ฒฐ๊ณผ๊ฐ€ 0์ธ result์— ๋Œ€ํ•ด Trimmed Key ๋น„๊ต ์—ฐ์‚ฐ์„ ์ˆ˜ํ–‰ํ•˜์ง€ ์•Š๊ฒŒ ๋” ๋ณ€๊ฒฝํ–ˆ์Šต๋‹ˆ๋‹ค.
  • ์„œ๋ฒ„์—์„œ ๋ฐ›์€ ๋ชจ๋“  bkey type์— ๋Œ€ํ•ด ์‚ฌ์šฉ์ž๊ฐ€ ์ž…๋ ฅํ•œ bkey type๊ณผ ๋‹ค๋ฅผ ๊ฒฝ์šฐ PROTOCOL_ERROR๋ฅผ ๋ฐ˜ํ™˜ํ•˜๋„๋ก ๋ณ€๊ฒฝํ–ˆ์Šต๋‹ˆ๋‹ค.
    • (๊ธฐ์กด) Value์—์„œ ๋ฐ›์€ element์˜ bkey type๊ณผ trimmed key์—์„œ์˜ bkey type์ด ๋‹ค๋ฅธ ๊ฒฝ์šฐ PROTOCOL_ERROR๋ฅผ ๋ฐ˜ํ™˜
  • ์ผ๋ถ€ uninitialized variable error๋ฅผ ์ˆ˜์ •ํ–ˆ์Šต๋‹ˆ๋‹ค.

๐Ÿค” Others

  • ์„œ๋ฒ„์˜ Response ๋ฉ”์‹œ์ง€
    ELEMENTS 0
    MISSED_KEYS 0
    TRIMMED_KEYS 1
    b 201
    END
    
  • ๋ณ€๊ฒฝ๋œ ๋ฐ˜ํ™˜ ๊ฒฐ๊ณผ
    • ๊ธฐ์กด
    memcached smget(new) result : PROTOCOL ERROR, response : PROTOCOL ERROR
    
    • ๋ณ€๊ฒฝ
    memcached smget(new) result : SUCCESS, response : SERVER END
    

@ing-eoking ing-eoking marked this pull request as draft March 21, 2024 03:03
@ing-eoking ing-eoking self-assigned this Mar 21, 2024
@ing-eoking ing-eoking requested review from jhpark816 and namsic March 26, 2024 00:44
@ing-eoking ing-eoking marked this pull request as ready for review March 26, 2024 00:44
@jhpark816
Copy link
Contributor

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

@namsic
Copy link
Collaborator

namsic commented Oct 8, 2024

@ing-eoking

์ตœ์‹  commit ๊ธฐ์ค€์œผ๋กœ rebase ํ•œ ๋ฒˆ ํ•ด์ฃผ๋ฉด ์ข‹๊ฒ ์Šต๋‹ˆ๋‹ค.

  • smget(new) ์—ฐ์‚ฐ ์‹œ VALUE ๊ฒฐ๊ณผ๊ฐ€ 0์ธ result์— ๋Œ€ํ•ด Trimmed Key ๋น„๊ต ์—ฐ์‚ฐ์„ ์ˆ˜ํ–‰ํ•˜์ง€ ์•Š๊ฒŒ ๋” ๋ณ€๊ฒฝํ–ˆ์Šต๋‹ˆ๋‹ค.
  • ์„œ๋ฒ„์—์„œ ๋ฐ›์€ ๋ชจ๋“  bkey type์— ๋Œ€ํ•ด ์‚ฌ์šฉ์ž๊ฐ€ ์ž…๋ ฅํ•œ bkey type๊ณผ ๋‹ค๋ฅผ ๊ฒฝ์šฐ PROTOCOL_ERROR๋ฅผ ๋ฐ˜ํ™˜ํ•˜๋„๋ก ๋ณ€๊ฒฝํ–ˆ์Šต๋‹ˆ๋‹ค.

์ด๋ ‡๊ฒŒ ๋ณ€๊ฒฝํ•ด์•ผ ํ•˜๋Š” ์ด์œ ์— ๋Œ€ํ•ด ๊ฐ„๋‹จํžˆ ์„ค๋ช…ํ•ด ์ฃผ๋ฉด ์ข‹๊ฒ ์Šต๋‹ˆ๋‹ค.

@ing-eoking
Copy link
Collaborator Author

ing-eoking commented Oct 8, 2024

@namsic

์ด๋ ‡๊ฒŒ ๋ณ€๊ฒฝํ•ด์•ผ ํ•˜๋Š” ์ด์œ ์— ๋Œ€ํ•ด ๊ฐ„๋‹จํžˆ ์„ค๋ช…ํ•ด ์ฃผ๋ฉด ์ข‹๊ฒ ์Šต๋‹ˆ๋‹ค.

ํ•ด๋‹น PR์ด ์กฐ๊ธˆ ์˜ค๋ž˜๋˜์–ด ์ž์„ธํžˆ ๊ธฐ์–ตํ•˜๋ ค๋ฉด, ์กฐ๊ธˆ ์‹œ๊ฐ„์ด ๊ฑธ๋ฆด ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.

์•„๋ž˜์˜ ๋งํฌ์—์„œ ๊ฐ„๋‹จํžˆ ์„ค๋ช…๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.
https://github.com/jam2in/arcus-works/issues/480#issuecomment-2006261497

smget(new) ์—ฐ์‚ฐ ์‹œ VALUE ๊ฒฐ๊ณผ๊ฐ€ 0์ธ result์— ๋Œ€ํ•ด Trimmed Key ๋น„๊ต ์—ฐ์‚ฐ์„ ์ˆ˜ํ–‰ํ•˜์ง€ ์•Š๊ฒŒ ๋” ๋ณ€๊ฒฝํ–ˆ์Šต๋‹ˆ๋‹ค.
์„œ๋ฒ„์—์„œ ๋ฐ›์€ ๋ชจ๋“  bkey type์— ๋Œ€ํ•ด ์‚ฌ์šฉ์ž๊ฐ€ ์ž…๋ ฅํ•œ bkey type๊ณผ ๋‹ค๋ฅผ ๊ฒฝ์šฐ PROTOCOL_ERROR๋ฅผ ๋ฐ˜ํ™˜ํ•˜๋„๋ก ๋ณ€๊ฒฝํ–ˆ์Šต๋‹ˆ๋‹ค.

eflag๋กœ ์ธํ•ด ๋ชจ๋“  ๊ฐ’์ด skip๋˜๋Š” ๊ฒฝ์šฐ, element๋Š” ์—†์ง€๋งŒ Trimmed key๋งŒ ์กด์žฌํ•˜๊ฒŒ ๋ฉ๋‹ˆ๋‹ค. ์„œ๋ฒ„์—์„œ ์ „์†กํ•˜๋Š” Trimmed key์™€ bkey์˜ ํƒ€์ž…์ด ๋‹ค๋ฅผ ๊ฐ€๋Šฅ์„ฑ์€ ์—†๋‹ค๊ณ  ์ƒ๊ฐํ•˜์—ฌ, ์ด๋ฅผ ์ œ์™ธํ•˜๊ณ  ์‚ฌ์šฉ์ž๊ฐ€ ์ง€์ •ํ•œ bkey ํƒ€์ž…๊ณผ ์„œ๋ฒ„์— ์ €์žฅ๋œ bkey ํƒ€์ž…๊ณผ ๋น„๊ตํ•  ์ˆ˜ ์žˆ๋„๋ก ๋ณ€๊ฒฝํ•œ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.

Copy link
Collaborator

@namsic namsic left a comment

Choose a reason for hiding this comment

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

ํ•ด๋‹น PR์ด ์กฐ๊ธˆ ์˜ค๋ž˜๋˜์–ด ์ž์„ธํžˆ ๊ธฐ์–ตํ•˜๋ ค๋ฉด, ์กฐ๊ธˆ ์‹œ๊ฐ„์ด ๊ฑธ๋ฆด ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.
์•„๋ž˜์˜ ๋งํฌ์—์„œ ๊ฐ„๋‹จํžˆ ์„ค๋ช…๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.

์ด์Šˆ์— ์ ํžŒ ์›์ธ๊ณผ PR์˜ ๋ณ€๊ฒฝ๋งŒ์œผ๋กœ๋Š” ์ž˜ ๋งค์นญ์ด ๋˜์ง€ ์•Š์•„์„œ ๋ฌผ์—ˆ์Šต๋‹ˆ๋‹ค.
๋ฌธ์ œ๊ฐ€ ์ƒ๊ธฐ๋Š” ์›์ธ๊ณผ ๊ทธ ๋ฌธ์ œ๋ฅผ ์–ด๋–ป๊ฒŒ ํ•ด๊ฒฐํ•˜๋ ค๊ณ  ํ–ˆ๋˜ ๊ฒƒ์ธ์ง€ ์กฐ๊ธˆ ๋” ํ’€์–ด์„œ ์„ค๋ช…ํ•ด์ฃผ๋ฉด ์ข‹๊ฒ ์Šต๋‹ˆ๋‹ค.

} else {
comp_result= (prev_sub_key->bkey == curr_sub_key->bkey) ? 0
: (prev_sub_key->bkey < curr_sub_key->bkey) ? -1 : 1;
if (merged->value_count > 0) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

์กฐ๊ฑด๋ฌธ์„ ์•„๋ž˜์™€ ๊ฐ™์ด ๋ณ€๊ฒฝํ•  ์ˆ˜ ์žˆ๋‚˜์š”?
value_count๊ฐ€ 0์ด๋ฉด, trimed_keys๋ฅผ mergeํ•˜์ง€ ์•Š์•„์•ผ ํ•˜๋‚˜์š”?

if (merged->value_count == 0) {
    should_merge = true;
} else if (merged->value_count < merged->count) {
    /*
     * compare sub_keys
     */

    if (comp_result <= 0) {
        should_merge = true;
    }
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

value_count๊ฐ€ 0์ด๋ฉด, trimed_keys๋ฅผ mergeํ•˜์ง€ ์•Š์•„์•ผ ํ•˜๋‚˜์š”?

์ž˜ ๋ชจ๋ฅด๊ฒ ๋„ค์š”. ์ข€ ๋” ์—ฌ๋Ÿฌ๊ฐ€์ง€ ์ƒํ™ฉ์„ ๊ณ ๋ คํ•ด์„œ ๋‹ค์‹œ ์งœ์•ผํ•  ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.
๊ทธ๋Ÿฌ๋ฏ€๋กœ ์ž ์‹œ ํ•ด๋‹น PR์€ ๋ณด๋ฅ˜ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.

value_count == 0 ์ธ ์ƒํ™ฉ์—์„œ should_merge๊ฐ€ ๋˜์–ด์•ผ ํ•œ๋‹ค๋Š” ๊ฒƒ์€
Trimed key๊ฐ€ ํƒ์ƒ‰ํ•œ ํƒ์ƒ‰ํ•œ Btree ๋‚ด ๋ฒ”์œ„ ์ค‘ ์ตœ์†Œ์—ฌ์•ผ ํ•œ๋‹ค๋Š” ๊ฒƒ์ด ๋ณด์žฅ๋˜์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

โ†“       Search Range        โ†“   
----- |--Not Trimmed--| |--Trimed--|

But, all skipped by eflag!

@ing-eoking ing-eoking marked this pull request as draft October 10, 2024 05:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants