You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by pb...@apache.org on 2018/10/17 19:32:24 UTC
[25/32] phoenix git commit: PHOENIX-4963 Do not throw when
transitioning to PENDING_DISABLE if index is already disabled
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/4acd3b1a
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/4acd3b1a
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/4acd3b1a
Branch: refs/heads/4.14-cdh5.12
Commit: 4acd3b1ad01992226fc3a126bda54b4ff34b7173
Parents: a1ba9fb
Author: Vincent Poon <vi...@apache.org>
Authored: Wed Oct 17 00:13:11 2018 +0100
Committer: Pedro Boado <pb...@apache.org>
Committed: Wed Oct 17 20:31:32 2018 +0100
----------------------------------------------------------------------
.../phoenix/coprocessor/MetaDataEndpointImpl.java | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/phoenix/blob/4acd3b1a/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 db1f7c3..ea72a01 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
@@ -3864,6 +3864,14 @@ public class MetaDataEndpointImpl extends MetaDataProtocol implements Coprocesso
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)) {
@@ -3876,13 +3884,6 @@ public class MetaDataEndpointImpl extends MetaDataProtocol implements Coprocesso
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