LOG.trace("Entering preSplitBeforePONR for the table " + userTableName + " for the region "
+ region.getRegionInfo());
String indexTableName = IndexUtils.getIndexTableName(userTableName);
if (indexManager.getIndicesForTable(userTableName) != null) {
HRegion indexRegion = null;
SplitTransaction st = null;
try {
indexRegion = getIndexRegion(rs, region.getStartKey(), indexTableName);
if (null != indexRegion) {
LOG.info("Flushing the cache for the index table " + indexTableName + " for the region "
+ indexRegion.getRegionInfo());
indexRegion.flushcache();
if (LOG.isInfoEnabled()) {
LOG.info("Forcing split for the index table " + indexTableName + " with split key "
+ Bytes.toString(splitKey));
}
st = new SplitTransaction(indexRegion, splitKey);
if (!st.prepare()) {
LOG.error("Prepare for the index table " + indexTableName
+ " failed. So returning null. ");
return null;
}
indexRegion.forceSplit(splitKey);
PairOfSameType<HRegion> daughterRegions = st.stepsBeforeAddingPONR(rs, rs, false);
SplitInfo splitInfo = splitThreadLocal.get();
splitInfo.setDaughtersAndTransaction(daughterRegions, st);
LOG.info("Daughter regions created for the index table " + indexTableName
+ " for the region " + indexRegion.getRegionInfo());
return splitInfo;
} else {
LOG.error("IndexRegion for the table " + indexTableName + " is null. So returning null. ");
return null;
}
} catch (Exception ex) {
LOG.error("Error while spliting the indexTabRegion or not able to get the indexTabRegion:"
+ indexRegion != null ? indexRegion.getRegionName() : "", ex);
st.rollback(rs, rs);
return null;
}
}
LOG.trace("Indexes for the table " + userTableName
+ " are null. So returning the empty SplitInfo");