-
Notifications
You must be signed in to change notification settings - Fork 47
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: read while PIPE_ERROR received in the pipe operation #839
base: develop
Are you sure you want to change the base?
Conversation
@uhm0311 ๋จผ์ ๋ฆฌ๋ทฐํ๋ฉด ๋ฉ๋๋ค. |
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.
1์ฐจ ์ง๋ฌธ์ ๋๋ค.
src/main/java/net/spy/memcached/protocol/ascii/CollectionPipedInsertOperationImpl.java
Show resolved
Hide resolved
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.
2์ฐจ, ๋ฆฌ๋ทฐ ์๊ฒฌ๊ณผ ์ง๋ฌธ์ ๋๋ค.
src/main/java/net/spy/memcached/internal/CompositeException.java
Outdated
Show resolved
Hide resolved
src/main/java/net/spy/memcached/protocol/ascii/CollectionBulkInsertOperationImpl.java
Outdated
Show resolved
Hide resolved
src/main/java/net/spy/memcached/protocol/ascii/CollectionPipedInsertOperationImpl.java
Outdated
Show resolved
Hide resolved
src/main/java/net/spy/memcached/protocol/ascii/OperationImpl.java
Outdated
Show resolved
Hide resolved
faec8fa
to
20cf3d9
Compare
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.
3์ฐจ ๋ฆฌ๋ทฐ ์๊ฒฌ์ ๋๋ค.
src/main/java/net/spy/memcached/protocol/ascii/OperationImpl.java
Outdated
Show resolved
Hide resolved
@oliviarla @uhm0311 |
5493230
to
466ff60
Compare
@uhm0311 @jhpark816
|
00d28cd
to
63fac49
Compare
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.
4์ฐจ ๋ฆฌ๋ทฐ ์๊ฒฌ์ ๋๋ค.
src/main/java/net/spy/memcached/protocol/ascii/OperationImpl.java
Outdated
Show resolved
Hide resolved
a752f86
to
7bf52e7
Compare
@jhpark816 ๋ฆฌ๋ทฐ ๋ถํ๋๋ฆฝ๋๋ค. |
@oliviarla ๋ฆฌ๋ทฐ ์งํ ์ค์ ๋๋ค. |
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.
์ผ๋ถ ๋ฆฌ๋ทฐ
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.
๋ฆฌ๋ทฐ ์๋ฃ,
๋ณต์กํ ์ด์๋ค์.
src/main/java/net/spy/memcached/protocol/ascii/CollectionPipedUpdateOperationImpl.java
Outdated
Show resolved
Hide resolved
@jhpark816 @uhm0311
|
๋ฆฌ๋ค์ด๋ ํธํ๋ค๋ ๊ฒ์ด ์ด๋ค ์๋ฏธ์ธ๊ฐ์?
result๊ฐ ์๋ ์ง์ ๋ฐ๋ผ ํ๋จํด์ผ ํ ์ง ? ์ ๋์ ๋๋์ด ๋ญ๋๋ค. |
@jhpark816 |
|
ํ์ฌ์ ๋์ผํ ๋์์ด๋ ๊ฑฐ์ฃ ?
ํด๋น ๋ฉ์๋์ ๋ฆฌํด ํ์ ์ ์ด๋ป๊ฒ ๋๋์? |
9be687e
to
e2fe53b
Compare
๋ค ๋ง์ต๋๋ค.
failedResult ํ๋ ํ์ ๊ณผ ๋์ผํ๊ฒ ๋ฐํํ ์์ ์ ๋๋ค.
|
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.
๋ฆฌ๋ทฐ ์๋ฃ
src/main/java/net/spy/memcached/protocol/ascii/OperationImpl.java
Outdated
Show resolved
Hide resolved
de7cd25
to
e7a888a
Compare
@jhpark816 |
@uhm0311 ๋ฆฌ๋ทฐ ๋ฐ๋๋๋ค. |
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.
๋ณ๊ฒฝ ๋ด์ญ์ ๋ค ๋ฐ๋ผ๊ฐ์ง ๋ชปํด์ ์ง๋ฌธ ๋จ๊น๋๋ค.
src/main/java/net/spy/memcached/protocol/ascii/CollectionPipedInsertOperationImpl.java
Outdated
Show resolved
Hide resolved
src/main/java/net/spy/memcached/protocol/ascii/CollectionPipedInsertOperationImpl.java
Outdated
Show resolved
Hide resolved
src/main/java/net/spy/memcached/protocol/BaseOperationImpl.java
Outdated
Show resolved
Hide resolved
src/main/java/net/spy/memcached/protocol/ascii/CollectionPipedInsertOperationImpl.java
Outdated
Show resolved
Hide resolved
@uhm0311 ๋ฆฌ๋ทฐ ์๋ฃ๋์ จ์๊น์? |
์งํ ์ค์ ๋๋ค. |
src/main/java/net/spy/memcached/protocol/ascii/CollectionPipedInsertOperationImpl.java
Outdated
Show resolved
Hide resolved
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.
๋ฆฌ๋ทฐ ์๋ฃ
src/main/java/net/spy/memcached/protocol/ascii/CollectionPipedInsertOperationImpl.java
Show resolved
Hide resolved
} catch (Exception e) { | ||
getLogger().error("Failed to parse line: %s", e.getMessage()); | ||
transitionState(OperationState.COMPLETE); | ||
return; |
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.
Exception ์ฒ๋ฆฌ๊ฐ ํ์ํ๋ handleRead()๊ฐ ์ด์ํ๋ค์.
@oliviarla
pipe ์ฐ์ฐ์์ handleError() ๋ฉ์๋๋ฅผ overrideํ๊ฑฐ๋
์ฒ์ ์ ์ํด ์ฃผ์๋ handleError() ๋ฉ์๋๋ฅผ ์์ ํ๋ ๋ฐฉ์์ด ๊ด์ฐฎ์๋ค๊ณ ์๊ฐ๋๋ค์.
์๋ ์ฝ๋๋ ์ฒ์ ์ ์ํด ์ค ๋ฐฉ์๊ณผ ๊ฑฐ์ ์ ์ฌํ๋ฉฐ,
ReadType์ผ๋ก LINE
, DATA
์ธ์ next line์ ์ฝ๋ NEXT
ํ์
์ ๋๊ณ
pipe ์ฐ์ฐ์์ ์ฒ์ line์ ์ฝ์ ํ์ ReadType์ NEXT
๋ก ๋ณ๊ฒฝํ๋ค๊ณ ๊ฐ์ ํ ๊ฒ์
๋๋ค.
protected void handleError(OperationErrorType eType, String line)
throws IOException {
getLogger().error("Error: %s by %s", line, this);
switch (eType) {
case GENERAL:
case SERVER:
. . .
break;
case CLIENT:
. . .
break;
default:
assert false;
}
if (readType == OperationReadType.LINE) {
transitionState(OperationState.COMPLETE);
throw exception;
}
}
๊ทธ๋ฆฌ๊ณ , readFromBuffer()๋ ์๋์ ๊ฐ์ด ๋ณ๊ฒฝํ ์ ์์ต๋๋ค.
NEXT
์ธ ๊ฒฝ์ฐLINE
๊ณผ ๋์ผํ๊ฒ ์ฒ๋ฆฌ- COMPLETE์ด๊ณ hasErrored์ด๋ฉด throw Exception ์ฒ๋ฆฌ
- ์๋๋ฉด handleLine()์์ throw Exception ํ๊ฒ ์์
public void readFromBuffer(ByteBuffer data) throws IOException {
// Loop while there's data remaining to get it all drained.
while (data.remaining() > 0) {
if (getState() == OperationState.COMPLETE ||
getState() == OperationState.MOVING || // ENABLE_REPLICATION
getState() == OperationState.REDIRECT) { // ENABLE_MIGRATION
break;
}
if (readType == OperationReadType.LINE ||
readType == OperationReadType.NEXT) {
String line = getLineFromBuffer(data);
if (line == null) {
continue;
}
OperationErrorType eType = classifyError(line);
if (eType != null) {
handleError(eType, line);
} else {
handleLine(line);
}
} else { // OperationReadType.DATA
handleRead(data);
}
}
if (getState() == OperationState.COMPLETE && hasErrored()) {
throw getException();
}
}
๊ทธ๋ฌ๋ฉด, pipe ์ฐ์ฐ์์๋ handleLine ๋ฉ์๋๋ง ์์ผ๋ฉด ๋ฉ๋๋ค.
handleNOTPiped() ๋ฉ์๋๋ฅผ ๋ฐ๋ก ๋์ด ๋ถ๋ฆฌํ๋ ๊ฒ์ ์ฝ๊ธฐ์ ๋์ ๊ฒ ๊ฐ์ต๋๋ค.
์ด๋์ ๋ ์๊ฐ์ ํด ๋ณด๋,
์ฒ์ ์ ์ํด ์ฃผ์๋ ๋ฐฉ์์ด ๋์ ๊ฒ ๊ฐ์ ์์ ๊ฐ์ด ์๊ฒฌ์ ์ ๋ฌํฉ๋๋ค.
๊ฒํ ํด ๋ณด์ธ์.
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.
handleError๋ฅผ ์ค๋ฒ๋ผ์ด๋ํ๋ ํํ๋ก ๊ตฌํํด๋ดค์ต๋๋ค.
์ด๋ฅผ ํตํด ๊ณตํต Operation ์ฒ๋ฆฌ ์ฝ๋ ์ค readFromBuffer ์ชฝ๋ง ์์ ํ๋๋ก ๋ณ๊ฒฝ๋์์ต๋๋ค.
๐ Related Issue
โจ๏ธ What I did
PIPE_ERROR
๋ฅผ ๋๊น์ง ์ฝ๋๋ก ๋ณ๊ฒฝํ๋ค.PIPE_ERROR
๋ฅผ ์ฝ์ง ์์๋ค.PIPE_ERROR
๋ฅผ ์ฝ๋๋ก ๋ณ๊ฒฝ๋ง ํด๋๊ณ , ์ํ๋์ง ์์ ์ฐ์ฐ์ ๋ํ gotStatus() ํธ์ถ์ INTERNAL: make lop piped operations process synchronouslyย #795 ์ ์ถ๊ฐํ๋๋ก ํ๋ค.