You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by ja...@apache.org on 2014/03/17 21:27:03 UTC

git commit: PHOENIX-863 Relax delete check for immutable secondary indexes

Repository: incubator-phoenix
Updated Branches:
  refs/heads/3.0 f2df71021 -> da0debbff


PHOENIX-863 Relax delete check for immutable secondary indexes


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

Branch: refs/heads/3.0
Commit: da0debbfffc09de668da7d76f2baf35c6ebbdd38
Parents: f2df710
Author: James Taylor <ja...@apache.org>
Authored: Mon Mar 17 13:26:07 2014 -0700
Committer: James Taylor <ja...@apache.org>
Committed: Mon Mar 17 13:26:07 2014 -0700

----------------------------------------------------------------------
 .../src/main/java/org/apache/phoenix/util/IndexUtil.java  | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/da0debbf/phoenix-core/src/main/java/org/apache/phoenix/util/IndexUtil.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/util/IndexUtil.java b/phoenix-core/src/main/java/org/apache/phoenix/util/IndexUtil.java
index b2d8286..17f0c87 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/util/IndexUtil.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/util/IndexUtil.java
@@ -184,11 +184,13 @@ public class IndexUtil {
                     };
                     indexMutations.add(maintainer.buildUpdateMutation(kvBuilder, valueGetter, ptr, ts));
                 } else {
-                    if (!maintainer.getIndexedColumns().isEmpty()) {
-                        throw new SQLExceptionInfo.Builder(SQLExceptionCode.NO_DELETE_IF_IMMUTABLE_INDEX).setSchemaName(table.getSchemaName().getString())
-                        .setTableName(table.getTableName().getString()).build().buildException();
+                    // We can only generate the correct Delete if we have no KV columns in our index.
+                    // Perhaps it'd be best to ignore Delete mutations all together here, as this
+                    // gets triggered typically for an initial population where Delete markers make
+                    // little sense.
+                    if (maintainer.getIndexedColumns().isEmpty()) {
+                        indexMutations.add(maintainer.buildDeleteMutation(kvBuilder, ptr, ts));
                     }
-                    indexMutations.add(maintainer.buildDeleteMutation(kvBuilder, ptr, ts));
                 }
             }
             return indexMutations;