HBASE-22279 Add a getRegionLocator method in Table/AsyncTable interface
This commit is contained in:
parent
38ff46f88f
commit
c3c48f30f7
|
@ -60,6 +60,15 @@ public interface AsyncTable<C extends ScanResultConsumerBase> {
|
||||||
*/
|
*/
|
||||||
Configuration getConfiguration();
|
Configuration getConfiguration();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the {@link TableDescriptor} for this table.
|
||||||
|
*/
|
||||||
|
CompletableFuture<TableDescriptor> getDescriptor();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the {@link AsyncTableRegionLocator} for this table.
|
||||||
|
*/
|
||||||
|
AsyncTableRegionLocator getRegionLocator();
|
||||||
/**
|
/**
|
||||||
* Get timeout of each rpc request in this Table instance. It will be overridden by a more
|
* Get timeout of each rpc request in this Table instance. It will be overridden by a more
|
||||||
* specific rpc timeout config such as readRpcTimeout or writeRpcTimeout.
|
* specific rpc timeout config such as readRpcTimeout or writeRpcTimeout.
|
||||||
|
|
|
@ -62,6 +62,16 @@ class AsyncTableImpl implements AsyncTable<ScanResultConsumer> {
|
||||||
return rawTable.getConfiguration();
|
return rawTable.getConfiguration();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CompletableFuture<TableDescriptor> getDescriptor() {
|
||||||
|
return wrap(rawTable.getDescriptor());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AsyncTableRegionLocator getRegionLocator() {
|
||||||
|
return rawTable.getRegionLocator();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getRpcTimeout(TimeUnit unit) {
|
public long getRpcTimeout(TimeUnit unit) {
|
||||||
return rawTable.getRpcTimeout(unit);
|
return rawTable.getRpcTimeout(unit);
|
||||||
|
|
|
@ -1180,6 +1180,7 @@ public class HTable implements Table {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public RegionLocator getRegionLocator() {
|
public RegionLocator getRegionLocator() {
|
||||||
return this.locator;
|
return this.locator;
|
||||||
}
|
}
|
||||||
|
|
|
@ -130,6 +130,16 @@ class RawAsyncTableImpl implements AsyncTable<AdvancedScanResultConsumer> {
|
||||||
return conn.getConfiguration();
|
return conn.getConfiguration();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CompletableFuture<TableDescriptor> getDescriptor() {
|
||||||
|
return conn.getAdmin().getDescriptor(tableName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AsyncTableRegionLocator getRegionLocator() {
|
||||||
|
return conn.getRegionLocator(tableName);
|
||||||
|
}
|
||||||
|
|
||||||
@FunctionalInterface
|
@FunctionalInterface
|
||||||
private interface Converter<D, I, S> {
|
private interface Converter<D, I, S> {
|
||||||
D convert(I info, S src) throws IOException;
|
D convert(I info, S src) throws IOException;
|
||||||
|
|
|
@ -18,30 +18,28 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.hadoop.hbase.client;
|
package org.apache.hadoop.hbase.client;
|
||||||
|
|
||||||
|
import com.google.protobuf.Descriptors;
|
||||||
|
import com.google.protobuf.Message;
|
||||||
|
import com.google.protobuf.Service;
|
||||||
|
import com.google.protobuf.ServiceException;
|
||||||
import java.io.Closeable;
|
import java.io.Closeable;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import org.apache.commons.lang3.NotImplementedException;
|
import org.apache.commons.lang3.NotImplementedException;
|
||||||
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.Configuration;
|
||||||
import org.apache.hadoop.hbase.Cell;
|
import org.apache.hadoop.hbase.Cell;
|
||||||
import org.apache.hadoop.hbase.CompareOperator;
|
import org.apache.hadoop.hbase.CompareOperator;
|
||||||
import org.apache.hadoop.hbase.HTableDescriptor;
|
import org.apache.hadoop.hbase.HTableDescriptor;
|
||||||
import org.apache.hadoop.hbase.TableName;
|
import org.apache.hadoop.hbase.TableName;
|
||||||
import org.apache.hadoop.hbase.io.TimeRange;
|
|
||||||
import org.apache.yetus.audience.InterfaceAudience;
|
|
||||||
|
|
||||||
import org.apache.hadoop.hbase.client.coprocessor.Batch;
|
import org.apache.hadoop.hbase.client.coprocessor.Batch;
|
||||||
import org.apache.hadoop.hbase.filter.CompareFilter;
|
import org.apache.hadoop.hbase.filter.CompareFilter;
|
||||||
|
import org.apache.hadoop.hbase.io.TimeRange;
|
||||||
import org.apache.hadoop.hbase.ipc.CoprocessorRpcChannel;
|
import org.apache.hadoop.hbase.ipc.CoprocessorRpcChannel;
|
||||||
import org.apache.hadoop.hbase.util.Bytes;
|
import org.apache.hadoop.hbase.util.Bytes;
|
||||||
import com.google.protobuf.Descriptors;
|
import org.apache.yetus.audience.InterfaceAudience;
|
||||||
import com.google.protobuf.Message;
|
|
||||||
import com.google.protobuf.Service;
|
|
||||||
import com.google.protobuf.ServiceException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to communicate with a single HBase table.
|
* Used to communicate with a single HBase table.
|
||||||
|
@ -92,6 +90,11 @@ public interface Table extends Closeable {
|
||||||
*/
|
*/
|
||||||
TableDescriptor getDescriptor() throws IOException;
|
TableDescriptor getDescriptor() throws IOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the {@link RegionLocator} for this table.
|
||||||
|
*/
|
||||||
|
RegionLocator getRegionLocator() throws IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test for the existence of columns in the table, as specified by the Get.
|
* Test for the existence of columns in the table, as specified by the Get.
|
||||||
* <p>
|
* <p>
|
||||||
|
|
|
@ -43,6 +43,7 @@ import org.apache.hadoop.hbase.client.Durability;
|
||||||
import org.apache.hadoop.hbase.client.Get;
|
import org.apache.hadoop.hbase.client.Get;
|
||||||
import org.apache.hadoop.hbase.client.Increment;
|
import org.apache.hadoop.hbase.client.Increment;
|
||||||
import org.apache.hadoop.hbase.client.Put;
|
import org.apache.hadoop.hbase.client.Put;
|
||||||
|
import org.apache.hadoop.hbase.client.RegionLocator;
|
||||||
import org.apache.hadoop.hbase.client.Result;
|
import org.apache.hadoop.hbase.client.Result;
|
||||||
import org.apache.hadoop.hbase.client.ResultScanner;
|
import org.apache.hadoop.hbase.client.ResultScanner;
|
||||||
import org.apache.hadoop.hbase.client.Row;
|
import org.apache.hadoop.hbase.client.Row;
|
||||||
|
@ -1022,4 +1023,9 @@ public class RemoteHTable implements Table {
|
||||||
throw new UnsupportedOperationException("thenMutate not implemented");
|
throw new UnsupportedOperationException("thenMutate not implemented");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RegionLocator getRegionLocator() throws IOException {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,24 +17,28 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.hadoop.hbase.regionserver;
|
package org.apache.hadoop.hbase.regionserver;
|
||||||
|
|
||||||
|
import com.google.protobuf.Descriptors.MethodDescriptor;
|
||||||
|
import com.google.protobuf.Message;
|
||||||
|
import com.google.protobuf.Service;
|
||||||
|
import com.google.protobuf.ServiceException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.Configuration;
|
||||||
import org.apache.hadoop.hbase.Cell;
|
import org.apache.hadoop.hbase.Cell;
|
||||||
|
import org.apache.hadoop.hbase.CompareOperator;
|
||||||
import org.apache.hadoop.hbase.HTableDescriptor;
|
import org.apache.hadoop.hbase.HTableDescriptor;
|
||||||
import org.apache.hadoop.hbase.TableName;
|
import org.apache.hadoop.hbase.TableName;
|
||||||
import org.apache.hadoop.hbase.CompareOperator;
|
|
||||||
import org.apache.hadoop.hbase.client.Append;
|
import org.apache.hadoop.hbase.client.Append;
|
||||||
import org.apache.hadoop.hbase.client.Delete;
|
import org.apache.hadoop.hbase.client.Delete;
|
||||||
import org.apache.hadoop.hbase.client.Durability;
|
import org.apache.hadoop.hbase.client.Durability;
|
||||||
import org.apache.hadoop.hbase.client.Get;
|
import org.apache.hadoop.hbase.client.Get;
|
||||||
import org.apache.hadoop.hbase.client.Increment;
|
import org.apache.hadoop.hbase.client.Increment;
|
||||||
import org.apache.hadoop.hbase.client.Put;
|
import org.apache.hadoop.hbase.client.Put;
|
||||||
|
import org.apache.hadoop.hbase.client.RegionLocator;
|
||||||
import org.apache.hadoop.hbase.client.Result;
|
import org.apache.hadoop.hbase.client.Result;
|
||||||
import org.apache.hadoop.hbase.client.ResultScanner;
|
import org.apache.hadoop.hbase.client.ResultScanner;
|
||||||
import org.apache.hadoop.hbase.client.Row;
|
import org.apache.hadoop.hbase.client.Row;
|
||||||
|
@ -48,11 +52,6 @@ import org.apache.hadoop.hbase.client.metrics.ScanMetrics;
|
||||||
import org.apache.hadoop.hbase.filter.CompareFilter.CompareOp;
|
import org.apache.hadoop.hbase.filter.CompareFilter.CompareOp;
|
||||||
import org.apache.hadoop.hbase.ipc.CoprocessorRpcChannel;
|
import org.apache.hadoop.hbase.ipc.CoprocessorRpcChannel;
|
||||||
|
|
||||||
import com.google.protobuf.Descriptors.MethodDescriptor;
|
|
||||||
import com.google.protobuf.Message;
|
|
||||||
import com.google.protobuf.Service;
|
|
||||||
import com.google.protobuf.ServiceException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An implementation of {@link Table} that sits directly on a Region; it decorates the passed in
|
* An implementation of {@link Table} that sits directly on a Region; it decorates the passed in
|
||||||
* Region instance with the Table API. Some API is not implemented yet (throws
|
* Region instance with the Table API. Some API is not implemented yet (throws
|
||||||
|
@ -412,9 +411,18 @@ public class RegionAsTable implements Table {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public int getWriteRpcTimeout() { throw new UnsupportedOperationException(); }
|
public int getWriteRpcTimeout() {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public int getReadRpcTimeout() { throw new UnsupportedOperationException(); }
|
public int getReadRpcTimeout() {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RegionLocator getRegionLocator() throws IOException {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -540,7 +540,11 @@ public class TestWALEntrySinkFilter {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setOperationTimeout(int operationTimeout) {
|
public void setOperationTimeout(int operationTimeout) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RegionLocator getRegionLocator() throws IOException {
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,6 +40,7 @@ import org.apache.hadoop.hbase.client.Delete;
|
||||||
import org.apache.hadoop.hbase.client.Get;
|
import org.apache.hadoop.hbase.client.Get;
|
||||||
import org.apache.hadoop.hbase.client.Increment;
|
import org.apache.hadoop.hbase.client.Increment;
|
||||||
import org.apache.hadoop.hbase.client.Put;
|
import org.apache.hadoop.hbase.client.Put;
|
||||||
|
import org.apache.hadoop.hbase.client.RegionLocator;
|
||||||
import org.apache.hadoop.hbase.client.Result;
|
import org.apache.hadoop.hbase.client.Result;
|
||||||
import org.apache.hadoop.hbase.client.ResultScanner;
|
import org.apache.hadoop.hbase.client.ResultScanner;
|
||||||
import org.apache.hadoop.hbase.client.Row;
|
import org.apache.hadoop.hbase.client.Row;
|
||||||
|
@ -489,4 +490,8 @@ public class ThriftTable implements Table {
|
||||||
throw new NotImplementedException("coprocessorService not supported in ThriftTable");
|
throw new NotImplementedException("coprocessorService not supported in ThriftTable");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RegionLocator getRegionLocator() throws IOException {
|
||||||
|
throw new NotImplementedException("getRegionLocator not supported in ThriftTable");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue