Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions phoenix-assembly/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,11 @@
<artifactId>phoenix-hbase-compat-2.6.4</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.phoenix</groupId>
<artifactId>phoenix-hbase-compat-2.6.6</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
Expand Down
3 changes: 3 additions & 0 deletions phoenix-core-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,9 @@
|| ("${hbase.compat.version}".equals("2.6.4")
&amp;&amp; hbaseMinor == 6
&amp;&amp; hbasePatch &gt;=4)
|| ("${hbase.compat.version}".equals("2.6.6")
&amp;&amp; hbaseMinor == 6
&amp;&amp; hbasePatch &gt;=6)
)</condition>
</evaluateBeanshell>
</rules>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,12 @@
import java.util.List;
import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.filter.Filter;
import org.apache.hadoop.hbase.filter.FilterBase;
import org.apache.phoenix.compat.hbase.CompatDelegateFilter;

public class DelegateFilter extends FilterBase {

protected Filter delegate = null;
public class DelegateFilter extends CompatDelegateFilter {

public DelegateFilter(Filter delegate) {
this.delegate = delegate;
super(delegate);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.phoenix.filter;

import static org.junit.Assert.assertTrue;

import org.apache.hadoop.hbase.util.Bytes;
import org.apache.phoenix.compat.hbase.CompatDelegateFilter;
import org.junit.Test;

/**
* Locks in that Phoenix's delegating filters extend the compat base class, so that the
* version-gated getSkipHint / getHintForRejectedRow forwarding added in the 2.6.6 compat module is
* inherited. Intentionally structural only (no calls to the new Filter methods) so it compiles
* under every hbase.profile, including profiles whose HBase lacks those methods.
*/
public class DelegateFilterStructureTest {

@Test
public void delegateFilterExtendsCompatDelegateFilter() {
DelegateFilter f = new DelegateFilter(null);
assertTrue(f instanceof CompatDelegateFilter);
}

@Test
public void allVersionsIndexRebuildFilterInheritsCompatDelegateFilter() {
// AllVersionsIndexRebuildFilter(Filter originalFilter) — single-arg ctor.
AllVersionsIndexRebuildFilter f = new AllVersionsIndexRebuildFilter(null);
assertTrue(f instanceof CompatDelegateFilter);
}

@Test
public void unverifiedRowFilterInheritsCompatDelegateFilter() {
// UnverifiedRowFilter(Filter delegate, byte[] emptyCF, byte[] emptyCQ) — the ctor
// Preconditions-checks the two byte[] args are non-null, so pass real (empty) arrays.
// A null delegate is fine: it is only stored, not dereferenced, by the constructor.
UnverifiedRowFilter f = new UnverifiedRowFilter(null, Bytes.toBytes("cf"), Bytes.toBytes("cq"));
assertTrue(f instanceof CompatDelegateFilter);
}
}
116 changes: 116 additions & 0 deletions phoenix-hbase-compat-2.6.6/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.phoenix</groupId>
<artifactId>phoenix</artifactId>
<version>5.3.2-SNAPSHOT</version>
</parent>

<artifactId>phoenix-hbase-compat-2.6.6</artifactId>
<name>Phoenix Hbase 2.6.6 compatibility</name>
<description>Compatibility module for HBase 2.6.6+</description>

<properties>
<!--
TODO(PHOENIX-7873): HBase 2.6.6 is not yet GA on Maven Central. This compat module is
built against a locally-installed 2.6.6-SNAPSHOT until then. At GA: flip this value to
2.6.6-hadoop3 in lockstep with <hbase-2.6.runtime.version> in the root pom.xml, then
remove both TODO comments. Find them with: grep -rn 'TODO(PHOENIX-7873)'.
-->
<hbase26.compat.version>2.6.6-SNAPSHOT</hbase26.compat.version>
</properties>

<dependencies>
<!-- HBase dependencies -->
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-client</artifactId>
<version>${hbase26.compat.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-common</artifactId>
<version>${hbase26.compat.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-server</artifactId>
<version>${hbase26.compat.version}</version>
<scope>provided</scope>
</dependency>
<!-- Override parent dependencyManagement for transitive HBase dependencies -->
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-hadoop-compat</artifactId>
<version>${hbase26.compat.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-hadoop2-compat</artifactId>
<version>${hbase26.compat.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-protocol</artifactId>
<version>${hbase26.compat.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-protocol-shaded</artifactId>
<version>${hbase26.compat.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-zookeeper</artifactId>
<version>${hbase26.compat.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-metrics</artifactId>
<version>${hbase26.compat.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-metrics-api</artifactId>
<version>${hbase26.compat.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<scope>provided</scope>
</dependency>
<!-- Build with -Dwithout.tephra fails without this -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.phoenix.compat.hbase;

import com.google.protobuf.ByteString;

// This has different signature in the HBase 2 and 3 modules
// This only comes together after the maven-replacer plugin relocates all protobuf code.
public class ByteStringer {

private ByteStringer() {
}

public static ByteString wrap(final byte[] array) {
return org.apache.hadoop.hbase.util.ByteStringer.wrap(array);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.phoenix.compat.hbase;

import java.io.IOException;
import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.filter.Filter;
import org.apache.hadoop.hbase.filter.FilterBase;

public class CompatDelegateFilter extends FilterBase {
protected Filter delegate = null;

public CompatDelegateFilter(Filter delegate) {
this.delegate = delegate;
}

@Override
public ReturnCode filterKeyValue(Cell v) throws IOException {
return delegate.filterKeyValue(v);
}

@Override
public Cell getHintForRejectedRow(Cell firstRowCell) throws IOException {
return delegate.getHintForRejectedRow(firstRowCell);
}

@Override
public Cell getSkipHint(Cell skippedCell) throws IOException {
return delegate.getSkipHint(skippedCell);
}

}
Loading