./dev/javafmt

Signed-off-by: iosmanthus <myosmanthustree@gmail.com>
This commit is contained in:
iosmanthus 2022-07-27 17:03:58 +08:00
parent 7e5da2ddea
commit c839b54abb
No known key found for this signature in database
GPG Key ID: DEE5BAABFE092169
3 changed files with 23 additions and 19 deletions

View File

@ -40,7 +40,6 @@ import org.tikv.common.streaming.StreamingResponse;
import org.tikv.common.util.BackOffFunction.BackOffFuncType;
import org.tikv.common.util.BackOffer;
import org.tikv.common.util.ChannelFactory;
import org.tikv.common.util.ConcreteBackOffer;
public abstract class AbstractGRPCClient<
BlockingStubT extends AbstractStub<BlockingStubT>,

View File

@ -498,7 +498,8 @@ public class PDClient extends AbstractGRPCClient<PDBlockingStub, PDFutureStub>
return true;
}
synchronized boolean createFollowerClientWrapper(BackOffer backOffer, String followerUrlStr, String leaderUrls) {
synchronized boolean createFollowerClientWrapper(
BackOffer backOffer, String followerUrlStr, String leaderUrls) {
// TODO: Why not strip protocol info on server side since grpc does not need it
try {
@ -535,7 +536,8 @@ public class PDClient extends AbstractGRPCClient<PDBlockingStub, PDFutureStub>
leaderUrlStr = uriToAddr(addrToUri(leaderUrlStr));
// if leader is switched, just return.
if (checkHealth(backOffer, leaderUrlStr, hostMapping) && createLeaderClientWrapper(leaderUrlStr)) {
if (checkHealth(backOffer, leaderUrlStr, hostMapping)
&& createLeaderClientWrapper(leaderUrlStr)) {
lastUpdateLeaderTime = System.currentTimeMillis();
return;
}
@ -562,7 +564,8 @@ public class PDClient extends AbstractGRPCClient<PDBlockingStub, PDFutureStub>
hasReachNextMember = true;
continue;
}
if (hasReachNextMember && createFollowerClientWrapper(backOffer, followerUrlStr, leaderUrlStr)) {
if (hasReachNextMember
&& createFollowerClientWrapper(backOffer, followerUrlStr, leaderUrlStr)) {
logger.warn(
String.format("forward request to pd [%s] by pd [%s]", leaderUrlStr, followerUrlStr));
return;
@ -592,7 +595,8 @@ public class PDClient extends AbstractGRPCClient<PDBlockingStub, PDFutureStub>
leaderUrlStr = uriToAddr(addrToUri(leaderUrlStr));
// If leader is not change but becomes available, we can cancel follower forward.
if (checkHealth(defaultBackOffer(), leaderUrlStr, hostMapping) && trySwitchLeader(leaderUrlStr)) {
if (checkHealth(defaultBackOffer(), leaderUrlStr, hostMapping)
&& trySwitchLeader(leaderUrlStr)) {
if (!urls.equals(this.pdAddrs)) {
tryUpdateMembers(urls);
}

View File

@ -26,20 +26,21 @@ import org.tikv.raw.RawKVClient;
public class TimeoutTest extends MockThreeStoresTest {
@Before
public void init() throws Exception {
updateConf(conf -> {
conf.setEnableAtomicForCAS(true);
conf.setTimeout(150);
conf.setForwardTimeout(200);
conf.setRawKVReadTimeoutInMS(400);
conf.setRawKVWriteTimeoutInMS(400);
conf.setRawKVBatchReadTimeoutInMS(400);
conf.setRawKVBatchWriteTimeoutInMS(400);
conf.setRawKVWriteSlowLogInMS(50);
conf.setRawKVReadSlowLogInMS(50);
conf.setRawKVBatchReadSlowLogInMS(50);
conf.setRawKVBatchWriteSlowLogInMS(50);
return conf;
});
updateConf(
conf -> {
conf.setEnableAtomicForCAS(true);
conf.setTimeout(150);
conf.setForwardTimeout(200);
conf.setRawKVReadTimeoutInMS(400);
conf.setRawKVWriteTimeoutInMS(400);
conf.setRawKVBatchReadTimeoutInMS(400);
conf.setRawKVBatchWriteTimeoutInMS(400);
conf.setRawKVWriteSlowLogInMS(50);
conf.setRawKVReadSlowLogInMS(50);
conf.setRawKVBatchReadSlowLogInMS(50);
conf.setRawKVBatchWriteSlowLogInMS(50);
return conf;
});
}
private RawKVClient createClient() {