You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by ma...@apache.org on 2016/02/02 05:00:15 UTC
[41/50] [abbrv] phoenix git commit: PHOENIX-2630 Ensure commit fails
if mutable secondary index write fails
PHOENIX-2630 Ensure commit fails if mutable secondary index write fails
Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/c9594e83
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/c9594e83
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/c9594e83
Branch: refs/heads/calcite
Commit: c9594e83e144ebc3830922401de2addb3df0c81d
Parents: dceaaeb
Author: James Taylor <jt...@salesforce.com>
Authored: Wed Jan 27 14:28:34 2016 -0800
Committer: James Taylor <jt...@salesforce.com>
Committed: Thu Jan 28 10:15:01 2016 -0800
----------------------------------------------------------------------
.../apache/phoenix/end2end/index/MutableIndexFailureIT.java | 6 +++++-
.../hbase/index/write/KillServerOnFailurePolicy.java | 5 ++---
.../org/apache/phoenix/index/PhoenixIndexFailurePolicy.java | 9 +++++++--
3 files changed, 14 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/phoenix/blob/c9594e83/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexFailureIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexFailureIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexFailureIT.java
index b34a70e..5f39515 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexFailureIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexFailureIT.java
@@ -193,7 +193,11 @@ public class MutableIndexFailureIT extends BaseOwnClusterHBaseManagedTimeIT {
}
}
else {
- conn.commit();
+ try {
+ conn.commit();
+ fail();
+ } catch (SQLException e) {
+ }
}
// Verify the metadata for index is correct.
http://git-wip-us.apache.org/repos/asf/phoenix/blob/c9594e83/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/KillServerOnFailurePolicy.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/KillServerOnFailurePolicy.java b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/KillServerOnFailurePolicy.java
index 2fb43b5..cba2459 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/KillServerOnFailurePolicy.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/KillServerOnFailurePolicy.java
@@ -25,11 +25,10 @@ import org.apache.hadoop.hbase.Abortable;
import org.apache.hadoop.hbase.Stoppable;
import org.apache.hadoop.hbase.client.Mutation;
import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
+import org.apache.phoenix.hbase.index.table.HTableInterfaceReference;
import com.google.common.collect.Multimap;
-import org.apache.phoenix.hbase.index.table.HTableInterfaceReference;
-
/**
* Naive failure policy - kills the server on which it resides
*/
@@ -61,7 +60,7 @@ public class KillServerOnFailurePolicy implements IndexFailurePolicy {
@Override
public void
- handleFailure(Multimap<HTableInterfaceReference, Mutation> attempted, Exception cause){
+ handleFailure(Multimap<HTableInterfaceReference, Mutation> attempted, Exception cause) throws IOException{
// cleanup resources
this.stop("Killing ourselves because of an error:" + cause);
// notify the regionserver of the failure
http://git-wip-us.apache.org/repos/asf/phoenix/blob/c9594e83/phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixIndexFailurePolicy.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixIndexFailurePolicy.java b/phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixIndexFailurePolicy.java
index 806a20a..09a8676 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixIndexFailurePolicy.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixIndexFailurePolicy.java
@@ -61,6 +61,7 @@ import org.apache.phoenix.util.MetaDataUtil;
import org.apache.phoenix.util.PhoenixRuntime;
import org.apache.phoenix.util.QueryUtil;
import org.apache.phoenix.util.SchemaUtil;
+import org.apache.phoenix.util.ServerUtil;
import com.google.common.collect.Multimap;
@@ -99,13 +100,17 @@ public class PhoenixIndexFailurePolicy extends KillServerOnFailurePolicy {
* @param cause root cause of the failure
*/
@Override
- public void handleFailure(Multimap<HTableInterfaceReference, Mutation> attempted, Exception cause) {
-
+ public void handleFailure(Multimap<HTableInterfaceReference, Mutation> attempted, Exception cause) throws IOException {
+ boolean throwing = true;
try {
handleFailureWithExceptions(attempted, cause);
+ throwing = false;
} catch (Throwable t) {
LOG.warn("handleFailure failed", t);
super.handleFailure(attempted, cause);
+ throwing = false;
+ } finally {
+ if (!throwing) throw ServerUtil.createIOException(null, cause);
}
}