Skip to content

Commit 26121ee

Browse files
authored
RawGet changes the while (true) mechanism to a retry limit. (#90)
Signed-off-by: mikechengwei <[email protected]>
1 parent 41aeed2 commit 26121ee

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/main/java/org/tikv/raw/RawKVClient.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,14 +130,15 @@ private void batchPut(BackOffer backOffer, Map<ByteString, ByteString> kvPairs)
130130
*/
131131
public ByteString get(ByteString key) {
132132
BackOffer backOffer = defaultBackOff();
133-
while (true) {
133+
for (int i = 0; i < MAX_RETRY_LIMIT; i++) {
134134
RegionStoreClient client = clientBuilder.build(key);
135135
try {
136136
return client.rawGet(defaultBackOff(), key);
137137
} catch (final TiKVException e) {
138138
backOffer.doBackOff(BackOffFunction.BackOffFuncType.BoRegionMiss, e);
139139
}
140140
}
141+
throw ERR_RETRY_LIMIT_EXCEEDED;
141142
}
142143

143144
/**

0 commit comments

Comments
 (0)