PHOENIX-4960 Write to table with global index failed if meta of index changed (split, move, etc)
Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/3d5bae8d Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/3d5bae8d Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/3d5bae8d Branch: refs/heads/omid2 Commit: 3d5bae8dcd79651fdd10333f88a2ab8ee37303bf Parents: 4a05f14 Author: Vincent Poon <vincentp...@apache.org> Authored: Mon Oct 15 19:11:40 2018 -0700 Committer: Vincent Poon <vincentp...@apache.org> Committed: Mon Oct 22 12:04:15 2018 -0700 ---------------------------------------------------------------------- .../org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java | 4 ++++ 1 file changed, 4 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/phoenix/blob/3d5bae8d/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 21370f3..aa78b1b 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 @@ -3987,6 +3987,10 @@ public class MetaDataEndpointImpl extends MetaDataProtocol implements Coprocesso newKVs.remove(disableTimeStampKVIndex); newKVs.set(indexStateKVIndex, KeyValueUtil.newKeyValue(key, TABLE_FAMILY_BYTES, INDEX_STATE_BYTES, timeStamp, Bytes.toBytes(newState.getSerializedValue()))); + } else if (disableTimeStampKVIndex == -1) { // clear disableTimestamp if client didn't pass it in + newKVs.add(KeyValueUtil.newKeyValue(key, TABLE_FAMILY_BYTES, + PhoenixDatabaseMetaData.INDEX_DISABLE_TIMESTAMP_BYTES, timeStamp, PLong.INSTANCE.toBytes(0))); + disableTimeStampKVIndex = newKVs.size() - 1; } } else if (newState == PIndexState.DISABLE) { //reset the counter for pending disable when transitioning from PENDING_DISABLE to DISABLE