本文整理汇总了Java中org.apache.hadoop.hbase.master.BulkReOpen类的典型用法代码示例。如果您正苦于以下问题:Java BulkReOpen类的具体用法?Java BulkReOpen怎么用?Java BulkReOpen使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BulkReOpen类属于org.apache.hadoop.hbase.master包,在下文中一共展示了BulkReOpen类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: reOpenAllRegions
import org.apache.hadoop.hbase.master.BulkReOpen; //导入依赖的package包/类
public boolean reOpenAllRegions(List<HRegionInfo> regions) throws IOException {
boolean done = false;
LOG.info("Bucketing regions by region server...");
List<HRegionLocation> regionLocations = null;
Connection connection = this.masterServices.getConnection();
try (RegionLocator locator = connection.getRegionLocator(tableName)) {
regionLocations = locator.getAllRegionLocations();
}
// Convert List<HRegionLocation> to Map<HRegionInfo, ServerName>.
NavigableMap<HRegionInfo, ServerName> hri2Sn = new TreeMap<HRegionInfo, ServerName>();
for (HRegionLocation location: regionLocations) {
hri2Sn.put(location.getRegionInfo(), location.getServerName());
}
TreeMap<ServerName, List<HRegionInfo>> serverToRegions = Maps.newTreeMap();
List<HRegionInfo> reRegions = new ArrayList<HRegionInfo>();
for (HRegionInfo hri : regions) {
ServerName sn = hri2Sn.get(hri);
// Skip the offlined split parent region
// See HBASE-4578 for more information.
if (null == sn) {
LOG.info("Skip " + hri);
continue;
}
if (!serverToRegions.containsKey(sn)) {
LinkedList<HRegionInfo> hriList = Lists.newLinkedList();
serverToRegions.put(sn, hriList);
}
reRegions.add(hri);
serverToRegions.get(sn).add(hri);
}
LOG.info("Reopening " + reRegions.size() + " regions on "
+ serverToRegions.size() + " region servers.");
this.masterServices.getAssignmentManager().setRegionsToReopen(reRegions);
BulkReOpen bulkReopen = new BulkReOpen(this.server, serverToRegions,
this.masterServices.getAssignmentManager());
while (true) {
try {
if (bulkReopen.bulkReOpen()) {
done = true;
break;
} else {
LOG.warn("Timeout before reopening all regions");
}
} catch (InterruptedException e) {
LOG.warn("Reopen was interrupted");
// Preserve the interrupt.
Thread.currentThread().interrupt();
break;
}
}
return done;
}
开发者ID:fengchen8086,项目名称:ditb,代码行数:54,代码来源:TableEventHandler.java
示例2: reOpenAllRegions
import org.apache.hadoop.hbase.master.BulkReOpen; //导入依赖的package包/类
/**
* Reopen all regions from a table after a schema change operation.
**/
public static boolean reOpenAllRegions(
final MasterProcedureEnv env,
final TableName tableName,
final List<HRegionInfo> regionInfoList) throws IOException {
boolean done = false;
LOG.info("Bucketing regions by region server...");
List<HRegionLocation> regionLocations = null;
Connection connection = env.getMasterServices().getConnection();
try (RegionLocator locator = connection.getRegionLocator(tableName)) {
regionLocations = locator.getAllRegionLocations();
}
// Convert List<HRegionLocation> to Map<HRegionInfo, ServerName>.
NavigableMap<HRegionInfo, ServerName> hri2Sn = new TreeMap<HRegionInfo, ServerName>();
for (HRegionLocation location : regionLocations) {
hri2Sn.put(location.getRegionInfo(), location.getServerName());
}
TreeMap<ServerName, List<HRegionInfo>> serverToRegions = Maps.newTreeMap();
List<HRegionInfo> reRegions = new ArrayList<HRegionInfo>();
for (HRegionInfo hri : regionInfoList) {
ServerName sn = hri2Sn.get(hri);
// Skip the offlined split parent region
// See HBASE-4578 for more information.
if (null == sn) {
LOG.info("Skip " + hri);
continue;
}
if (!serverToRegions.containsKey(sn)) {
LinkedList<HRegionInfo> hriList = Lists.newLinkedList();
serverToRegions.put(sn, hriList);
}
reRegions.add(hri);
serverToRegions.get(sn).add(hri);
}
LOG.info("Reopening " + reRegions.size() + " regions on " + serverToRegions.size()
+ " region servers.");
AssignmentManager am = env.getMasterServices().getAssignmentManager();
am.setRegionsToReopen(reRegions);
BulkReOpen bulkReopen = new BulkReOpen(env.getMasterServices(), serverToRegions, am);
while (true) {
try {
if (bulkReopen.bulkReOpen()) {
done = true;
break;
} else {
LOG.warn("Timeout before reopening all regions");
}
} catch (InterruptedException e) {
LOG.warn("Reopen was interrupted");
// Preserve the interrupt.
Thread.currentThread().interrupt();
break;
}
}
return done;
}
开发者ID:fengchen8086,项目名称:ditb,代码行数:60,代码来源:MasterDDLOperationHelper.java
示例3: reOpenAllRegions
import org.apache.hadoop.hbase.master.BulkReOpen; //导入依赖的package包/类
public boolean reOpenAllRegions(List<HRegionInfo> regions) throws IOException {
boolean done = false;
HTable table = null;
TreeMap<ServerName, List<HRegionInfo>> serverToRegions = Maps.newTreeMap();
NavigableMap<HRegionInfo, ServerName> hriHserverMapping;
LOG.info("Bucketing regions by region server...");
try {
table = new HTable(masterServices.getConfiguration(), tableName);
hriHserverMapping = table.getRegionLocations();
} finally {
if (table != null) {
table.close();
}
}
List<HRegionInfo> reRegions = new ArrayList<HRegionInfo>();
for (HRegionInfo hri : regions) {
ServerName rsLocation = hriHserverMapping.get(hri);
// Skip the offlined split parent region
// See HBASE-4578 for more information.
if (null == rsLocation) {
LOG.info("Skip " + hri);
continue;
}
if (!serverToRegions.containsKey(rsLocation)) {
LinkedList<HRegionInfo> hriList = Lists.newLinkedList();
serverToRegions.put(rsLocation, hriList);
}
reRegions.add(hri);
serverToRegions.get(rsLocation).add(hri);
}
LOG.info("Reopening " + reRegions.size() + " regions on "
+ serverToRegions.size() + " region servers.");
this.masterServices.getAssignmentManager().setRegionsToReopen(reRegions);
notifyEventBeingHandled();
BulkReOpen bulkReopen = new BulkReOpen(this.server, serverToRegions,
this.masterServices.getAssignmentManager());
while (true) {
try {
if (bulkReopen.bulkReOpen()) {
done = true;
break;
} else {
LOG.warn("Timeout before reopening all regions");
}
} catch (InterruptedException e) {
LOG.warn("Reopen was interrupted");
// Preserve the interrupt.
Thread.currentThread().interrupt();
break;
}
}
return done;
}
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:58,代码来源:TableEventHandler.java
示例4: reOpenAllRegions
import org.apache.hadoop.hbase.master.BulkReOpen; //导入依赖的package包/类
public boolean reOpenAllRegions(List<HRegionInfo> regions) throws IOException {
boolean done = false;
LOG.info("Bucketing regions by region server...");
HTable table = new HTable(masterServices.getConfiguration(), tableName);
TreeMap<ServerName, List<HRegionInfo>> serverToRegions = Maps
.newTreeMap();
NavigableMap<HRegionInfo, ServerName> hriHserverMapping;
try {
hriHserverMapping = table.getRegionLocations();
} finally {
table.close();
}
List<HRegionInfo> reRegions = new ArrayList<HRegionInfo>();
for (HRegionInfo hri : regions) {
ServerName rsLocation = hriHserverMapping.get(hri);
// Skip the offlined split parent region
// See HBASE-4578 for more information.
if (null == rsLocation) {
LOG.info("Skip " + hri);
continue;
}
if (!serverToRegions.containsKey(rsLocation)) {
LinkedList<HRegionInfo> hriList = Lists.newLinkedList();
serverToRegions.put(rsLocation, hriList);
}
reRegions.add(hri);
serverToRegions.get(rsLocation).add(hri);
}
LOG.info("Reopening " + reRegions.size() + " regions on "
+ serverToRegions.size() + " region servers.");
this.masterServices.getAssignmentManager().setRegionsToReopen(reRegions);
BulkReOpen bulkReopen = new BulkReOpen(this.server, serverToRegions,
this.masterServices.getAssignmentManager());
while (true) {
try {
if (bulkReopen.bulkReOpen()) {
done = true;
break;
} else {
LOG.warn("Timeout before reopening all regions");
}
} catch (InterruptedException e) {
LOG.warn("Reopen was interrupted");
// Preserve the interrupt.
Thread.currentThread().interrupt();
break;
}
}
return done;
}
开发者ID:tenggyut,项目名称:HIndex,代码行数:54,代码来源:TableEventHandler.java
示例5: reOpenAllRegions
import org.apache.hadoop.hbase.master.BulkReOpen; //导入依赖的package包/类
public boolean reOpenAllRegions(List<HRegionInfo> regions) throws IOException {
boolean done = false;
LOG.info("Bucketing regions by region server...");
HTable table = new HTable(masterServices.getConfiguration(), tableName);
TreeMap<ServerName, List<HRegionInfo>> serverToRegions = Maps
.newTreeMap();
NavigableMap<HRegionInfo, ServerName> hriHserverMapping = table.getRegionLocations();
List<HRegionInfo> reRegions = new ArrayList<HRegionInfo>();
for (HRegionInfo hri : regions) {
ServerName rsLocation = hriHserverMapping.get(hri);
// Skip the offlined split parent region
// See HBASE-4578 for more information.
if (null == rsLocation) {
LOG.info("Skip " + hri);
continue;
}
if (!serverToRegions.containsKey(rsLocation)) {
LinkedList<HRegionInfo> hriList = Lists.newLinkedList();
serverToRegions.put(rsLocation, hriList);
}
reRegions.add(hri);
serverToRegions.get(rsLocation).add(hri);
}
LOG.info("Reopening " + reRegions.size() + " regions on "
+ serverToRegions.size() + " region servers.");
this.masterServices.getAssignmentManager().setRegionsToReopen(reRegions);
BulkReOpen bulkReopen = new BulkReOpen(this.server, serverToRegions,
this.masterServices.getAssignmentManager());
while (true) {
try {
if (bulkReopen.bulkReOpen()) {
done = true;
break;
} else {
LOG.warn("Timeout before reopening all regions");
}
} catch (InterruptedException e) {
LOG.warn("Reopen was interrupted");
// Preserve the interrupt.
Thread.currentThread().interrupt();
break;
}
}
return done;
}
开发者ID:lifeng5042,项目名称:RStore,代码行数:48,代码来源:TableEventHandler.java
示例6: reOpenAllRegions
import org.apache.hadoop.hbase.master.BulkReOpen; //导入依赖的package包/类
public boolean reOpenAllRegions(List<HRegionInfo> regions) throws IOException {
boolean done = false;
LOG.info("Bucketing regions by region server...");
HTable table = new HTable(masterServices.getConfiguration(), tableName);
TreeMap<ServerName, List<HRegionInfo>> serverToRegions = Maps
.newTreeMap();
NavigableMap<HRegionInfo, ServerName> hriHserverMapping = table.getRegionLocations();
List<HRegionInfo> reRegions = new ArrayList<HRegionInfo>();
for (HRegionInfo hri : regions) {
ServerName rsLocation = hriHserverMapping.get(hri);
// Skip the offlined split parent region
// See HBASE-4578 for more information.
if (null == rsLocation) {
LOG.info("Skip " + hri);
continue;
}
if (!serverToRegions.containsKey(rsLocation)) {
LinkedList<HRegionInfo> hriList = Lists.newLinkedList();
serverToRegions.put(rsLocation, hriList);
}
reRegions.add(hri);
serverToRegions.get(rsLocation).add(hri);
}
LOG.info("Reopening " + reRegions.size() + " regions on "
+ serverToRegions.size() + " region servers.");
this.masterServices.getAssignmentManager().setRegionsToReopen(reRegions);
BulkReOpen bulkReopen = new BulkReOpen(this.server, serverToRegions,
this.masterServices.getAssignmentManager());
while (true) {
try {
if (bulkReopen.bulkReOpen()) {
done = true;
break;
} else {
LOG.warn("Timeout before reopening all regions");
}
} catch (InterruptedException e) {
LOG.warn("Reopen was interrupted");
// Preserve the interrupt.
Thread.currentThread().interrupt();
break;
}
}
return done;
}
开发者ID:cloud-software-foundation,项目名称:c5,代码行数:48,代码来源:TableEventHandler.java
注:本文中的org.apache.hadoop.hbase.master.BulkReOpen类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论