Repository: phoenix
Updated Branches:
  refs/heads/master 43e1ade90 -> e07e04a54


PHOENIX-4963 Do not throw when transitioning to PENDING_DISABLE if index is 
already disabled


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/e07e04a5
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/e07e04a5
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/e07e04a5

Branch: refs/heads/master
Commit: e07e04a54a6720a0ba8e7a806cd98a2ebc8b2d17
Parents: 43e1ade
Author: Vincent Poon <[email protected]>
Authored: Tue Oct 16 16:13:11 2018 -0700
Committer: Vincent Poon <[email protected]>
Committed: Tue Oct 16 16:15:32 2018 -0700

----------------------------------------------------------------------
 .../phoenix/coprocessor/MetaDataEndpointImpl.java    | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/e07e04a5/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
index 8626adf..7c9a95f 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
@@ -3964,6 +3964,14 @@ public class MetaDataEndpointImpl extends 
MetaDataProtocol implements RegionCopr
                         return;
                     }
                 } else if (currentState == PIndexState.DISABLE) {
+                    // Index already disabled, so can't revert to 
PENDING_DISABLE
+                    if (newState == PIndexState.PENDING_DISABLE) {
+                        // returning TABLE_ALREADY_EXISTS here means the 
client doesn't throw an exception
+                        
builder.setReturnCode(MetaDataProtos.MutationCode.TABLE_ALREADY_EXISTS);
+                        
builder.setMutationTime(EnvironmentEdgeManager.currentTimeMillis());
+                        done.run(builder.build());
+                        return;
+                    }
                     // Can't transition back to INACTIVE if 
INDEX_DISABLE_TIMESTAMP is 0
                     if (newState != PIndexState.BUILDING && newState != 
PIndexState.DISABLE &&
                         (newState != PIndexState.INACTIVE || curTimeStampVal 
== 0)) {
@@ -3976,13 +3984,6 @@ public class MetaDataEndpointImpl extends 
MetaDataProtocol implements RegionCopr
                     if (newState == PIndexState.ACTIVE) {
                         newState = PIndexState.DISABLE;
                     }
-                    // Can't transition from DISABLE to PENDING_DISABLE
-                    if (newState == PIndexState.PENDING_DISABLE) {
-                        
builder.setReturnCode(MetaDataProtos.MutationCode.UNALLOWED_TABLE_MUTATION);
-                        
builder.setMutationTime(EnvironmentEdgeManager.currentTimeMillis());
-                        done.run(builder.build());
-                        return;
-                    }
                 }
                 if (newState == PIndexState.PENDING_DISABLE && currentState != 
PIndexState.PENDING_DISABLE) {
                     // reset count for first PENDING_DISABLE

Reply via email to