fix potential NPE in region manager

Signed-off-by: iosmanthus <myosmanthustree@gmail.com>
This commit is contained in:
iosmanthus 2022-07-30 19:22:59 +08:00
parent 71b5772597
commit 360a3c7d24
No known key found for this signature in database
GPG Key ID: DEE5BAABFE092169
2 changed files with 5 additions and 4 deletions

View File

@ -138,8 +138,6 @@ public class RegionManager {
region =
cache.putRegion(createRegion(regionAndLeader.first, regionAndLeader.second, backOffer));
}
} catch (Exception e) {
return null;
} finally {
requestTimer.observeDuration();
slowLogSpan.end();

View File

@ -52,9 +52,12 @@ public class TimeoutTest extends MockThreeStoresTest {
try (RawKVClient client = createClient()) {
pdServers.get(0).stop();
long start = System.currentTimeMillis();
client.get(ByteString.copyFromUtf8("key"));
try {
client.get(ByteString.copyFromUtf8("key"));
} catch (Exception ignore) {
}
long end = System.currentTimeMillis();
Assert.assertTrue(end - start < session.getConf().getRawKVReadTimeoutInMS() * 2L);
Assert.assertTrue(end - start < (session.getConf().getRawKVReadTimeoutInMS() * 1.5));
}
}
}