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) {
|
void updateCachedLocation(HRegionLocation loc, Throwable exception) {
|
||||||
updateCachedLoation(loc, exception, l -> metaRegionLocation.get(), newLoc -> {
|
AsyncRegionLocator.updateCachedLocation(loc, exception, l -> metaRegionLocation.get(),
|
||||||
for (;;) {
|
newLoc -> {
|
||||||
HRegionLocation oldLoc = metaRegionLocation.get();
|
for (;;) {
|
||||||
if (oldLoc != null && (oldLoc.getSeqNum() > newLoc.getSeqNum()
|
HRegionLocation oldLoc = metaRegionLocation.get();
|
||||||
|| oldLoc.getServerName().equals(newLoc.getServerName()))) {
|
if (oldLoc != null && (oldLoc.getSeqNum() > newLoc.getSeqNum() ||
|
||||||
return;
|
oldLoc.getServerName().equals(newLoc.getServerName()))) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (metaRegionLocation.compareAndSet(oldLoc, newLoc)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (metaRegionLocation.compareAndSet(oldLoc, newLoc)) {
|
}, l -> {
|
||||||
return;
|
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() {
|
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.HConstants.ZEROES;
|
||||||
import static org.apache.hadoop.hbase.HRegionInfo.createRegionName;
|
import static org.apache.hadoop.hbase.HRegionInfo.createRegionName;
|
||||||
import static org.apache.hadoop.hbase.TableName.META_TABLE_NAME;
|
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.createClosestRowAfter;
|
||||||
import static org.apache.hadoop.hbase.client.ConnectionUtils.isEmptyStopRow;
|
import static org.apache.hadoop.hbase.client.ConnectionUtils.isEmptyStopRow;
|
||||||
import static org.apache.hadoop.hbase.util.Bytes.BYTES_COMPARATOR;
|
import static org.apache.hadoop.hbase.util.Bytes.BYTES_COMPARATOR;
|
||||||
|
@ -442,7 +441,7 @@ class AsyncNonMetaRegionLocator {
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateCachedLocation(HRegionLocation loc, Throwable exception) {
|
void updateCachedLocation(HRegionLocation loc, Throwable exception) {
|
||||||
updateCachedLoation(loc, exception, l -> {
|
AsyncRegionLocator.updateCachedLocation(loc, exception, l -> {
|
||||||
TableCache tableCache = cache.get(l.getRegionInfo().getTable());
|
TableCache tableCache = cache.get(l.getRegionInfo().getTable());
|
||||||
if (tableCache == null) {
|
if (tableCache == null) {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -98,7 +98,7 @@ class AsyncRegionLocator {
|
||||||
&& oldLoc.getServerName().equals(loc.getServerName());
|
&& oldLoc.getServerName().equals(loc.getServerName());
|
||||||
}
|
}
|
||||||
|
|
||||||
static void updateCachedLoation(HRegionLocation loc, Throwable exception,
|
static void updateCachedLocation(HRegionLocation loc, Throwable exception,
|
||||||
Function<HRegionLocation, HRegionLocation> cachedLocationSupplier,
|
Function<HRegionLocation, HRegionLocation> cachedLocationSupplier,
|
||||||
Consumer<HRegionLocation> addToCache, Consumer<HRegionLocation> removeFromCache) {
|
Consumer<HRegionLocation> addToCache, Consumer<HRegionLocation> removeFromCache) {
|
||||||
HRegionLocation oldLoc = cachedLocationSupplier.apply(loc);
|
HRegionLocation oldLoc = cachedLocationSupplier.apply(loc);
|
||||||
|
|
|
@ -237,11 +237,11 @@ public abstract class AbstractTestAsyncTableScan {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testScanWithLimit() throws Exception {
|
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(123, true, 234, true, 100);
|
||||||
// testScan(234, true, 456, false, 100);
|
testScan(234, true, 456, false, 100);
|
||||||
// testScan(345, false, 567, true, 100);
|
testScan(345, false, 567, true, 100);
|
||||||
// testScan(456, false, 678, false, 100);
|
testScan(456, false, 678, false, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Reference in New Issue