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: Not to cancel operations when node is removed from ZK but still alive. #749

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

Conversation

uhm0311
Copy link
Collaborator

@uhm0311 uhm0311 commented Apr 29, 2024

๐Ÿ”— Related Issue

โŒจ๏ธ What I did

  • NodeLocator์—์„œ ๋…ธ๋“œ๋ฅผ ์ œ๊ฑฐํ•  ๋•Œ, ํ•ด๋‹น ๋…ธ๋“œ์™€์˜ ์†Œ์ผ“ ์—ฐ๊ฒฐ์ด ํ•ด์ œ๋˜์ง€ ์•Š์•˜๊ณ  Operation Queue๊ฐ€ ๋น„์–ด ์žˆ์ง€ ์•Š์œผ๋ฉด ์†Œ์ผ“ ์—ฐ๊ฒฐ์„ ํ•ด์ œ์™€ ์—ฐ์‚ฐ ์บ”์Šฌ์„ ์ˆ˜ํ–‰ํ•˜์ง€ ์•Š๊ณ  DelayedClosingNodes๋กœ ๋ถ„๋ฅ˜ํ•ฉ๋‹ˆ๋‹ค.
  • IO Thread๊ฐ€ DelayedClosingNodes๋กœ ๋ถ„๋ฅ˜๋œ ๋…ธ๋“œ๋“ค์„ ์ˆœํšŒํ•˜๋ฉฐ ๋‹ค์Œ์˜ ๋กœ์ง์„ ์ˆ˜ํ–‰ํ•ฉ๋‹ˆ๋‹ค.
    • ์†Œ์ผ“ ์—ฐ๊ฒฐ์ด ๋Š์–ด์ง„ ๋…ธ๋“œ๊ฐ€ ์žˆ๋‹ค๋ฉด ์—ฐ์‚ฐ์„ ๋ชจ๋‘ ์บ”์Šฌํ•˜๊ณ  DelayedClosingNodes์—์„œ ์ œ๊ฑฐํ•ฉ๋‹ˆ๋‹ค.
    • Operation Queue๊ฐ€ ๋น„์–ด ์žˆ๋Š” ๋…ธ๋“œ๊ฐ€ ์žˆ๋‹ค๋ฉด ์†Œ์ผ“ ์—ฐ๊ฒฐ์„ ํ•ด์ œํ•˜๊ณ  DelayedClosingNodes์—์„œ ์ œ๊ฑฐํ•ฉ๋‹ˆ๋‹ค.

@oliviarla
Copy link
Collaborator

handleNodesToRemove ๋ฉ”์„œ๋“œ๊ฐ€ ๋ณต์ œ์™€ ๋งˆ์ด๊ทธ๋ ˆ์ด์…˜์—์„œ๋„ ์‚ฌ์šฉ๋˜๋Š”๋ฐ, ํ•ด๋‹น ๋ถ€๋ถ„์—๋Š” ์˜ํ–ฅ์ด ์—†๋‚˜์š”?

@uhm0311
Copy link
Collaborator Author

uhm0311 commented Apr 30, 2024

EE์—ฌ๋„ cache_list znode๊ฐ€ ์ œ๊ฑฐ๋˜์—ˆ์„ ๋•Œ ๋™์ž‘์€ CE์™€ ๋™์ผํ•ฉ๋‹ˆ๋‹ค.
alter_list znode๊ฐ€ ์ œ๊ฑฐ๋˜์—ˆ์„ ๋•Œ๋Š” NodeLocator์—์„œ ์†Œ์ผ“ ์—ฐ๊ฒฐ์„ ํ•ด์ œํ•˜๋ฏ€๋กœ ์˜ํ–ฅ์ด ์—†์Šต๋‹ˆ๋‹ค.

String cause = "node removed.";
cancelOperations(node.destroyReadQueue(false), cause);
cancelOperations(node.destroyWriteQueue(false), cause);
cancelOperations(node.destroyInputQueue(), cause);
Copy link
Collaborator

@jhpark816 jhpark816 Apr 30, 2024

Choose a reason for hiding this comment

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

ํ•ด๋‹น MemcachedNode์™€์˜ ์—ฐ๊ฒฐ ์—ฌ๋ถ€์— ๋”ฐ๋ผ ๋‹ฌ๋ฆฌ ์ฒ˜๋ฆฌํ•ด์•ผ ํ•˜์ง€ ์•Š๋Š” ์ง€ ?

