swaroopak commented on a change in pull request #648: Phoenix 5591 Fail
indextool if split-merge happens during job run
URL: https://github.com/apache/phoenix/pull/648#discussion_r354048809
##########
File path:
phoenix-core/src/main/java/org/apache/phoenix/mapreduce/index/PhoenixIndexImportDirectReducer.java
##########
@@ -49,8 +50,27 @@
private static final Logger LOGGER =
LoggerFactory.getLogger(PhoenixIndexImportDirectReducer.class);
+ private static Integer regionCountForTesting = null;
+
+ public static void setRegionCountForTesting(Integer regionCount) {
+ regionCountForTesting = regionCount;
+ }
+
@Override
protected void cleanup(Context context) throws IOException,
InterruptedException{
+ String strNumOfRegions =
PhoenixConfigurationUtil.getNumOfRegions(context.getConfiguration());
+ if (strNumOfRegions != null) {
+ // Check if we have a region split/merge. Different numOfRegions
requires we need to run IndexTool again
+ String fullTableName =
PhoenixConfigurationUtil.getInputTableName(context.getConfiguration());
+ int newNumRegions = regionCountForTesting != null ?
regionCountForTesting :
+ IndexUtil.getNumOfRegions(context.getConfiguration(),
fullTableName);
+ int prevNumRegions = Integer.parseInt(strNumOfRegions);
+ if (newNumRegions != prevNumRegions) {
+ throw new IOException(String.format("Data table split/merge
happened during Index rebuild. Old region cnt=%d, New region cnt = %d"
Review comment:
nit: please extract the message to a static string
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services