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/adbd986f
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/adbd986f
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/adbd986f

Branch: refs/heads/4.x-cdh5.15
Commit: adbd986fe1f59a4dcdf8d14e8c153e96d6dc987a
Parents: cea1c71
Author: Geoffrey <gjac...@apache.org>
Authored: Thu Oct 4 19:20:56 2018 +0100
Committer: Pedro Boado <pbo...@apache.org>
Committed: Wed Oct 17 22:49:38 2018 +0100

----------------------------------------------------------------------
 .../index/PhoenixIndexImportDirectReducer.java       | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/adbd986f/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());

Reply via email to