๊ทธ๋ฆฌ๊ณ , ์—ฌ๊ธฐ์—์„œ queue์— ์žˆ๋Š” ์—ฐ์‚ฐ๋“ค์€ ์–ด๋–ป๊ฒŒ ์ฒ˜๋ฆฌ๋œ๋‹ค๋Š” ์ฃผ์„์„ ๋‹ฌ์•„ ๋‘๋ฉด ์ข‹๊ฒ ์Šต๋‹ˆ๋‹ค.
์œ„์˜ continue ์ฝ”๋“œ๋Š” ๊ทธ๋Œ€๋กœ ์œ ์ง€ํ•˜๊ณ ์š”.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ํ•ด๋‹น MemcachedNode์™€์˜ ์—ฐ๊ฒฐ ์—ฌ๋ถ€์— ๋”ฐ๋ผ ๋‹ฌ๋ฆฌ ์ฒ˜๋ฆฌํ•ด์•ผ ํ•˜์ง€ ์•Š๋Š” ์ง€ ?

cache_list๋“  alter_list๋“  znode ์ œ๊ฑฐ ์‹œ NodeLocator์—์„œ ํ•ญ์ƒ ์†Œ์ผ“ ์—ฐ๊ฒฐ์„ ํ•ด์ œํ•˜๊ธฐ ๋•Œ๋ฌธ์— ๋‹ฌ๋ฆฌ ์ฒ˜๋ฆฌํ•  ํ•„์š”๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค.


์œ„์˜ continue ์ฝ”๋“œ๋Š” ๊ทธ๋Œ€๋กœ ์œ ์ง€ํ•˜๊ณ ์š”.

for๋ฌธ ๋‚ด์—์„œ if (mgType == MigrationType.LEAVE) ์ดํ›„์— ์ˆ˜ํ–‰ํ•˜๋Š” ๋กœ์ง์ด ์—†์–ด์„œ ์ œ๊ฑฐํ–ˆ์Šต๋‹ˆ๋‹ค.
๊ตณ์ด ๋‘์–ด์•ผ ํ•˜๋‚˜์š”?

Copy link
Collaborator

Choose a reason for hiding this comment

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

cache_list๋“  alter_list๋“  znode ์ œ๊ฑฐ ์‹œ NodeLocator์—์„œ ํ•ญ์ƒ ์†Œ์ผ“ ์—ฐ๊ฒฐ์„ ํ•ด์ œํ•˜๊ธฐ ๋•Œ๋ฌธ์— ๋‹ฌ๋ฆฌ ์ฒ˜๋ฆฌํ•  ํ•„์š”๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค.

cache server๊ฐ€ ๋‹ค์šด๋˜์–ด์„œ ์†Œ์ผ“ ์—ฐ๊ฒฐ์ด ์ด๋ฏธ ๋Š์–ด์ง„ ๊ฒƒ์ด๋ผ๋ฉด ์–ด์ฉ” ์ˆ˜ ์—†์ง€๋งŒ,
NodeLocater์—์„œ znode ์ œ๊ฑฐ ์‹œ์— ์†Œ์ผ“ ์—ฐ๊ฒฐ์„ ๋ฏธ๋ฆฌ closeํ•ด ๋ฒ„๋ฆฐ๋‹ค๋ฉด,
op queue์— ์žˆ๋Š” ์—ฐ์‚ฐ๋“ค์€ ๊ธฐ์กด ์ฝ”๋“œ๋Œ€๋กœ cancel ์ฒ˜๋ฆฌํ•˜๋Š” ๊ฒƒ์ด ๋งž์„ ๊ฒƒ์ž…๋‹ˆ๋‹ค.
ํ•ด๋‹น ์—ฐ์‚ฐ์ด ๊ณ„์† ์ฒ˜๋ฆฌ๋˜๊ฒŒ ํ•˜๋ ค๋ฉด, ์†Œ์ผ“ ์—ฐ๊ฒฐ๋„ delayed closeํ•˜์—ฌ์•ผ ํ•ฉ๋‹ˆ๋‹ค.

@uhm0311 uhm0311 changed the title INTERNAL: Not to cancel operations when node is removed from cache_list. INTERNAL: Not to cancel operations when node is removed from ZK. Apr 30, 2024
@uhm0311 uhm0311 force-pushed the uhm0311/develop branch 3 times, most recently from 56005f1 to 4955858 Compare April 30, 2024 05:39
@uhm0311 uhm0311 changed the title INTERNAL: Not to cancel operations when node is removed from ZK. INTERNAL: Not to cancel operations when node is removed from ZK but still alive. Apr 30, 2024
@uhm0311 uhm0311 requested a review from jhpark816 April 30, 2024 09:11
@uhm0311
Copy link
Collaborator Author

uhm0311 commented Apr 30, 2024

์ฒซ๋ฒˆ์งธ ์ฝ”๋ฉ˜ํŠธ์— ์ปค๋ฐ‹ ์ˆ˜์ •์‚ฌํ•ญ์„ ์—…๋ฐ์ดํŠธ ํ–ˆ์Šต๋‹ˆ๋‹ค.

@jhpark816
Copy link
Collaborator

