mirror of https://github.com/tikv/client-java.git
fix potential NPE in region manager
Signed-off-by: iosmanthus <myosmanthustree@gmail.com>
This commit is contained in:
parent
71b5772597
commit
360a3c7d24
|
|
@ -138,8 +138,6 @@ public class RegionManager {
|
||||||
region =
|
region =
|
||||||
cache.putRegion(createRegion(regionAndLeader.first, regionAndLeader.second, backOffer));
|
cache.putRegion(createRegion(regionAndLeader.first, regionAndLeader.second, backOffer));
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
|
||||||
return null;
|
|
||||||
} finally {
|
} finally {
|
||||||
requestTimer.observeDuration();
|
requestTimer.observeDuration();
|
||||||
slowLogSpan.end();
|
slowLogSpan.end();
|
||||||
|
|
|
||||||
|
|
@ -52,9 +52,12 @@ public class TimeoutTest extends MockThreeStoresTest {
|
||||||
try (RawKVClient client = createClient()) {
|
try (RawKVClient client = createClient()) {
|
||||||
pdServers.get(0).stop();
|
pdServers.get(0).stop();
|
||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
client.get(ByteString.copyFromUtf8("key"));
|
try {
|
||||||
|
client.get(ByteString.copyFromUtf8("key"));
|
||||||
|
} catch (Exception ignore) {
|
||||||
|
}
|
||||||
long end = System.currentTimeMillis();
|
long end = System.currentTimeMillis();
|
||||||
Assert.assertTrue(end - start < session.getConf().getRawKVReadTimeoutInMS() * 2L);
|
Assert.assertTrue(end - start < (session.getConf().getRawKVReadTimeoutInMS() * 1.5));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue