本文整理汇总了Java中org.apache.hadoop.hbase.regionserver.SplitTransaction.rollback方法的典型用法代码示例。如果您正苦于以下问题:Java SplitTransaction.rollback方法的具体用法?Java SplitTransaction.rollback怎么用?Java SplitTransaction.rollback使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.hbase.regionserver.SplitTransaction
的用法示例。
在下文中一共展示了SplitTransaction.rollback方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: preRollBack
import org.apache.hadoop.hbase.regionserver.SplitTransaction; //导入方法依赖的package包/类
@Override
public void preRollBack(ObserverContext<RegionCoprocessorEnvironment> ctx) throws IOException {
RegionCoprocessorEnvironment environment = ctx.getEnvironment();
HRegionServer rs = (HRegionServer) environment.getRegionServerServices();
HRegion region = environment.getRegion();
String userTableName = region.getTableDesc().getNameAsString();
if (IndexUtils.isIndexTable(userTableName)) {
return;
}
LOG.trace("Entering preRollBack for the table " + userTableName + " for the region "
+ region.getRegionInfo());
SplitInfo splitInfo = splitThreadLocal.get();
SplitTransaction splitTransaction = splitInfo.getSplitTransaction();
try {
if (splitTransaction != null) {
splitTransaction.rollback(rs, rs);
LOG.info("preRollBack successfully done for the table " + userTableName
+ " for the region " + region.getRegionInfo());
}
} catch (Exception e) {
LOG.error(
"Error while rolling back the split failure for index region "
+ splitTransaction.getParent(), e);
rs.abort("Abort; we got an error during rollback of index");
}
}
示例2: preRollBackSplit
import org.apache.hadoop.hbase.regionserver.SplitTransaction; //导入方法依赖的package包/类
@Override
public void preRollBackSplit(ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
RegionCoprocessorEnvironment environment = ctx.getEnvironment();
HRegionServer rs = (HRegionServer) environment.getRegionServerServices();
HRegion region = environment.getRegion();
HTableDescriptor tableDesc = region.getTableDesc();
String userTableName = tableDesc.getNameAsString();
if (isNotIndexedTableDescriptor(tableDesc)) {
return;
}
LOG.trace("Entering preRollBack for the table " + userTableName + " for the region "
+ region.getRegionInfo());
SplitInfo splitInfo = splitThreadLocal.get();
if (splitInfo == null) return;
SplitTransaction splitTransaction = splitInfo.getSplitTransaction();
try {
if (splitTransaction != null) {
splitTransaction.rollback(rs, rs);
LOG.info("preRollBack successfully done for the table " + userTableName
+ " for the region " + region.getRegionInfo());
}
} catch (Exception e) {
LOG.error(
"Error while rolling back the split failure for index region " + splitInfo.getParent(), e);
rs.abort("Abort; we got an error during rollback of index");
}
}
示例3: testIndexManagerWithFailedSplitTransaction
import org.apache.hadoop.hbase.regionserver.SplitTransaction; //导入方法依赖的package包/类
@Test(timeout = 180000)
public void testIndexManagerWithFailedSplitTransaction() throws Exception {
Configuration conf = UTIL.getConfiguration();
conf.setBoolean("hbase.use.secondary.index", true);
String userTableName = "testIndexManagerWithFailedSplitTransaction";
HTableDescriptor ihtd = new HTableDescriptor(TableName.valueOf(userTableName));
HColumnDescriptor hcd = new HColumnDescriptor("col1");
ihtd.addFamily(hcd);
IndexSpecification iSpec = new IndexSpecification("Index1");
iSpec.addIndexColumn(hcd, "ql", ValueType.String, 10);
TableIndices indices = new TableIndices();
indices.addIndex(iSpec);
ihtd.setValue(Constants.INDEX_SPEC_KEY, indices.toByteArray());
admin.createTable(ihtd);
IndexManager manager = IndexManager.getInstance();
int count = manager.getTableRegionCount(userTableName);
Assert.assertEquals(1, count);
HTable table = new HTable(conf, userTableName);
Put p = null;
for (int i = 0; i < 10; i++) {
p = new Put(Bytes.toBytes("row" + i));
p.add(Bytes.toBytes("col1"), Bytes.toBytes("ql"), Bytes.toBytes("test_val"));
table.put(p);
}
List<HRegion> regions = UTIL.getMiniHBaseCluster().getRegions(Bytes.toBytes(userTableName));
HRegionServer rs = UTIL.getMiniHBaseCluster().getRegionServer(0);
SplitTransaction st = null;
st = new MockedSplitTransaction(regions.get(0), "row5".getBytes());
try {
st.prepare();
st.execute(rs, rs);
} catch (IOException e) {
st.rollback(rs, rs);
}
count = manager.getTableRegionCount(userTableName);
Assert.assertEquals(1, count);
}
示例4: testIndexManagerWithFailedSplitTransaction
import org.apache.hadoop.hbase.regionserver.SplitTransaction; //导入方法依赖的package包/类
@Test(timeout = 180000)
public void testIndexManagerWithFailedSplitTransaction() throws Exception {
HBaseAdmin admin = new HBaseAdmin(UTIL.getConfiguration());
Configuration conf = admin.getConfiguration();
conf.setBoolean("hbase.use.secondary.index", true);
ZooKeeperWatcher zkw = HBaseTestingUtility.getZooKeeperWatcher(UTIL);
String userTableName = "testIndexManagerWithFailedSplitTransaction";
IndexedHTableDescriptor ihtd = new IndexedHTableDescriptor(userTableName);
HColumnDescriptor hcd = new HColumnDescriptor("col1");
ihtd.addFamily(hcd);
IndexSpecification iSpec = new IndexSpecification("Index1");
iSpec.addIndexColumn(hcd, "ql", ValueType.String, 10);
ihtd.addIndex(iSpec);
admin.createTable(ihtd);
ZKAssign.blockUntilNoRIT(zkw);
IndexManager manager = IndexManager.getInstance();
int count = manager.getTableRegionCount(userTableName);
Assert.assertEquals(1, count);
HTable table = new HTable(conf, userTableName);
Put p = null;
for (int i = 0; i < 10; i++) {
p = new Put(Bytes.toBytes("row" + i));
p.add(Bytes.toBytes("col1"), Bytes.toBytes("ql"), Bytes.toBytes("test_val"));
table.put(p);
}
List<HRegion> regions = UTIL.getMiniHBaseCluster().getRegions(Bytes.toBytes(userTableName));
HRegionServer rs = UTIL.getMiniHBaseCluster().getRegionServer(0);
SplitTransaction st = null;
st = new MockedSplitTransaction(regions.get(0), null) {
@Override
protected void splitStoreFiles(final Path splitdir, final List<StoreFile> hstoreFilesToSplit)
throws IOException {
throw new IOException();
}
};
try {
st.execute(rs, rs);
} catch (IOException e) {
st.rollback(rs, rs);
}
count = manager.getTableRegionCount(userTableName);
Assert.assertEquals(1, count);
}