This is an automated email from the ASF dual-hosted git repository.

achouhan pushed a commit to branch 4.x
in repository https://gitbox.apache.org/repos/asf/phoenix.git


The following commit(s) were added to refs/heads/4.x by this push:
     new b2dfc71  PHOENIX-5931 PhoenixIndexFailurePolicy throws NPE if cause of 
IOE is null
b2dfc71 is described below

commit b2dfc71b68305d7d0d1622fdd45b6cbd17d25532
Author: Abhishek Singh Chouhan <achou...@apache.org>
AuthorDate: Mon Jun 1 19:55:04 2020 -0700

    PHOENIX-5931 PhoenixIndexFailurePolicy throws NPE if cause of IOE is null
---
 .../org/apache/phoenix/coprocessor/IndexRebuildRegionScanner.java    | 5 +++--
 .../java/org/apache/phoenix/index/PhoenixIndexFailurePolicy.java     | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/IndexRebuildRegionScanner.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/IndexRebuildRegionScanner.java
index a9682b0..c5aa36c 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/IndexRebuildRegionScanner.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/IndexRebuildRegionScanner.java
@@ -1373,8 +1373,9 @@ public class IndexRebuildRegionScanner extends 
GlobalIndexRegionScanner {
                     }
                 }
             }
-        } catch (IOException e) {
-            LOGGER.error("IOException during rebuilding: " + 
Throwables.getStackTraceAsString(e));
+        } catch (Throwable e) {
+            LOGGER.error("Exception in IndexRebuildRegionScanner for region "
+                    + region.getRegionInfo().getRegionNameAsString(), e);
             throw e;
         } finally {
             region.closeRegionOperation();
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixIndexFailurePolicy.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixIndexFailurePolicy.java
index 00cbc1e..45bd7dd 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixIndexFailurePolicy.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixIndexFailurePolicy.java
@@ -493,7 +493,7 @@ public class PhoenixIndexFailurePolicy extends 
DelegateIndexFailurePolicy {
                 return;
             } catch (IOException e) {
                 SQLException inferredE = 
ServerUtil.parseLocalOrRemoteServerException(e);
-                if (inferredE == null || inferredE.getErrorCode() != 
SQLExceptionCode.INDEX_WRITE_FAILURE.getErrorCode()) {
+                if (inferredE != null && inferredE.getErrorCode() != 
SQLExceptionCode.INDEX_WRITE_FAILURE.getErrorCode()) {
                     // If this call is from phoenix client, we also need to 
check if SQLException
                     // error is INDEX_METADATA_NOT_FOUND or not
                     // if it's not an INDEX_METADATA_NOT_FOUND, throw 
exception,

Reply via email to