-
Notifications
You must be signed in to change notification settings - Fork 49
FEATURE: Add CompletableFuture Pipeline API #1035
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
base: develop
Are you sure you want to change the base?
Conversation
7a9e90a to
0d98bc8
Compare
src/main/java/net/spy/memcached/protocol/ascii/PipelineOperationImpl.java
Outdated
Show resolved
Hide resolved
src/main/java/net/spy/memcached/protocol/ascii/PipelineOperationImpl.java
Show resolved
Hide resolved
| * NOTHING_TO_UPDATE, NOT_SUPPORTED | ||
| * or unknown statement | ||
| */ | ||
| atomicReference.get().set(index, status); |
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.
List<Object>๋ก ๋ฐํํ๋ ๊ฒ๋ณด๋ค PipelineResult ํด๋์ค๋ฅผ ๋ง๋ค์ด์ List<Boolean> ํ๋์ Exception ํ๋๋ฅผ ๋ฃ์ด์ ๋ฐํํ๋ ๊ฒ์ด ๋ซ์ง ์๋์?
๊ฒฐ๊ณผ๋ฅผ ๋ฐ์์ ์ฌ์ฉํ๋ ์ชฝ์์ ๋งค๋ฒ ํ์
์ฒดํฌํ๊ณ ํ์
๋ณํ์ ํ๋ ๊ฒ๋ณด๋ค ๋์ ๊ฒ ๊ฐ์ต๋๋ค.
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.
๋ฐํ ํ์
์ ๋ํด ๋
ผ์ํด๋ณด๋ ๊ฒ ์ข์ ๊ฒ ๊ฐ์ต๋๋ค.
์ ์ํด์ฃผ์ ๊ฒ์ฒ๋ผ ๋ณ๋ ํด๋์ค๋ฅผ ๋ง๋ค๊ธฐ๋ณด๋ค๋ Map<Integer, CollectionOperationStatus>ํ์
์ ๋ฐํํด์ ์คํจ ์ cause๋ง์ ์ ์ฅํ๋๊ฑด ์ด๋ค๊ฐ์? ๋ชจ๋ ์ฑ๊ณตํ ๊ฒฝ์ฐ Map์ empty๊ฐ ๋ฉ๋๋ค.
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.
๋ค๋ฅธ API์์๋ CollectionOperationStatus๊ฐ ์๋ Exception์ ๋ฐํํ๋ ๊ฒ์ผ๋ก ๋์ด ์์ต๋๋ค.
์ฌ๊ธฐ์๋ Map<Integer, Exception> ํ์
์ผ๋ก ๋ฐํํ๋ ๊ฒ์ ์ด๋ค๊ฐ์?
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.
pipe๋ multi key ์ฐ์ฐ์ด ๋ ์๋ ์์ผ๋ฉฐ ์ด๋ก ์ธํด ์์์ฑ, ์์๋ฅผ ๋ณด์ฅํ ์ ์์ต๋๋ค.
์๋ฅผ ๋ค์ด 500๊ฐ์ ๋ช
๋ น์ ํ์ดํ๋ก ๋ฌถ์ด execute ๋ฉ์๋๋ก ์คํ์ํค๊ณ ์ ํ๊ณ , 5๊ฐ์ ๋
ธ๋์์ ๊ฐ๊ฐ 100๊ฐ์ฉ ๋ช
๋ น์ ์ฒ๋ฆฌํ๋ ๋์ค, ํน์ ํ ๋
ธ๋์์ 50๋ฒ์งธ ๋ช
๋ น์ ์๋ฌ๊ฐ ๋ฐ์ํด ์ดํ ๋ช
๋ น์ ์คํํ์ง ์์์ ๋ ์ด๋ฅผ ์ด๋ป๊ฒ ํํํ ์ง ๊ฒฐ์ ํด์ผ ํฉ๋๋ค.
์คํ๋ผ์ธ์ผ๋ก ๋
ผ์ํ์ ๋ ๋ค์๊ณผ ๊ฐ์ ํด๋์ค๋ฅผ ๋ฐํํ๋ ๊ฒ์ ์ ์ํ๋๋ฐ, ์ฌ๊ธฐ์ ์คํ๋์ง ์์ ๋ช
๋ น ์ธ๋ฑ์ค์๋ NOT_EXECUTED OperationStatus๋ฅผ ์ ์ฅํด๋๋๊ฒ ์ข์ ๊ฒ ๊ฐ์ต๋๋ค.
public class PipelineResult {
private final Map<Integer, OperationStatus> statusFailures;
private final Map<Integer, Throwable> exceptions;
}@uhm0311 ๋ค๋ฅธ ์ ์์ด ์๋ค๋ฉด ์ฝ๋ฉํธ ๋ถํ๋๋ฆฝ๋๋ค.
์ฝ๋ ์์ ์ @jhpark816 ๋๊น์ง ํ์ธํ ํ ์งํํ๊ฒ ์ต๋๋ค.
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.
@oliviarla @uhm0311
List<Object> ์๋ต๊ณผ PipelineResult ์๋ต ํ์์์ ์๋ ์ค๋ฅ ์์ ์ด๋ป๊ฒ ํํํ๊ฒ ๋๋์?
- ERROR|CLIENT_ERROR|SERVER_ERROR
- PIPE_ERROR
- opertion timeout
- cancel (by worker thread or io thread)
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.
- operation timeout์ ๊ฒฝ์ฐ complete ๋ก์ง๊ณผ ๋ฌด๊ดํ๋ฏ๋ก ์ด ๋ ผ์์ ์ฐ๊ด์ด ์์ต๋๋ค.
- cancel์ ๊ฒฝ์ฐ ํญ์ complete exceptionally๋๊ธฐ ๋๋ฌธ์ ์์ธ๋ ๋์ผ์ํฉ๋๋ค.
List<Object>
- ํน์ ๋ ธ๋์ ๋ณด๋ธ ์๋ต์์ ์๋ฌ๊ฐ ๋ฐ์ํ์ง ์์๋ค๋ฉด, ์๋ต ๊ฒฐ๊ณผ(true/false/OperationStatus)๊ฐ List์ ์ ์ฅ๋ฉ๋๋ค.
- ํน์ ๋ ธ๋์ ๋ณด๋ธ ์๋ต์์ ์๋ฌ๊ฐ ๋ฐ์ํ ๊ฒฝ์ฐ(cancel ํฌํจ), ํด๋น ๋ ธ๋๋ก ๋ณด๋๋ ๋ชจ๋ ์์ฒญ์ ๋ํด null์ด List์ ์ ์ฅ๋ฉ๋๋ค. ๊ฐ ๋ ธ๋๋ก ์์ฒญ์ ๋ณด๋ด๋ ๋ฉ์๋์์ ArcusFutureImpl๋ฅผ ๋ฐํํ๊ธฐ ๋๋ฌธ์, exceptionally complete๋ ๊ฒฝ์ฐ ๊ฒฐ๊ณผ ๊ฐ์ ํ์ธํ ์ ์๊ธฐ ๋๋ฌธ์ด์์ต๋๋ค.
PipelineResult
- ํน์ ๋ ธ๋์ ๋ณด๋ธ ์๋ต์์ ์๋ฌ๊ฐ ๋ฐ์ํ์ง ์์๋ค๋ฉด, ์คํจ ์๋ต ๊ฒฐ๊ณผ(OperationStatus)๊ฐ status Map์ ์ ์ฅ๋ฉ๋๋ค.
- ํน์ ๋
ธ๋์ ๋ณด๋ธ ์๋ต์์ ์๋ฌ๊ฐ ๋ฐ์ํ ๊ฒฝ์ฐ(cancel ํฌํจ), ์๋ฌ ๋ด๋ถ์ ๋ด์๋ <์คํจ ์๋ต ๊ฒฐ๊ณผ์ ์๋ฌ๊ฐ ๋ฐ์ํ ์์น>๋ฅผ ํ ๋๋ก ์คํจ ์๋ต ๊ฒฐ๊ณผ์
NOT_EXECUTED์ํ๋ฅผ status Map์ ์ ์ฅํ๊ณ , ์๋ฌ ์์ฒด๋ throwable Map์ ์ ์ฅํฉ๋๋ค.
| }); | ||
| } | ||
|
|
||
| private Map<MemcachedNode, Map.Entry<List<KeyedOperation>, List<Integer>>> getOpsAndIndexesByNode( |
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.
์ด ๋ฉ์๋์ getFutureToOriginIndexes()์์ ์ฌ์ฉํ๋ ์๋ฃ๊ตฌ์กฐ๋ค์ด ๋ณต์กํ ๊ฒ ๊ฐ์ต๋๋ค.
๊ฐ Entry์ Key์ Value๋ฅผ ์์ ๋ณ์์ ๋ด์์ ์ฌ์ฉํ๊ณ , ์ด๋ค ์ญํ ์ ํ๋ ๋ณ์์ธ์ง ์์๋ณผ ์ ์์ผ๋ฉด ์ข๊ฒ ์ต๋๋ค.
๐ Related Issue
List<Object>์ ๊ฐ ๋ช ๋ น์ ๋ํ ์๋ต์ด ๋ด๊ธด๋ค.โจ๏ธ What I did