-
Notifications
You must be signed in to change notification settings - Fork 49
INTERNAL: make piped insert operations process synchronously #887
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
Conversation
uhm0311
left a comment
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/internal/PipedCollectionFuture.java
Outdated
Show resolved
Hide resolved
src/main/java/net/spy/memcached/protocol/ascii/SingleKeyPipeOperationImpl.java
Outdated
Show resolved
Hide resolved
src/test/manual/net/spy/memcached/bulkoperation/BopPipeUpdateTest.java
Outdated
Show resolved
Hide resolved
jhpark816
left a comment
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์ฐจ ๋ฆฌ๋ทฐ ์๊ฒฌ์ ๋๋ค.
์ถ๊ฐ ๋ฆฌ๋ทฐ๋ฅผ ๋ฐ๋ก ์งํํ ๊ฒ ์ต๋๋ค.
jhpark816
left a comment
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/internal/PipedCollectionFuture.java
Outdated
Show resolved
Hide resolved
src/main/java/net/spy/memcached/internal/PipedCollectionFuture.java
Outdated
Show resolved
Hide resolved
src/main/java/net/spy/memcached/internal/PipedCollectionFuture.java
Outdated
Show resolved
Hide resolved
oliviarla
left a comment
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/internal/PipedCollectionFuture.java
Outdated
Show resolved
Hide resolved
jhpark816
left a comment
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.
์ผ๋ถ ๋ฆฌ๋ทฐ
a7063fa to
2939657
Compare
|
@jhpark816 ๋ฆฌ๋ทฐ ๋ฐ์ํ์์ต๋๋ค. |
jhpark816
left a comment
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/internal/PipedCollectionFuture.java
Outdated
Show resolved
Hide resolved
src/main/java/net/spy/memcached/protocol/ascii/PipeOperationImpl.java
Outdated
Show resolved
Hide resolved
src/main/java/net/spy/memcached/protocol/ascii/PipeOperationImpl.java
Outdated
Show resolved
Hide resolved
jhpark816
left a comment
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/PipeOperationImpl.java
Outdated
Show resolved
Hide resolved
src/main/java/net/spy/memcached/protocol/ascii/PipeOperationImpl.java
Outdated
Show resolved
Hide resolved
|
@uhm0311 ๋ฆฌ๋ทฐ ๋ฐ๋๋๋ค. |
uhm0311
left a comment
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/test/manual/net/spy/memcached/bulkoperation/PipeInsertTest.java
Outdated
Show resolved
Hide resolved
ac87315 to
cf6c6fa
Compare
This comment was marked as outdated.
This comment was marked as outdated.
src/test/manual/net/spy/memcached/bulkoperation/BopPipeUpdateTest.java
Outdated
Show resolved
Hide resolved
src/main/java/net/spy/memcached/protocol/ascii/PipeOperationImpl.java
Outdated
Show resolved
Hide resolved
6c6ba28 to
ab39e1e
Compare
src/test/manual/net/spy/memcached/bulkoperation/LopInsertBulkMultipleValueTest.java
Show resolved
Hide resolved
jhpark816
left a comment
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/PipeOperationImpl.java
Outdated
Show resolved
Hide resolved
src/main/java/net/spy/memcached/protocol/ascii/PipeOperationImpl.java
Outdated
Show resolved
Hide resolved
| } | ||
| } | ||
| return false; | ||
| return cancelled.get(); |
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.
future์ cancel(), isCancelled()๊ฐ ์์ฃผ ํธ์ถ๋๋ ๋ฉ์๋๊ฐ ์๋๋ฏ๋ก,
cancelled AtomicBoolean ๊ฐ์ ๋ฐ๋ก ๋์ง ์์๋ ๋ ๊ฒ ๊ฐ์๋ฐ์.
๊ทธ๋ฆฌ๊ณ , ๋จ์ Boolean ๊ฐ์ด์ด๋ ๋ ๊ฒ ๊ฐ์ต๋๋ค. ๊ฒํ ๋ฐ๋๋๋ค.
๋ค๋ฅธ ์ชฝ์ bulk ์ฐ์ฐ์์๋ ์ด๋ฌํ cancelled ๊ฐ์ ์ ์งํ๋ ์ง ๊ถ๊ธํฉ๋๋ค.
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.
future์ cancel(), isCancelled()๊ฐ ์์ฃผ ํธ์ถ๋๋ ๋ฉ์๋๊ฐ ์๋๋ฏ๋ก,
cancelled AtomicBoolean ๊ฐ์ ๋ฐ๋ก ๋์ง ์์๋ ๋ ๊ฒ ๊ฐ์๋ฐ์.
PipedCollectionFuture๋ ๋ชจ๋ op๋ฅผ ์ทจ์ํ๋ ๊ฒ์ด ์๋๋ผ ํน์ op๊ฐ ์ทจ์ ๊ฐ๋ฅํ๋ค๋ฉด ์ทจ์์ํค๊ณ ๋ฐ๋ก ๊ฒฐ๊ณผ๋ฅผ ๋ฐํํฉ๋๋ค. ๊ทธ๋ฆฌ๊ณ ์ด ๊ณผ์ ์์ cancelled ํ๋๊ทธ๋ฅผ true๋ก ๋์ด, ๋ค์ cancel ๋ฉ์๋๊ฐ ํธ์ถ๋์์ ๋ ๋์ด์ op๋ฅผ ์ทจ์ํ์ง ์๋๋ก ํฉ๋๋ค.
๋จ์ Boolean ๊ฐ์ด์ด๋ ๋ ๊ฒ ๊ฐ์ต๋๋ค.
๋๋ถ๋ถ์ ์ํฉ์์ cancel๊ณผ isCancelled๋ฅผ ํ๋์ ์ค๋ ๋์์๋ง ํธ์ถํ๊ธฐ ๋๋ฌธ์ boolean ํ์ ์ ์ฌ์ฉํด๋ ๊ด์ฐฎ๊ธด ํ๋ฐ, ์ฌ๋ฌ ์ค๋ ๋์์ ๋์์ ํธ์ถ๋๋ ์ผ์ด์ค๋ ๊ณ ๋ คํ์ง ์์๋ ๋๋์?
๋ค๋ฅธ ์ชฝ์ bulk ์ฐ์ฐ์์๋ ์ด๋ฌํ cancelled ๊ฐ์ ์ ์งํ๋ ์ง
๋ค๋ฅธ์ชฝ bulk ์ฐ์ฐ์ ๋น๋๊ธฐ ๋ฐฉ์์ด๊ธฐ ๋๋ฌธ์ ๋น๊ตํ๊ธฐ๊ฐ ์ ๋งคํฉ๋๋ค.
| public void complete() { | ||
| CollectionOperationStatus operationStatus = rv.getOperationStatus(); | ||
| if (operationStatus != null && operationStatus.isSuccess() | ||
| && !ops.get(opIdx).isCancelled() |
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.
!ops.get(opIdx).isCancelled() ์กฐ๊ฑด์ด ํ์ํ ์ง ๊ถ๊ธํฉ๋๋ค.
ํ์ฌ ์ฐ์ฐ์ด cancel ๋์์ผ๋ฉด, operatoinStatus.isSuccess() == false ์ํ์ด์ง ์๋ ์ง ?
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.
์์ปค ์ค๋ ๋๋ก๋ถํฐ cancel์ด ํธ์ถ๋์ด CANCELED ์ํ๋ฅผ operationStatus์ ์ ์ฅํ๊ณ complete ๋ฉ์๋๋ฅผ ํธ์ถํ๋ ๋์ค์, IO ์ค๋ ๋์์ ๊ฒฐ๊ณผ๋ฅผ ์ฝ์ด๋ค์ฌ ์ฑ๊ณต ์ํ๋ก ๋ฎ์ด์ธ ์ ์์ต๋๋ค.
PipedCollectionFuture#setOperationStatus ๋ฉ์๋๋ฅผ ๋ณด์๋ฉด CANCELED ์ํ๊ฐ ์ ์ฅ๋์ด ์๋๋ผ๋ ์๋ก์ด ๊ฒฐ๊ณผ๋ฅผ ๋ฎ์ด์ฐ๋ ๊ฒ์ ํ์ธํ ์ ์์ต๋๋ค.
|
@oliviarla ๋ฆฌ๋ทฐ ์ฝ๋ฉํธ ๋ฌ์์ผ๋, ํ์ธ ๋ฐ๋๋๋ค. |
oliviarla
left a comment
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.
๋๋จธ์ง ์ฝ๋ฉํธ์ ๋ํ ๋ฆฌ๋ทฐ๋ ๋ฐ์ํด๋์์ต๋๋ค.
| public void complete() { | ||
| CollectionOperationStatus operationStatus = rv.getOperationStatus(); | ||
| if (operationStatus != null && operationStatus.isSuccess() | ||
| && !ops.get(opIdx).isCancelled() |
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.
์์ปค ์ค๋ ๋๋ก๋ถํฐ cancel์ด ํธ์ถ๋์ด CANCELED ์ํ๋ฅผ operationStatus์ ์ ์ฅํ๊ณ complete ๋ฉ์๋๋ฅผ ํธ์ถํ๋ ๋์ค์, IO ์ค๋ ๋์์ ๊ฒฐ๊ณผ๋ฅผ ์ฝ์ด๋ค์ฌ ์ฑ๊ณต ์ํ๋ก ๋ฎ์ด์ธ ์ ์์ต๋๋ค.
PipedCollectionFuture#setOperationStatus ๋ฉ์๋๋ฅผ ๋ณด์๋ฉด CANCELED ์ํ๊ฐ ์ ์ฅ๋์ด ์๋๋ผ๋ ์๋ก์ด ๊ฒฐ๊ณผ๋ฅผ ๋ฎ์ด์ฐ๋ ๊ฒ์ ํ์ธํ ์ ์์ต๋๋ค.
| } | ||
| } | ||
| return false; | ||
| return cancelled.get(); |
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.
future์ cancel(), isCancelled()๊ฐ ์์ฃผ ํธ์ถ๋๋ ๋ฉ์๋๊ฐ ์๋๋ฏ๋ก,
cancelled AtomicBoolean ๊ฐ์ ๋ฐ๋ก ๋์ง ์์๋ ๋ ๊ฒ ๊ฐ์๋ฐ์.
PipedCollectionFuture๋ ๋ชจ๋ op๋ฅผ ์ทจ์ํ๋ ๊ฒ์ด ์๋๋ผ ํน์ op๊ฐ ์ทจ์ ๊ฐ๋ฅํ๋ค๋ฉด ์ทจ์์ํค๊ณ ๋ฐ๋ก ๊ฒฐ๊ณผ๋ฅผ ๋ฐํํฉ๋๋ค. ๊ทธ๋ฆฌ๊ณ ์ด ๊ณผ์ ์์ cancelled ํ๋๊ทธ๋ฅผ true๋ก ๋์ด, ๋ค์ cancel ๋ฉ์๋๊ฐ ํธ์ถ๋์์ ๋ ๋์ด์ op๋ฅผ ์ทจ์ํ์ง ์๋๋ก ํฉ๋๋ค.
๋จ์ Boolean ๊ฐ์ด์ด๋ ๋ ๊ฒ ๊ฐ์ต๋๋ค.
๋๋ถ๋ถ์ ์ํฉ์์ cancel๊ณผ isCancelled๋ฅผ ํ๋์ ์ค๋ ๋์์๋ง ํธ์ถํ๊ธฐ ๋๋ฌธ์ boolean ํ์ ์ ์ฌ์ฉํด๋ ๊ด์ฐฎ๊ธด ํ๋ฐ, ์ฌ๋ฌ ์ค๋ ๋์์ ๋์์ ํธ์ถ๋๋ ์ผ์ด์ค๋ ๊ณ ๋ คํ์ง ์์๋ ๋๋์?
๋ค๋ฅธ ์ชฝ์ bulk ์ฐ์ฐ์์๋ ์ด๋ฌํ cancelled ๊ฐ์ ์ ์งํ๋ ์ง
๋ค๋ฅธ์ชฝ bulk ์ฐ์ฐ์ ๋น๋๊ธฐ ๋ฐฉ์์ด๊ธฐ ๋๋ฌธ์ ๋น๊ตํ๊ธฐ๊ฐ ์ ๋งคํฉ๋๋ค.
๐ Related Issue
โจ๏ธ What I did
syncCollectionPipedInsert() / syncCollectionPipedUpdate()๋ฉ์๋