Skip to content

Commit

Permalink
test: 2.x mirroring integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
prawilny committed Nov 10, 2021
1 parent 74dce04 commit 1dac7e4
Show file tree
Hide file tree
Showing 18 changed files with 2,615 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ private static void fillDefaults(Configuration configuration) {
"hbase.client.connection.impl",
"com.google.cloud.bigtable.mirroring.hbase1_x.MirroringConnection");

configuration.setIfUnset(
"hbase.client.async.connection.impl",
"com.google.cloud.bigtable.mirroring.hbase2_x.MirroringAsyncConnection");

configuration.setIfUnset(
"google.bigtable.mirroring.mismatch-detector.impl",
TestMismatchDetector.class.getCanonicalName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,18 @@ public MirroringConnection createConnection(ExecutorService executorService) thr

public MirroringConnection createConnection(
ExecutorService executorService, Configuration configuration) throws IOException {
if (baseMiniCluster != null) {
baseMiniCluster.updateConfigurationWithHbaseMiniClusterProps(configuration);
}
updateConfigurationWithHbaseMiniClusterProps(configuration);

Connection conn = ConnectionFactory.createConnection(configuration, executorService);
return (MirroringConnection) conn;
}

public void updateConfigurationWithHbaseMiniClusterProps(Configuration configuration) {
if (baseMiniCluster != null) {
baseMiniCluster.updateConfigurationWithHbaseMiniClusterProps(configuration);
}
}

@Override
protected void after() {
if (baseMiniCluster != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ limitations under the License.
<dependency>
<groupId>com.google.cloud.bigtable</groupId>
<artifactId>bigtable-hbase-mirroring-client-1.x-integration-tests</artifactId>
<version>2.0.0-alpha2-SNAPSHOT</version>
<version>2.0.0-alpha2-SNAPSHOT</version> <!-- {x-version-update:bigtable-client-parent:current} -->
<scope>test</scope>
<type>test-jar</type>
</dependency>
Expand All @@ -328,7 +328,6 @@ limitations under the License.
<scope>test</scope>
</dependency>


<!-- Version of slf4j copied from HBase 2.4.5 pom.xml -->
<!-- Pinned to prevent Enforcer errors -->
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hbase.CompareOperator;
import org.apache.hadoop.hbase.HRegionInfo;
import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.client.Append;
Expand All @@ -35,6 +36,8 @@
import org.apache.hadoop.hbase.client.RowMutations;
import org.apache.hadoop.hbase.client.Scan;
import org.apache.hadoop.hbase.client.TableDescriptor;
import org.apache.hadoop.hbase.filter.ByteArrayComparable;
import org.apache.hadoop.hbase.io.TimeRange;
import org.apache.hadoop.hbase.wal.WAL;

/**
Expand Down Expand Up @@ -120,4 +123,32 @@ public Result append(Append mutation, long nonceGroup, long nonce) throws IOExce
processRowThrow(mutation.getRow());
return super.append(mutation, nonceGroup, nonce);
}

@Override
public boolean checkAndMutate(
byte[] row,
byte[] family,
byte[] qualifier,
CompareOperator op,
ByteArrayComparable comparator,
TimeRange timeRange,
Mutation mutation)
throws IOException {
processRowThrow(row);
return super.checkAndMutate(row, family, qualifier, op, comparator, timeRange, mutation);
}

@Override
public boolean checkAndRowMutate(
byte[] row,
byte[] family,
byte[] qualifier,
CompareOperator op,
ByteArrayComparable comparator,
TimeRange timeRange,
RowMutations rm)
throws IOException {
processRowThrow(row);
return super.checkAndRowMutate(row, family, qualifier, op, comparator, timeRange, rm);
}
}
Loading

0 comments on commit 1dac7e4

Please sign in to comment.