INTERNAL: Integration get and mget api#856
Conversation
| String keysString = generateKeysString(); | ||
|
|
||
| if (cmd.equals("get") || cmd.equals("gets")) { | ||
| if (getHandlingNode() != null && !getHandlingNode().enabledMGetOp()) { |
There was a problem hiding this comment.
initailize()가 호출되기 전에 handlingNode가 set 되지 않는 경우도 있나요?
There was a problem hiding this comment.
실제 opeation 동작시에는 initalize() 호출 전 handlingNode가 set 되지 않는 경우는 없습니다.
하지만, unit test node를 set하지 않고 initialize()를 호출하는 경우가 있어 이를 통과 하기 위해 null 검사 조건을 추가 하였습니다.
@Test
void getsTest() {
try {
opFact.gets(MULTIBYTE_KEY, new GetsOperation.Callback() {
@Override
public void receivedStatus(OperationStatus status) {
}
@Override
public void complete() {
}
@Override
public void gotData(String key, int flags, long cas, byte[] data) {
}
}).initialize(); // BaseGetOpImpl.initialize()
} catch (java.nio.BufferOverflowException e) {
fail();
}
추가로 null 인 경우 gets나 mgets 을 수행하도록 한 이유는 기존 코드에서
if (node == null) {
op = opFact.mgets(keyList, cb);
}
위 처럼 null 인 경우 mgets이나 gets명령을 수행하도록 하고 있기 때문입니다.
There was a problem hiding this comment.
하지만 위에 말씀하신 방법
https://github.com/naver/arcus-java-client/pull/856/files#r1898412137
과 같이 한다면 기존 코드 변경 없이 진행 할 수 있을것 같습니다.
| /** | ||
| * Operation for retrieving data. | ||
| */ | ||
| @Deprecated |
There was a problem hiding this comment.
접근 제어자가 public인 부분이 염려되긴합니다.
다만 제 생각은 @Deprecated 하지 않고 바로 삭제해도 될 것 같습니다.
| op = node.enabledMGetOp() ? opFact.mget(keyList, cb) | ||
| : opFact.get(keyList, cb); | ||
| } | ||
| op = opFact.get(keyList, cb); |
There was a problem hiding this comment.
public GetOperation get(String key, GetOperation.Callback cb, boolean isMGet) {
return new GetOperationImpl(key, cb, isMGet);
}위와 같이 인자 하나를 추가 시킨 다음 "get"과 "mget" 스트링 값을
GetOperationImpl 내에서 할당시켜주는게 좋을 거 같습니다.
There was a problem hiding this comment.
다만 위 코멘트도 하휘호환성 문제가 있긴한데 제 생각은 @Deprecated 하지 않아도 될 것 같아요
2fed732 to
2dd5adc
Compare
446ffce to
f3577fd
Compare
|
#857 |
🔗 Related Issue
⌨️ What I did
AS-IS
asyncGetBulk,asyncGetsBulk에서는getOperation과mgetOperation을 memcached 서버 버전에 맞게 생성하고 있습니다.TO-BE
getOperation만을 생성하고 안의getOperationImpl안에서get과mget을 판단하도록하여 두 APIType을 통합하였습니다.따라서
OperationFactory의get(s)의 인터페이스를 아래와 같이 변경하여get과mget을 구분하여 구현체를 생성하도록 하였습니다.get(s)(String key, GetOperation.Callback cb, boolean isMGet)Mget(s)OperationImpl은 삭제하였습니다.mget(s)인터페이스 또한 삭제하였습니다.