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/5325a183 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/5325a183 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/5325a183 Branch: refs/heads/4.14-cdh5.12 Commit: 5325a18350b6f83f5691731aa6d7b625b59fb4ee Parents: 623566b Author: Vincent Poon <vincentp...@apache.org> Authored: Tue Oct 16 03:11:40 2018 +0100 Committer: pboado <pedro.bo...@gmail.com> Committed: Mon Dec 3 20:27:16 2018 +0000 ---------------------------------------------------------------------- .../org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java | 4 ++++ 1 file changed, 4 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/phoenix/blob/5325a183/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 ea72a01..68f8abf 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 @@ -3902,6 +3902,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