Repository: phoenix Updated Branches: refs/heads/master c2aaadbdc -> e6d3ebcfa
PHOENIX-4949 - IndexTool - updateIndexState called too many times unnecessarily Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/e6d3ebcf Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/e6d3ebcf Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/e6d3ebcf Branch: refs/heads/master Commit: e6d3ebcfa235de1d242579896b772497b63a15e4 Parents: c2aaadb Author: Geoffrey <[email protected]> Authored: Thu Oct 4 11:20:56 2018 -0700 Committer: Geoffrey Jacoby <[email protected]> Committed: Thu Oct 4 13:10:51 2018 -0700 ---------------------------------------------------------------------- .../index/PhoenixIndexImportDirectReducer.java | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/phoenix/blob/e6d3ebcf/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/index/PhoenixIndexImportDirectReducer.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/index/PhoenixIndexImportDirectReducer.java b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/index/PhoenixIndexImportDirectReducer.java index 51b88c1..0786b9b 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/index/PhoenixIndexImportDirectReducer.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/index/PhoenixIndexImportDirectReducer.java @@ -36,22 +36,11 @@ public class PhoenixIndexImportDirectReducer extends Reducer<ImmutableBytesWritable, IntWritable, NullWritable, NullWritable> { private static final Logger LOG = LoggerFactory.getLogger(PhoenixIndexImportDirectReducer.class); - private Configuration configuration; - /** - * Called once at the start of the task. - */ @Override - protected void setup(Context context) throws IOException, InterruptedException { - configuration = context.getConfiguration(); - } - - @Override - protected void reduce(ImmutableBytesWritable arg0, Iterable<IntWritable> arg1, - Reducer<ImmutableBytesWritable, IntWritable, NullWritable, NullWritable>.Context arg2) - throws IOException, InterruptedException { + protected void cleanup(Context context) throws IOException, InterruptedException{ try { - IndexToolUtil.updateIndexState(configuration, PIndexState.ACTIVE); + IndexToolUtil.updateIndexState(context.getConfiguration(), PIndexState.ACTIVE); } catch (SQLException e) { LOG.error(" Failed to update the status to Active"); throw new RuntimeException(e.getMessage());
