You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by el...@apache.org on 2015/04/22 20:48:57 UTC
phoenix git commit: PHOENIX-900 Fix failing
PartialCommitIT.testDeleteFailure()
Repository: phoenix
Updated Branches:
refs/heads/4.x-HBase-0.98 080767878 -> 4d957ee3c
PHOENIX-900 Fix failing PartialCommitIT.testDeleteFailure()
Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/4d957ee3
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/4d957ee3
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/4d957ee3
Branch: refs/heads/4.x-HBase-0.98
Commit: 4d957ee3c742f76a2cd6358aaecc782ce640008c
Parents: 0807678
Author: Eli Levine <el...@apache.org>
Authored: Wed Apr 22 11:48:35 2015 -0700
Committer: Eli Levine <el...@apache.org>
Committed: Wed Apr 22 11:48:35 2015 -0700
----------------------------------------------------------------------
.../apache/phoenix/execute/PartialCommitIT.java | 25 ++++++++++++++++----
1 file changed, 20 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/phoenix/blob/4d957ee3/phoenix-core/src/it/java/org/apache/phoenix/execute/PartialCommitIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/execute/PartialCommitIT.java b/phoenix-core/src/it/java/org/apache/phoenix/execute/PartialCommitIT.java
index 550d7de..c8696e2 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/execute/PartialCommitIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/execute/PartialCommitIT.java
@@ -33,6 +33,7 @@ import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
+import java.io.IOException;
import java.sql.Connection;
import java.sql.Driver;
import java.sql.ResultSet;
@@ -47,6 +48,7 @@ import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.DoNotRetryIOException;
import org.apache.hadoop.hbase.HBaseIOException;
import org.apache.hadoop.hbase.HBaseTestingUtility;
+import org.apache.hadoop.hbase.client.Delete;
import org.apache.hadoop.hbase.client.Durability;
import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.coprocessor.ObserverContext;
@@ -268,7 +270,7 @@ public class PartialCommitIT {
@Override
public void prePut(ObserverContext<RegionCoprocessorEnvironment> c, Put put, WALEdit edit,
final Durability durability) throws HBaseIOException {
- if (shouldFailUpsert(c, put) || shouldFailDelete(c, put)) {
+ if (shouldFailUpsert(c, put)) {
// throwing anything other than instances of IOException result
// in this coprocessor being unloaded
// DoNotRetryIOException tells HBase not to retry this mutation
@@ -277,16 +279,29 @@ public class PartialCommitIT {
}
}
- private static boolean shouldFailUpsert(ObserverContext<RegionCoprocessorEnvironment> c, Put put) {
+ @Override
+ public void preDelete(ObserverContext<RegionCoprocessorEnvironment> c,
+ Delete delete, WALEdit edit, Durability durability) throws IOException {
+ if (shouldFailDelete(c, delete)) {
+ // throwing anything other than instances of IOException result
+ // in this coprocessor being unloaded
+ // DoNotRetryIOException tells HBase not to retry this mutation
+ // multiple times
+ throw new DoNotRetryIOException();
+ }
+ }
+
+ private boolean shouldFailUpsert(ObserverContext<RegionCoprocessorEnvironment> c, Put put) {
String tableName = c.getEnvironment().getRegion().getRegionInfo().getTable().getNameAsString();
return TABLE_NAME_TO_FAIL.equals(tableName) && Bytes.equals(ROW_TO_FAIL, put.getRow());
}
- private static boolean shouldFailDelete(ObserverContext<RegionCoprocessorEnvironment> c, Put put) {
+ private boolean shouldFailDelete(ObserverContext<RegionCoprocessorEnvironment> c, Delete delete) {
String tableName = c.getEnvironment().getRegion().getRegionInfo().getTable().getNameAsString();
return TABLE_NAME_TO_FAIL.equals(tableName) &&
- // Phoenix deletes are sent as Puts with empty values
- put.getFamilyCellMap().firstEntry().getValue().get(0).getValueLength() == 0;
+ // Phoenix deletes are sent as Mutations with empty values
+ delete.getFamilyCellMap().firstEntry().getValue().get(0).getValueLength() == 0 &&
+ delete.getFamilyCellMap().firstEntry().getValue().get(0).getQualifierLength() == 0;
}
}