-
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: Remove redudant operation type RW. #879
Conversation
๋ฆฌ๋ทฐ ๋ ธํฐ ํ๋ฒ ๋ ๋๋ฆฝ๋๋ค |
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.
๋ฆฌ๋ทฐ ์๋ฃ
setOperationType(OperationType.WRITE); | ||
} else { | ||
setOperationType(OperationType.READ); | ||
if (collectionGet.isDelete() || collectionGet.isDropIfEmpty()) { |
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.
collectionGet.isDropIfEmpty()
์กฐ๊ฑด์ ์ ๊ฑฐํฉ์๋ค.
delete๊ฐ false์ด๋ฉด dropIfEmpty๊ฐ true์ด๋๋ผ๋ delete๊ฐ ์ํ๋์ง ์์ต๋๋ค.
d73711f
to
a209ee6
Compare
์ด pr์์ ๋ฒ๊ทธ๊ฐ ์์์ต๋๋ค. enum ํ์ ์ ์ฑ๊ธํค์ผ๋ก ๊ด๋ฆฌ๋๊ธฐ ๋๋ฌธ์ ํ๋ฒ OperationType์ ๋ฐ๊พธ๋ฉด ๋ค๋ฅธ ๊ณณ์์ ๊ฐ์ฒด๋ฅผ ๊ฐ์ ธ์ฌ ๋ ๋ฐ๋์ด์ง ๊ฐ์ ๊ฐ์ ธ์ค๊ฒ ๋ฉ๋๋ค. ๋ฐ๋ผ์ RW ํ์ ์ ๊ทธ๋๋ก ์ ์งํ๊ฑฐ๋ ๋ค๋ฅธ ๋ฐฉ๋ฒ์ ์๊ฐํด๋ณด์์ผ ํฉ๋๋ค. @Test
void test() {
ListGet listGet = new ListGet(0, true, true);
CollectionGetOperationImpl op = new CollectionGetOperationImpl("key", listGet, null);
APIType type1 = op.getAPIType();
assertEquals(OperationType.WRITE, type1.getAPIOpType());
ListGet listGet2 = new ListGet(0, false, false);
CollectionGetOperationImpl op2 = new CollectionGetOperationImpl("key", listGet2, null);
APIType type2 = op2.getAPIType();
assertEquals(OperationType.READ, type2.getAPIOpType()); // OperationType.WRITE๊ฐ ๋ฐํ๋์ด ํ
์คํธ๊ฐ ์คํจํ๋ค.
} |
@brido4125 |
ํ์ฌ ๊ตฌํ ์์ผ๋ก๋ API Read Priority๋ฅผ ์ค์ ํ๊ณ ์๋ PR์ด ๋ฐ์๋ ๊ฒฝ์ฐ์๋ api type์ ํตํด์ @oliviarla LOP_GET(OperationType.READ),
LOP_GET_DELETE(OperationType.WRITE), |
@brido4125 @oliviarla |
๊ทธ๋ฌ๋ฉด API Type์ ๋ฐ๋ผ read Priority๋ฅผ ์ค์ ํ ์ ์๋ ๊ธฐ๋ฅ์ ์ ๊ฑฐํ๋์? |
์๋ ์ฝ๋ฉํธ์ฒ๋ผ ์ด๋ฏธ APIType Read Priority ๊ธฐ๋ฅ์ด ๊ทธ๋์ API Type ์ด๋์ ์ ์ง๋ฅผ ํ๊ณ ์์ ์ฝ๋ฉํธ ์ฒ๋ผ |
@brido4125 @oliviarla |
์ดํด๋ณด๋ APIType์ด OperationType์ ๊ฐ์ง์ง ์์ ๊ฒฝ์ฐ ์๋ ๋ฌธ์ ๊ฐ ์์๋ค์ ์ด๋ ๊ฒ ๋ ๊ฒฝ์ฐ ํ์ฌ ๊ตฌํ๋๋ก ์๋ก ๊ฒฐํฉ๋ ํํ๋ฅผ ๊ฐ์ง๋๊ฒ ๋ง๋๊ฒ ๊ฐ์ต๋๋ค. private ReplicaPick getReplicaPick(APIType apiType) {
ReplicaPick pick = ReplicaPick.MASTER;
if (apiType.getAPIOpType() == OperationType.READ) {
ReadPriority readPriority = connFactory.getAPIReadPriority().get(apiType);
if (readPriority == null) {
readPriority = connFactory.getReadPriority();
}
if (readPriority == ReadPriority.SLAVE) {
pick = ReplicaPick.SLAVE;
} else if (readPriority == ReadPriority.RR) {
pick = ReplicaPick.RR;
}
}
return pick;
} ๊ทธ๋์ APIType๊ณผ OpType์ด ๊ฒฐํฉ์ด ๋์ด์ผํ๋ค๋ฉด |
์ด๋ค ์ฐ์ฐ์ ์์ฑํ๋ ๋ก์ง์ธ ์ง ๊ด๋ จ ์ฝ๋๋ฅผ ์ ์ํด ์ฃผ์ธ์. |
XopBulkInsert์ ๊ฐ์ groupingKeys๋ฅผ ์ฌ์ฉํ๋ ์ฐ์ฐ๋ค์ ๋๋ค. |
@brido4125 |
APIType๊ณผ OpType์ ๋ถ๋ฆฌํ๋ค๋ ๊ฐ์ ํ์์ private ReplicaPick getReplicaPick(APIType apiType, OperationType opType) {
ReplicaPick pick = ReplicaPick.MASTER;
if (opType == OperationType.READ) {
ReadPriority readPriority = connFactory.getAPIReadPriority().get(apiType);
if (readPriority == null) {
readPriority = connFactory.getReadPriority();
}
if (readPriority == ReadPriority.SLAVE) {
pick = ReplicaPick.SLAVE;
} else if (readPriority == ReadPriority.RR) {
pick = ReplicaPick.RR;
}
}
return pick;
} ํนํ groupingKeys ๊ตฌํ์ด ํ์ฌ๋ณด๋ค ์ข ์ง์ ๋ถํด์ง๋ ๋๋์ด ์๊ธดํ๋ฐ, |
@jhpark816 @brido4125 ๋ฌผ๋ก private ๋ฉ์๋์ด๊ธฐ ๋๋ฌธ์ ์ ํฌ๊ฐ ์ ๊ฒฝ์จ์ ๊ตฌํํ๋ฉด ๋์ง๋ง, ํผ๋์ ๋ง๊ณ ๊ฐ์ ์ฑ์ ๋ถ์ฌํ๊ธฐ ์ํด ApiType๊ณผ OperationType์ ๊ฒฐํฉ๋ ํํ๋ก ๋๋๊ฒ ๋์ ๊ฒ ๊ฐ์ต๋๋ค. |
๐ Related Issue
https://github.com/jam2in/arcus-works/issues/692
โจ๏ธ What I did
CollectionGet ์ฐ์ฐ์ ๊ฒฝ์ฐ dropIfEmpty ๋๋ withDelete ๋ฑ์
์ต์ ์ ์ํด write ์ฐ์ฐ์ด ๋ ๊ฐ๋ฅ์ฑ์ ๊ฐ์ง read ์ฐ์ฐ์ด๋ค.
์ด์ ์๋ ์ด๋ฅผ ๊ตฌ๋ณํ๊ธฐ ์ํด OperationType.RW๋ฅผ ์ฌ์ฉํ์ง๋ง
setAPIReadPriority ๋ฉ์๋์์๋ง ํด๋น ํ์ ์ด ์ฌ์ฉ๋๋ค.
์ด ํ์ ์ ์ ๊ฑฐํ๊ณ ๋ํดํธ๋ก๋ read๋ฅผ ์ค์ ํ๊ณ
CollectionGetOperationImpl ์์ฑ์์์
dropIfEmpty์ withDelete ์ฌ๋ถ๋ฅผ ํ์ธ ํ ๋ค์
write ํ์ ์ผ๋ก ๋ณ๊ฒฝํ๋๋ก ํ๋ค.
(๊ธฐ์กด ์์ฑ์์์๋ dropIfEmpty๋ฅผ ํ์ธํ์ง ์์๋ค)
์ถ๊ฐ์ ์ผ๋ก collectionGet์ด read ํ์ ์ด ๋ํดํธ์ด๊ธฐ ๋๋ฌธ์
apiReadPriorityList์ readPriority๋ฅผ ์ค์ ํ ์ ์๋ค.
collectionGet ์ฐ์ฐ์ op๊ฐ ์์ฑ๋ ํ์ replica pick์ ์ค์ ํ๋ api ์ด๊ธฐ ๋๋ฌธ์
write ์ฐ์ฐ์์๋ readPriority๊ฐ ์ค์ ๋๋ ๋ฒ๊ทธ๊ฐ ๋ฐ์ํ์ง๋ ์๋๋ค.