本文整理了Java中org.apache.hadoop.hbase.client.Admin.unassign()
方法的一些代码示例,展示了Admin.unassign()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Admin.unassign()
方法的具体详情如下:
包路径:org.apache.hadoop.hbase.client.Admin
类名称:Admin
方法名:unassign
[英]Unassign a region from current hosting regionserver. Region will then be assigned to a regionserver chosen at random. Region could be reassigned back to the same server. Use #move(byte[],byte[]) if you want to control the region movement.
[中]从当前宿主区域服务器取消分配区域。然后将区域分配给随机选择的regionserver。可以将区域重新分配回同一服务器。如果要控制区域移动,请使用#move(字节[],字节[])。
代码示例来源:origin: apache/hbase
@Override
public void unassign(byte[] regionName) throws IOException {
clusterConnection.getAdmin().unassign(regionName, false);
}
代码示例来源:origin: apache/hbase
+ " instead of using offline method, you should"
+ " restart HMaster after these repairs");
admin.unassign(regionName, true);
return;
+ " restart HMaster after these repairs");
rsSupportsOffline = false; // in the future just use unassign
admin.unassign(regionName, true);
return;
代码示例来源:origin: apache/hbase
/**
* Unassign the named region.
*
* @param regionName The region to unassign.
*/
public void unassignRegion(byte[] regionName) throws IOException {
getAdmin().unassign(regionName, true);
}
代码示例来源:origin: apache/hbase
protected void wipeOutMeta() throws IOException {
// Mess it up by blowing up meta.
Admin admin = TEST_UTIL.getAdmin();
Scan s = new Scan();
Table meta = TEST_UTIL.getConnection().getTable(TableName.META_TABLE_NAME);
ResultScanner scanner = meta.getScanner(s);
List<Delete> dels = new ArrayList<>();
for (Result r : scanner) {
RegionInfo info =
MetaTableAccessor.getRegionInfo(r);
if(info != null && !info.getTable().getNamespaceAsString()
.equals(NamespaceDescriptor.SYSTEM_NAMESPACE_NAME_STR)) {
Delete d = new Delete(r.getRow());
dels.add(d);
admin.unassign(r.getRow(), true);
}
}
meta.delete(dels);
scanner.close();
meta.close();
}
代码示例来源:origin: apache/hbase
@Test
public void testCloseRegionIfInvalidRegionNameIsPassed() throws Exception {
final String name = this.name.getMethodName();
byte[] tableName = Bytes.toBytes(name);
createTableWithDefaultConf(tableName);
RegionInfo info = null;
HRegionServer rs = TEST_UTIL.getRSForFirstRegionInTable(TableName.valueOf(tableName));
List<RegionInfo> onlineRegions = ProtobufUtil.getOnlineRegions(rs.getRSRpcServices());
for (RegionInfo regionInfo : onlineRegions) {
if (!regionInfo.isMetaRegion()) {
if (regionInfo.getRegionNameAsString().contains(name)) {
info = regionInfo;
try {
admin.unassign(Bytes.toBytes("sample"), true);
} catch (UnknownRegionException nsre) {
// expected, ignore it
}
}
}
}
onlineRegions = ProtobufUtil.getOnlineRegions(rs.getRSRpcServices());
assertTrue("The region should be present in online regions list.",
onlineRegions.contains(info));
}
代码示例来源:origin: apache/hbase
@Test
public void testCloseRegionThatFetchesTheHRIFromMeta() throws Exception {
final TableName tableName = TableName.valueOf(name.getMethodName());
createTableWithDefaultConf(tableName);
RegionInfo info = null;
HRegionServer rs = TEST_UTIL.getRSForFirstRegionInTable(tableName);
List<RegionInfo> onlineRegions = ProtobufUtil.getOnlineRegions(rs.getRSRpcServices());
for (RegionInfo regionInfo : onlineRegions) {
if (!regionInfo.isMetaRegion()) {
if (regionInfo.getRegionNameAsString().contains("TestHBACloseRegion2")) {
info = regionInfo;
admin.unassign(regionInfo.getRegionName(), true);
}
}
}
boolean isInList = ProtobufUtil.getOnlineRegions(
rs.getRSRpcServices()).contains(info);
long timeout = System.currentTimeMillis() + 10000;
while ((System.currentTimeMillis() < timeout) && (isInList)) {
Thread.sleep(100);
isInList = ProtobufUtil.getOnlineRegions(
rs.getRSRpcServices()).contains(info);
}
assertFalse("The region should not be present in online regions list.",
isInList);
}
代码示例来源:origin: apache/hbase
@Test
public void testShouldUnassignTheRegion() throws Exception {
final TableName tableName = TableName.valueOf(name.getMethodName());
createTableWithDefaultConf(tableName);
RegionInfo info = null;
HRegionServer rs = TEST_UTIL.getRSForFirstRegionInTable(tableName);
List<RegionInfo> onlineRegions = ProtobufUtil.getOnlineRegions(rs.getRSRpcServices());
for (RegionInfo regionInfo : onlineRegions) {
if (!regionInfo.getTable().isSystemTable()) {
info = regionInfo;
admin.unassign(regionInfo.getRegionName(), true);
}
}
boolean isInList = ProtobufUtil.getOnlineRegions(
rs.getRSRpcServices()).contains(info);
long timeout = System.currentTimeMillis() + 10000;
while ((System.currentTimeMillis() < timeout) && (isInList)) {
Thread.sleep(100);
isInList = ProtobufUtil.getOnlineRegions(
rs.getRSRpcServices()).contains(info);
}
assertFalse("The region should not be present in online regions list.",
isInList);
}
代码示例来源:origin: apache/hbase
TEST_UTIL.getAdmin().unassign(deleteRow, true);
代码示例来源:origin: apache/hbase
admin.unassign(regionToMove.getRegionName(), true);
try {
admin.move(regionToMove.getEncodedNameAsBytes(),
代码示例来源:origin: apache/hbase
admin.unassign(loc.getRegionInfo().getEncodedNameAsBytes(), true);
代码示例来源:origin: apache/hbase
List<RegionInfo> regions = admin.getRegions(this.tableName);
for (RegionInfo ri: regions) {
admin.unassign(ri.getRegionName(), false);
代码示例来源:origin: apache/hbase
assertEquals(1, regions.size());
RegionInfo hri = regions.get(0);
admin.unassign(hri.getRegionName(), true);
代码示例来源:origin: apache/hbase
HRegionServer rs = cluster.getRegionServer(i);
LOG.info("Unassigning " + hri);
TEST_UTIL.getAdmin().unassign(hri.getRegionName(), true);
long startTime = EnvironmentEdgeManager.currentTime();
long timeOut = 10000;
代码示例来源:origin: apache/phoenix
admin.getRegions(TableName.valueOf(dataTable)).get(0);
logger.info("Closing data table region");
admin.unassign(dataRegion.getEncodedNameAsBytes(), true);
代码示例来源:origin: org.apache.hbase/hbase-server
/**
* Unassign the named region.
*
* @param regionName The region to unassign.
*/
public void unassignRegion(byte[] regionName) throws IOException {
getAdmin().unassign(regionName, true);
}
代码示例来源:origin: org.apache.hbase/hbase-server
protected void wipeOutMeta() throws IOException {
// Mess it up by blowing up meta.
Admin admin = TEST_UTIL.getAdmin();
Scan s = new Scan();
Table meta = TEST_UTIL.getConnection().getTable(TableName.META_TABLE_NAME);
ResultScanner scanner = meta.getScanner(s);
List<Delete> dels = new ArrayList<>();
for (Result r : scanner) {
RegionInfo info =
MetaTableAccessor.getRegionInfo(r);
if(info != null && !info.getTable().getNamespaceAsString()
.equals(NamespaceDescriptor.SYSTEM_NAMESPACE_NAME_STR)) {
Delete d = new Delete(r.getRow());
dels.add(d);
admin.unassign(r.getRow(), true);
}
}
meta.delete(dels);
scanner.close();
meta.close();
}
代码示例来源:origin: org.apache.hbase/hbase-server
@Test
public void testCloseRegionIfInvalidRegionNameIsPassed() throws Exception {
final String name = this.name.getMethodName();
byte[] tableName = Bytes.toBytes(name);
createTableWithDefaultConf(tableName);
RegionInfo info = null;
HRegionServer rs = TEST_UTIL.getRSForFirstRegionInTable(TableName.valueOf(tableName));
List<RegionInfo> onlineRegions = ProtobufUtil.getOnlineRegions(rs.getRSRpcServices());
for (RegionInfo regionInfo : onlineRegions) {
if (!regionInfo.isMetaRegion()) {
if (regionInfo.getRegionNameAsString().contains(name)) {
info = regionInfo;
try {
admin.unassign(Bytes.toBytes("sample"), true);
} catch (UnknownRegionException nsre) {
// expected, ignore it
}
}
}
}
onlineRegions = ProtobufUtil.getOnlineRegions(rs.getRSRpcServices());
assertTrue("The region should be present in online regions list.",
onlineRegions.contains(info));
}
代码示例来源:origin: org.apache.hbase/hbase-server
@Test
public void testCloseRegionThatFetchesTheHRIFromMeta() throws Exception {
final TableName tableName = TableName.valueOf(name.getMethodName());
createTableWithDefaultConf(tableName);
RegionInfo info = null;
HRegionServer rs = TEST_UTIL.getRSForFirstRegionInTable(tableName);
List<RegionInfo> onlineRegions = ProtobufUtil.getOnlineRegions(rs.getRSRpcServices());
for (RegionInfo regionInfo : onlineRegions) {
if (!regionInfo.isMetaRegion()) {
if (regionInfo.getRegionNameAsString().contains("TestHBACloseRegion2")) {
info = regionInfo;
admin.unassign(regionInfo.getRegionName(), true);
}
}
}
boolean isInList = ProtobufUtil.getOnlineRegions(
rs.getRSRpcServices()).contains(info);
long timeout = System.currentTimeMillis() + 10000;
while ((System.currentTimeMillis() < timeout) && (isInList)) {
Thread.sleep(100);
isInList = ProtobufUtil.getOnlineRegions(
rs.getRSRpcServices()).contains(info);
}
assertFalse("The region should not be present in online regions list.",
isInList);
}
代码示例来源:origin: org.apache.hbase/hbase-server
@Test
public void testShouldUnassignTheRegion() throws Exception {
final TableName tableName = TableName.valueOf(name.getMethodName());
createTableWithDefaultConf(tableName);
RegionInfo info = null;
HRegionServer rs = TEST_UTIL.getRSForFirstRegionInTable(tableName);
List<RegionInfo> onlineRegions = ProtobufUtil.getOnlineRegions(rs.getRSRpcServices());
for (RegionInfo regionInfo : onlineRegions) {
if (!regionInfo.getTable().isSystemTable()) {
info = regionInfo;
admin.unassign(regionInfo.getRegionName(), true);
}
}
boolean isInList = ProtobufUtil.getOnlineRegions(
rs.getRSRpcServices()).contains(info);
long timeout = System.currentTimeMillis() + 10000;
while ((System.currentTimeMillis() < timeout) && (isInList)) {
Thread.sleep(100);
isInList = ProtobufUtil.getOnlineRegions(
rs.getRSRpcServices()).contains(info);
}
assertFalse("The region should not be present in online regions list.",
isInList);
}
代码示例来源:origin: org.apache.hbase/hbase-server
TEST_UTIL.getAdmin().unassign(deleteRow, true);
内容来源于网络,如有侵权,请联系作者删除!