@oliviarla @brido4125 ๋จผ์ € ๋ฆฌ๋ทฐ ํ•˜์‹œ์ฃ .

@uhm0311 uhm0311 force-pushed the uhm0311/develop branch 2 times, most recently from 39ff086 to a9559bb Compare May 2, 2024 01:22
@brido4125
Copy link
Collaborator

https://github.com/jam2in/arcus-works/issues/549

ํ˜„์žฌ PR์—์„œ๋Š” locator์˜ update์™€ handleDelayedClosingNodes ๋ชจ๋‘ IO ์“ฐ๋ ˆ๋“œ์—์„œ ์ˆœ์ฐจ์ ์œผ๋กœ ์ˆ˜ํ–‰ํ•ฉ๋‹ˆ๋‹ค.

๋งŒ์•ฝ, ํ˜„์žฌ ์ง„ํ–‰์ค‘์ธ ์ด์Šˆ์ฒ˜๋Ÿผ locator์— ๋Œ€ํ•œ update ์ˆ˜ํ–‰์„ ๋‹ค๋ฅธ ์Šค๋ ˆ๋“œ๊ฐ€ ์ˆ˜ํ–‰ํ•  ๊ฒฝ์šฐ
ํ•ด๋‹น ๊ตฌํ˜„๋„ ๋ณ€๊ฒฝ์ด ํ•„์š”ํ•  ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค.

์ถ”ํ›„ ์ฐธ๊ณ ํ•  ๋ชฉ์ ์œผ๋กœ ํ•ด๋‹น ์ฝ”๋ฉ˜ํŠธ ๋‚จ๊น๋‹ˆ๋‹ค.

@@ -226,6 +227,10 @@ public void update(Collection<MemcachedNode> toAttach,
for (MemcachedNode node : toDelete) {
allNodes.remove(node);
removeHash(node);
if (node.hasOp() && node.isActive()) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

deley๋˜๊ฒŒ ์ œ๊ฑฐํ•  ๋…ธ๋“œ๋ผ๋ฉด ํ˜„์žฌ ๋กœ์ผ€์ดํ„ฐ์—์„œ ๊ณง๋ฐ”๋กœ ํ•ด๋‹น ๋…ธ๋“œ๋ฅผ ์ œ๊ฑฐํ•ด๋„ ๋˜๋‚˜์š”?
deley ์‹œ์ผœ ์กฐ๊ธˆ์ด๋‚˜๋งˆ ์—ฐ์‚ฐ์„ ์ˆ˜ํ–‰์‹œํ‚ค๋ ค๋ฉด ๋กœ์ผ€์ดํ„ฐ์—๋„ ๋…ธ๋“œ๊ฐ€ ์žˆ์–ด์•ผ ๋  ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

https://github.com/jam2in/arcus-works/issues/535

์ด์Šˆ์˜ ์„ค๋ช…์„ ๋‹ค์‹œ ์ฝ์–ด๋ณด์„ธ์š”.

Copy link
Collaborator

@jhpark816 jhpark816 May 7, 2024

Choose a reason for hiding this comment

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

@brido4125

deley๋˜๊ฒŒ ์ œ๊ฑฐํ•  ๋…ธ๋“œ๋ผ๋ฉด ํ˜„์žฌ ๋กœ์ผ€์ดํ„ฐ์—์„œ ๊ณง๋ฐ”๋กœ ํ•ด๋‹น ๋…ธ๋“œ๋ฅผ ์ œ๊ฑฐํ•ด๋„ ๋˜๋‚˜์š”?
deley ์‹œ์ผœ ์กฐ๊ธˆ์ด๋‚˜๋งˆ ์—ฐ์‚ฐ์„ ์ˆ˜ํ–‰์‹œํ‚ค๋ ค๋ฉด ๋กœ์ผ€์ดํ„ฐ์—๋„ ๋…ธ๋“œ๊ฐ€ ์žˆ์–ด์•ผ ๋  ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.

์œ„ ์ฝ”๋ฉ˜ํŠธ๋Š” ์–ด๋–ค ์˜๋ฏธ์ธ๊ฐ€์š”?

Copy link
Collaborator

Choose a reason for hiding this comment

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

์บ์‹œ ์š”์ฒญ์ด ํ•ด์‹œ ๋ง์— ์˜ํ•ด ๋ถ„๋ฐฐ๋˜๊ธฐ ์ „์ธ ์ƒํƒœ์˜ ์š”์ฒญ์„ ์ฒ˜๋ฆฌํ•ด์•ผํ•˜์ง€ ์•Š๋‚˜๋ผ๊ณ  ์ƒ๊ฐํ–ˆ์Šต๋‹ˆ๋‹ค.
ํ•˜์ง€๋งŒ ๋ถ„๋ฐฐ๋œ ํ›„์˜ ์š”์ฒญ๋“ค์ด ๋ณธ PR์˜ ๋Œ€์ƒ์ด๋ผ ๊ณ ๋ คํ•˜์ง€ ์•Š์•„๋„ ๋ฉ๋‹ˆ๋‹ค.

Copy link
Collaborator

Choose a reason for hiding this comment

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

์บ์‹œ ์š”์ฒญ์ด ํ•ด์‹œ ๋ง์— ์˜ํ•ด ๋ถ„๋ฐฐ๋˜๊ธฐ ์ „์ธ ์ƒํƒœ์˜ ์š”์ฒญ๊ณผ ๋ถ„๋ฐฐ๋œ ํ›„์˜ ์š”์ฒญ์ด ๋ฌด์—‡์ธ์ง€ ์„ค๋ช… ๋ฐ”๋ž๋‹ˆ๋‹ค.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@brido4125
์บ์‹œ ์š”์ฒญ์ด ํ•ด์‹œ ๋ง์— ์˜ํ•ด ๋ถ„๋ฐฐ๋˜๊ธฐ ์ „์ธ ์ƒํƒœ์˜ ์š”์ฒญ๊ณผ ๋ถ„๋ฐฐ๋œ ํ›„์˜ ์š”์ฒญ์ด ๋ฌด์—‡์ธ์ง€๋ฅผ ์„ค๋ช…ํ•ด ์ฃผ์„ธ์š”.

Copy link
Collaborator

Choose a reason for hiding this comment

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

๋ถ„๋ฐฐ๋œ ํ›„์˜ ์š”์ฒญ์ด ํ์— ์‚ฝ์ž…๋˜๊ณ  ๋‚œ ์ดํ›„๋ฅผ ์˜๋ฏธํ•œ๊ฒƒ์ด๊ณ ,
๋ถ„๋ฐฐ๋˜๊ธฐ ์ „์€ ํ์— ์‚ฝ์ž…๋˜๊ธฐ ์ „์„ ์˜๋ฏธํ–ˆ์Šต๋‹ˆ๋‹ค.

oliviarla
oliviarla previously approved these changes May 2, 2024
brido4125
brido4125 previously approved these changes May 3, 2024
@@ -226,6 +227,10 @@ public void update(Collection<MemcachedNode> toAttach,
for (MemcachedNode node : toDelete) {
allNodes.remove(node);
removeHash(node);
if (node.hasOp() && node.isActive()) {
delayedClosingNodes.add(node);
Copy link
Collaborator

Choose a reason for hiding this comment

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

@uhm0311
์งˆ๋ฌธ์ด ์žˆ์Šต๋‹ˆ๋‹ค.

์ด์™€ ๊ฐ™์ด ํ•ด๋‹น node๊ฐ€ locator์˜ allNodes์—์„œ ์ œ์™ธ๋œ ๊ฒฝ์šฐ,
inputQ, writeQ, readQ์— ์žˆ๋Š” ์š”์ฒญ๋“ค์ด ์ฒ˜๋ฆฌ๊ฐ€ ๋  ์ˆ˜ ์žˆ๋‚˜์š”?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

IO Thread๋Š” NodeLocator์™€ ๊ด€๊ณ„ ์—†์ด ๋™์ž‘ํ•˜๋ฉฐ, closeChannel() ๋ฉ”์†Œ๋“œ๋กœ ์†Œ์ผ“ ์—ฐ๊ฒฐ์„ ํ•ด์ œํ•˜์ง€ ์•Š๋Š” ์ด์ƒ ๋‚จ์€ ์—ฐ์‚ฐ์€ ๊ณ„์† ์ฒ˜๋ฆฌ๋ฉ๋‹ˆ๋‹ค.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@oliviarla
์œ„์˜ ์ฝ”๋ฉ˜ํŠธ์— ๊ด€๋ จ๋œ ์ฝ”๋“œ๋ฅผ ํ™•์ธํ•ด ์ฃผ์‹œ์ฃ .

Copy link
Collaborator

Choose a reason for hiding this comment

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

@uhm0311 ๋‹˜๊ป˜์„œ ๋ง์”€ํ•˜์‹  ๊ฒƒ ์ฒ˜๋Ÿผ allNodes์—์„œ ์ œ์™ธ๋˜๋”๋ผ๋„ addedQueue์— MemcachedNode๊ฐ€ ์กด์žฌํ•˜๊ณ  ์žˆ๋‹ค๋ฉด inputQ์—์žˆ๋Š” Operation๋“ค์ด writeQ๋กœ ๋„˜์–ด๊ฐ€๊ณ , writeQ์˜ ์—ฐ์‚ฐ๋“ค์ด ์ฒ˜๋ฆฌ๋ฉ๋‹ˆ๋‹ค.

@uhm0311 uhm0311 self-assigned this May 9, 2024
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.

4 participants