Repository: phoenix Updated Branches: refs/heads/4.x-HBase-1.3 af9a5eb9e -> cb7d15816
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/cb7d1581 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/cb7d1581 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/cb7d1581 Branch: refs/heads/4.x-HBase-1.3 Commit: cb7d15816dec9952d4982d9669e45d2ae0fce617 Parents: af9a5eb Author: Geoffrey <[email protected]> Authored: Thu Oct 4 11:20:56 2018 -0700 Committer: Geoffrey Jacoby <[email protected]> Committed: Thu Oct 4 13:19:40 2018 -0700 ---------------------------------------------------------------------- .../index/PhoenixIndexImportDirectReducer.java | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/phoenix/blob/cb7d1581/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());
