Additional comments for handling rollback for immutable indexes
Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/6f8f3943 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/6f8f3943 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/6f8f3943 Branch: refs/heads/txn Commit: 6f8f39436ef24249af632267ea46594537992f17 Parents: d71b820 Author: James Taylor <jtay...@salesforce.com> Authored: Thu May 21 00:33:34 2015 -0700 Committer: James Taylor <jtay...@salesforce.com> Committed: Thu May 21 00:33:34 2015 -0700 ---------------------------------------------------------------------- .../main/java/org/apache/phoenix/execute/MutationState.java | 8 ++++++++ 1 file changed, 8 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/phoenix/blob/6f8f3943/phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java b/phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java index 062798a..256e487 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java @@ -456,6 +456,11 @@ public class MutationState implements SQLCloseable { this.tableRef = tableRef; } + /** + * Called by Tephra when a transaction is aborted. We have this wrapper so that we get an + * opportunity to attach our index meta data to the mutations such that we can also undo + * the index mutations. + */ @Override public void delete(List<Delete> deletes) throws IOException { try { @@ -483,6 +488,9 @@ public class MutationState implements SQLCloseable { // If we have mutable indexes, local immutable indexes, or global immutable indexes // that reference key value columns, setup index meta data and attach here. In this // case updates to the indexes will be generated on the server side. + // An alternative would be to let Tephra track the row keys for the immutable index + // by adding it as a transaction participant (soon we can prevent any conflict + // detection from occurring) with the downside being the additional memory required. if (!keyValueIndexes.isEmpty()) { attachMetaData = true; IndexMaintainer.serializeAdditional(table, indexMetaDataPtr, keyValueIndexes, connection);