HBASE-17855 Fix typo in async client implementation
This commit is contained in:
parent
d033cbb715
commit
0ec1459467
|
@ -94,25 +94,26 @@ class AsyncMetaRegionLocator {
|
|||
}
|
||||
|
||||
void updateCachedLocation(HRegionLocation loc, Throwable exception) {
|
||||
updateCachedLoation(loc, exception, l -> metaRegionLocation.get(), newLoc -> {
|
||||
for (;;) {
|
||||
HRegionLocation oldLoc = metaRegionLocation.get();
|
||||
if (oldLoc != null && (oldLoc.getSeqNum() > newLoc.getSeqNum()
|
||||
|| oldLoc.getServerName().equals(newLoc.getServerName()))) {
|
||||
return;
|
||||
AsyncRegionLocator.updateCachedLocation(loc, exception, l -> metaRegionLocation.get(),
|
||||
newLoc -> {
|
||||
for (;;) {
|
||||
HRegionLocation oldLoc = metaRegionLocation.get();
|
||||
if (oldLoc != null && (oldLoc.getSeqNum() > newLoc.getSeqNum() ||
|
||||
oldLoc.getServerName().equals(newLoc.getServerName()))) {
|
||||
return;
|
||||
}
|
||||
if (metaRegionLocation.compareAndSet(oldLoc, newLoc)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (metaRegionLocation.compareAndSet(oldLoc, newLoc)) {
|
||||
return;
|
||||
}, l -> {
|
||||
for (;;) {
|
||||
HRegionLocation oldLoc = metaRegionLocation.get();
|
||||
if (!canUpdate(l, oldLoc) || metaRegionLocation.compareAndSet(oldLoc, null)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}, l -> {
|
||||
for (;;) {
|
||||
HRegionLocation oldLoc = metaRegionLocation.get();
|
||||
if (!canUpdate(l, oldLoc) || metaRegionLocation.compareAndSet(oldLoc, null)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
void clearCache() {
|
||||
|
|
|
@ -22,7 +22,6 @@ import static org.apache.hadoop.hbase.HConstants.NINES;
|
|||
import static org.apache.hadoop.hbase.HConstants.ZEROES;
|
||||
import static org.apache.hadoop.hbase.HRegionInfo.createRegionName;
|
||||
import static org.apache.hadoop.hbase.TableName.META_TABLE_NAME;
|
||||
import static org.apache.hadoop.hbase.client.AsyncRegionLocator.updateCachedLoation;
|
||||
import static org.apache.hadoop.hbase.client.ConnectionUtils.createClosestRowAfter;
|
||||
import static org.apache.hadoop.hbase.client.ConnectionUtils.isEmptyStopRow;
|
||||
import static org.apache.hadoop.hbase.util.Bytes.BYTES_COMPARATOR;
|
||||
|
@ -442,7 +441,7 @@ class AsyncNonMetaRegionLocator {
|
|||
}
|
||||
|
||||
void updateCachedLocation(HRegionLocation loc, Throwable exception) {
|
||||
updateCachedLoation(loc, exception, l -> {
|
||||
AsyncRegionLocator.updateCachedLocation(loc, exception, l -> {
|
||||
TableCache tableCache = cache.get(l.getRegionInfo().getTable());
|
||||
if (tableCache == null) {
|
||||
return null;
|
||||
|
|
|
@ -98,7 +98,7 @@ class AsyncRegionLocator {
|
|||
&& oldLoc.getServerName().equals(loc.getServerName());
|
||||
}
|
||||
|
||||
static void updateCachedLoation(HRegionLocation loc, Throwable exception,
|
||||
static void updateCachedLocation(HRegionLocation loc, Throwable exception,
|
||||
Function<HRegionLocation, HRegionLocation> cachedLocationSupplier,
|
||||
Consumer<HRegionLocation> addToCache, Consumer<HRegionLocation> removeFromCache) {
|
||||
HRegionLocation oldLoc = cachedLocationSupplier.apply(loc);
|
||||
|
|
|
@ -237,11 +237,11 @@ public abstract class AbstractTestAsyncTableScan {
|
|||
|
||||
@Test
|
||||
public void testScanWithLimit() throws Exception {
|
||||
// testScan(1, true, 998, false, 900); // from first region to last region
|
||||
testScan(1, true, 998, false, 900); // from first region to last region
|
||||
testScan(123, true, 234, true, 100);
|
||||
// testScan(234, true, 456, false, 100);
|
||||
// testScan(345, false, 567, true, 100);
|
||||
// testScan(456, false, 678, false, 100);
|
||||
testScan(234, true, 456, false, 100);
|
||||
testScan(345, false, 567, true, 100);
|
||||
testScan(456, false, 678, false, 100);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Reference in New Issue