This is an automated email from the ASF dual-hosted git repository. stoty pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/phoenix.git
The following commit(s) were added to refs/heads/master by this push: new fd485ab4f3 PHOENIX-7027 Add compatibility module for Hbase 2.5.4 and upgrade Hbase version to 2.5.5 fd485ab4f3 is described below commit fd485ab4f34826917d36aa9503485f3f78604138 Author: Istvan Toth <st...@apache.org> AuthorDate: Tue Sep 19 13:56:11 2023 +0200 PHOENIX-7027 Add compatibility module for Hbase 2.5.4 and upgrade Hbase version to 2.5.5 --- phoenix-assembly/pom.xml | 5 + phoenix-core/pom.xml | 3 + .../IndexHalfStoreFileReaderGenerator.java | 8 +- .../apache/phoenix/compat/hbase/CompatUtil.java | 7 +- .../apache/phoenix/compat/hbase/CompatUtil.java | 7 +- .../apache/phoenix/compat/hbase/CompatUtil.java | 7 +- phoenix-hbase-compat-2.5.4/pom.xml | 113 +++++++++++++++++++++ .../phoenix/compat/hbase/CompatDelegateHTable.java | 44 ++++++++ .../compat/hbase/CompatOmidTransactionTable.java | 38 +++++++ .../compat/hbase/CompatPhoenixRpcScheduler.java | 44 ++++++++ .../apache/phoenix/compat/hbase/CompatUtil.java | 7 +- .../compat/hbase/HbaseCompatCapabilities.java | 24 +++++ .../hbase/ReplicationSinkCompatEndpoint.java | 63 ++++++++++++ pom.xml | 42 +++++++- 14 files changed, 396 insertions(+), 16 deletions(-) diff --git a/phoenix-assembly/pom.xml b/phoenix-assembly/pom.xml index d9f3ac3b58..52d337618f 100644 --- a/phoenix-assembly/pom.xml +++ b/phoenix-assembly/pom.xml @@ -226,6 +226,11 @@ <artifactId>phoenix-hbase-compat-2.5.0</artifactId> <version>${project.version}</version> </dependency> + <dependency> + <groupId>org.apache.phoenix</groupId> + <artifactId>phoenix-hbase-compat-2.5.4</artifactId> + <version>${project.version}</version> + </dependency> </dependencies> </profile> </profiles> diff --git a/phoenix-core/pom.xml b/phoenix-core/pom.xml index 9e76f75967..a62501a0de 100644 --- a/phoenix-core/pom.xml +++ b/phoenix-core/pom.xml @@ -66,6 +66,9 @@ || ("${hbase.compat.version}".equals("2.5.0") && hbaseMinor == 5 && hbasePatch >=0) + || ("${hbase.compat.version}".equals("2.5.4") + && hbaseMinor == 5 + && hbasePatch >=4) ) </condition> </evaluateBeanshell> diff --git a/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexHalfStoreFileReaderGenerator.java b/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexHalfStoreFileReaderGenerator.java index 614c7e1001..536362e033 100644 --- a/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexHalfStoreFileReaderGenerator.java +++ b/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexHalfStoreFileReaderGenerator.java @@ -100,7 +100,9 @@ public class IndexHalfStoreFileReaderGenerator implements RegionObserver, Region .unwrap(PhoenixConnection.class)) { // This is the CQSI shared Connection. MUST NOT be closed. Connection hbaseConn = conn.getQueryServices().getAdmin().getConnection(); - Scan scan = CompatUtil.getScanForTableName(hbaseConn, tableName); + Scan scan = + MetaTableAccessor.getScanForTableName(hbaseConn.getConfiguration(), + tableName); SingleColumnValueFilter scvf = null; if (Reference.isTopFileRegion(r.getFileRegion())) { scvf = @@ -125,8 +127,8 @@ public class IndexHalfStoreFileReaderGenerator implements RegionObserver, Region } if (result == null || result.isEmpty()) { List<RegionInfo> mergeRegions = - MetaTableAccessor.getMergeRegions(ctx.getEnvironment().getConnection(), - region.getRegionInfo().getRegionName()); + CompatUtil.getMergeRegions(ctx.getEnvironment().getConnection(), + region.getRegionInfo()); if (mergeRegions == null || mergeRegions.isEmpty()) { return reader; } diff --git a/phoenix-hbase-compat-2.4.0/src/main/java/org/apache/phoenix/compat/hbase/CompatUtil.java b/phoenix-hbase-compat-2.4.0/src/main/java/org/apache/phoenix/compat/hbase/CompatUtil.java index ff0f69a0b5..678ae1c138 100644 --- a/phoenix-hbase-compat-2.4.0/src/main/java/org/apache/phoenix/compat/hbase/CompatUtil.java +++ b/phoenix-hbase-compat-2.4.0/src/main/java/org/apache/phoenix/compat/hbase/CompatUtil.java @@ -18,12 +18,14 @@ package org.apache.phoenix.compat.hbase; import java.io.IOException; +import java.util.List; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.CellComparator; import org.apache.hadoop.hbase.MetaTableAccessor; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.client.Connection; +import org.apache.hadoop.hbase.client.RegionInfo; import org.apache.hadoop.hbase.client.Scan; import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment; import org.apache.hadoop.hbase.io.compress.Compression.Algorithm; @@ -57,8 +59,9 @@ public class CompatUtil { .build(); } - public static Scan getScanForTableName(Connection conn, TableName tableName) { - return MetaTableAccessor.getScanForTableName(conn.getConfiguration(), tableName); + public static List<RegionInfo> getMergeRegions(Connection conn, RegionInfo regionInfo) + throws IOException { + return MetaTableAccessor.getMergeRegions(conn, regionInfo.getRegionName()); } public static ChecksumType getChecksumType(Configuration conf) { diff --git a/phoenix-hbase-compat-2.4.1/src/main/java/org/apache/phoenix/compat/hbase/CompatUtil.java b/phoenix-hbase-compat-2.4.1/src/main/java/org/apache/phoenix/compat/hbase/CompatUtil.java index e78738ccd8..e5084bf6f4 100644 --- a/phoenix-hbase-compat-2.4.1/src/main/java/org/apache/phoenix/compat/hbase/CompatUtil.java +++ b/phoenix-hbase-compat-2.4.1/src/main/java/org/apache/phoenix/compat/hbase/CompatUtil.java @@ -18,12 +18,14 @@ package org.apache.phoenix.compat.hbase; import java.io.IOException; +import java.util.List; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.CellComparator; import org.apache.hadoop.hbase.MetaTableAccessor; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.client.Connection; +import org.apache.hadoop.hbase.client.RegionInfo; import org.apache.hadoop.hbase.client.Scan; import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment; import org.apache.hadoop.hbase.io.compress.Compression.Algorithm; @@ -61,8 +63,9 @@ public class CompatUtil { .build(); } - public static Scan getScanForTableName(Connection conn, TableName tableName) { - return MetaTableAccessor.getScanForTableName(conn.getConfiguration(), tableName); + public static List<RegionInfo> getMergeRegions(Connection conn, RegionInfo regionInfo) + throws IOException { + return MetaTableAccessor.getMergeRegions(conn, regionInfo.getRegionName()); } public static ChecksumType getChecksumType(Configuration conf) { diff --git a/phoenix-hbase-compat-2.5.0/src/main/java/org/apache/phoenix/compat/hbase/CompatUtil.java b/phoenix-hbase-compat-2.5.0/src/main/java/org/apache/phoenix/compat/hbase/CompatUtil.java index aa48882404..f956d227c6 100644 --- a/phoenix-hbase-compat-2.5.0/src/main/java/org/apache/phoenix/compat/hbase/CompatUtil.java +++ b/phoenix-hbase-compat-2.5.0/src/main/java/org/apache/phoenix/compat/hbase/CompatUtil.java @@ -18,12 +18,14 @@ package org.apache.phoenix.compat.hbase; import java.io.IOException; +import java.util.List; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.CellComparator; import org.apache.hadoop.hbase.MetaTableAccessor; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.client.Connection; +import org.apache.hadoop.hbase.client.RegionInfo; import org.apache.hadoop.hbase.client.Scan; import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment; import org.apache.hadoop.hbase.io.compress.Compression.Algorithm; @@ -57,8 +59,9 @@ public class CompatUtil { .build(); } - public static Scan getScanForTableName(Connection conn, TableName tableName) { - return MetaTableAccessor.getScanForTableName(conn.getConfiguration(), tableName); + public static List<RegionInfo> getMergeRegions(Connection conn, RegionInfo regionInfo) + throws IOException { + return MetaTableAccessor.getMergeRegions(conn, regionInfo.getRegionName()); } public static ChecksumType getChecksumType(Configuration conf) { diff --git a/phoenix-hbase-compat-2.5.4/pom.xml b/phoenix-hbase-compat-2.5.4/pom.xml new file mode 100644 index 0000000000..3edaaf85ae --- /dev/null +++ b/phoenix-hbase-compat-2.5.4/pom.xml @@ -0,0 +1,113 @@ +<?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.2.0-SNAPSHOT</version> + </parent> + + <artifactId>phoenix-hbase-compat-2.5.4</artifactId> + <name>Phoenix Hbase 2.5.4 compatibility</name> + <description>Compatibility module for HBase 2.5.4+</description> + + <properties> + <hbase25.compat.version>2.5.4-hadoop3</hbase25.compat.version> + </properties> + + <dependencies> + <!-- HBase dependencies --> + <dependency> + <groupId>org.apache.hbase</groupId> + <artifactId>hbase-client</artifactId> + <version>${hbase25.compat.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.apache.hbase</groupId> + <artifactId>hbase-common</artifactId> + <version>${hbase25.compat.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.apache.hbase</groupId> + <artifactId>hbase-server</artifactId> + <version>${hbase25.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>${hbase25.compat.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.apache.hbase</groupId> + <artifactId>hbase-hadoop2-compat</artifactId> + <version>${hbase25.compat.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.apache.hbase</groupId> + <artifactId>hbase-protocol</artifactId> + <version>${hbase25.compat.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.apache.hbase</groupId> + <artifactId>hbase-protocol-shaded</artifactId> + <version>${hbase25.compat.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.apache.hbase</groupId> + <artifactId>hbase-zookeeper</artifactId> + <version>${hbase25.compat.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.apache.hbase</groupId> + <artifactId>hbase-metrics</artifactId> + <version>${hbase25.compat.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.apache.hbase</groupId> + <artifactId>hbase-metrics-api</artifactId> + <version>${hbase25.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> diff --git a/phoenix-hbase-compat-2.5.4/src/main/java/org/apache/phoenix/compat/hbase/CompatDelegateHTable.java b/phoenix-hbase-compat-2.5.4/src/main/java/org/apache/phoenix/compat/hbase/CompatDelegateHTable.java new file mode 100644 index 0000000000..a255732eff --- /dev/null +++ b/phoenix-hbase-compat-2.5.4/src/main/java/org/apache/phoenix/compat/hbase/CompatDelegateHTable.java @@ -0,0 +1,44 @@ +/* + * 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.client.RegionLocator; +import org.apache.hadoop.hbase.client.Result; +import org.apache.hadoop.hbase.client.RowMutations; +import org.apache.hadoop.hbase.client.Table; + +public abstract class CompatDelegateHTable implements Table { + + protected final Table delegate; + + public CompatDelegateHTable(Table delegate) { + this.delegate = delegate; + } + + @Override + public RegionLocator getRegionLocator() throws IOException { + return delegate.getRegionLocator(); + } + + @Override + public Result mutateRow(RowMutations rm) throws IOException { + return delegate.mutateRow(rm); + } +} diff --git a/phoenix-hbase-compat-2.5.4/src/main/java/org/apache/phoenix/compat/hbase/CompatOmidTransactionTable.java b/phoenix-hbase-compat-2.5.4/src/main/java/org/apache/phoenix/compat/hbase/CompatOmidTransactionTable.java new file mode 100644 index 0000000000..ae7992fb34 --- /dev/null +++ b/phoenix-hbase-compat-2.5.4/src/main/java/org/apache/phoenix/compat/hbase/CompatOmidTransactionTable.java @@ -0,0 +1,38 @@ +/* + * 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.client.RegionLocator; +import org.apache.hadoop.hbase.client.Result; +import org.apache.hadoop.hbase.client.RowMutations; +import org.apache.hadoop.hbase.client.Table; + +public abstract class CompatOmidTransactionTable implements Table { + + @Override + public RegionLocator getRegionLocator() throws IOException { + throw new UnsupportedOperationException(); + } + + @Override + public Result mutateRow(RowMutations rm) throws IOException { + throw new UnsupportedOperationException(); + } +} diff --git a/phoenix-hbase-compat-2.5.4/src/main/java/org/apache/phoenix/compat/hbase/CompatPhoenixRpcScheduler.java b/phoenix-hbase-compat-2.5.4/src/main/java/org/apache/phoenix/compat/hbase/CompatPhoenixRpcScheduler.java new file mode 100644 index 0000000000..cb47f8291b --- /dev/null +++ b/phoenix-hbase-compat-2.5.4/src/main/java/org/apache/phoenix/compat/hbase/CompatPhoenixRpcScheduler.java @@ -0,0 +1,44 @@ +/* + * 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.ipc.CallRunner; +import org.apache.hadoop.hbase.ipc.RpcScheduler; + +/** + * {@link RpcScheduler} that first checks to see if this is an index or metadata update before + * passing off the call to the delegate {@link RpcScheduler}. + */ +public abstract class CompatPhoenixRpcScheduler extends RpcScheduler { + protected RpcScheduler delegate; + + @Override + public boolean dispatch(CallRunner task) { + try { + return compatDispatch(task); + } catch (Exception e) { + //This never happens with Hbase 2.5 + throw new RuntimeException(e); + } + } + + public abstract boolean compatDispatch(CallRunner task) + throws IOException, InterruptedException; +} diff --git a/phoenix-hbase-compat-2.5.0/src/main/java/org/apache/phoenix/compat/hbase/CompatUtil.java b/phoenix-hbase-compat-2.5.4/src/main/java/org/apache/phoenix/compat/hbase/CompatUtil.java similarity index 91% copy from phoenix-hbase-compat-2.5.0/src/main/java/org/apache/phoenix/compat/hbase/CompatUtil.java copy to phoenix-hbase-compat-2.5.4/src/main/java/org/apache/phoenix/compat/hbase/CompatUtil.java index aa48882404..371154d560 100644 --- a/phoenix-hbase-compat-2.5.0/src/main/java/org/apache/phoenix/compat/hbase/CompatUtil.java +++ b/phoenix-hbase-compat-2.5.4/src/main/java/org/apache/phoenix/compat/hbase/CompatUtil.java @@ -18,12 +18,14 @@ package org.apache.phoenix.compat.hbase; import java.io.IOException; +import java.util.List; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.CellComparator; import org.apache.hadoop.hbase.MetaTableAccessor; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.client.Connection; +import org.apache.hadoop.hbase.client.RegionInfo; import org.apache.hadoop.hbase.client.Scan; import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment; import org.apache.hadoop.hbase.io.compress.Compression.Algorithm; @@ -57,8 +59,9 @@ public class CompatUtil { .build(); } - public static Scan getScanForTableName(Connection conn, TableName tableName) { - return MetaTableAccessor.getScanForTableName(conn.getConfiguration(), tableName); + public static List<RegionInfo> getMergeRegions(Connection conn, RegionInfo regionInfo) + throws IOException { + return MetaTableAccessor.getMergeRegions(conn, regionInfo); } public static ChecksumType getChecksumType(Configuration conf) { diff --git a/phoenix-hbase-compat-2.5.4/src/main/java/org/apache/phoenix/compat/hbase/HbaseCompatCapabilities.java b/phoenix-hbase-compat-2.5.4/src/main/java/org/apache/phoenix/compat/hbase/HbaseCompatCapabilities.java new file mode 100644 index 0000000000..9fc812c655 --- /dev/null +++ b/phoenix-hbase-compat-2.5.4/src/main/java/org/apache/phoenix/compat/hbase/HbaseCompatCapabilities.java @@ -0,0 +1,24 @@ +/* + * 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; + +public class HbaseCompatCapabilities { + // Currently every supported HBase version has the same capabilities, so there is + // nothing in here. +} diff --git a/phoenix-hbase-compat-2.5.4/src/main/java/org/apache/phoenix/compat/hbase/ReplicationSinkCompatEndpoint.java b/phoenix-hbase-compat-2.5.4/src/main/java/org/apache/phoenix/compat/hbase/ReplicationSinkCompatEndpoint.java new file mode 100644 index 0000000000..7415e666af --- /dev/null +++ b/phoenix-hbase-compat-2.5.4/src/main/java/org/apache/phoenix/compat/hbase/ReplicationSinkCompatEndpoint.java @@ -0,0 +1,63 @@ +/* + * 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 org.apache.hadoop.hbase.client.Mutation; +import org.apache.hadoop.hbase.coprocessor.ObserverContext; +import org.apache.hadoop.hbase.coprocessor.RegionServerCoprocessor; +import org.apache.hadoop.hbase.coprocessor.RegionServerCoprocessorEnvironment; +import org.apache.hadoop.hbase.coprocessor.RegionServerObserver; +import org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos; +import org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos; + +import java.io.IOException; +import java.util.List; +import java.util.Optional; + +/** + * Replication Sink compat endpoint that helps attach WAL attributes to + * mutation. In order to do so, this endpoint utilizes regionserver hook + * {@link #preReplicationSinkBatchMutate(ObserverContext, AdminProtos.WALEntry, Mutation)} + */ +public class ReplicationSinkCompatEndpoint + implements RegionServerCoprocessor, RegionServerObserver { + + @Override + public Optional<RegionServerObserver> getRegionServerObserver() { + return Optional.of(this); + } + + @Override + public void preReplicationSinkBatchMutate( + ObserverContext<RegionServerCoprocessorEnvironment> ctx, AdminProtos.WALEntry walEntry, + Mutation mutation) throws IOException { + RegionServerObserver.super.preReplicationSinkBatchMutate(ctx, walEntry, mutation); + List<WALProtos.Attribute> attributeList = walEntry.getKey().getExtendedAttributesList(); + attachWALExtendedAttributesToMutation(mutation, attributeList); + } + + private void attachWALExtendedAttributesToMutation(Mutation mutation, + List<WALProtos.Attribute> attributeList) { + if (attributeList != null) { + for (WALProtos.Attribute attribute : attributeList) { + mutation.setAttribute(attribute.getKey(), attribute.getValue().toByteArray()); + } + } + } +} diff --git a/pom.xml b/pom.xml index 21c134179a..9a63d6075e 100644 --- a/pom.xml +++ b/pom.xml @@ -40,6 +40,7 @@ </organization> <modules> + <module>phoenix-hbase-compat-2.5.4</module> <module>phoenix-hbase-compat-2.5.0</module> <module>phoenix-hbase-compat-2.4.1</module> <module>phoenix-hbase-compat-2.4.0</module> @@ -79,11 +80,12 @@ <hbase.suffix>hbase-${hbase.profile}</hbase.suffix> <!-- This is used by the release script only --> - <hbase.profile.list>2.4.0 2.4 2.5</hbase.profile.list> + <hbase.profile.list>2.4.0 2.4 2.5.0 2.5</hbase.profile.list> <!-- The default hbase versions to build with (override with hbase.version) --> <hbase-2.4.0.runtime.version>2.4.0</hbase-2.4.0.runtime.version> <hbase-2.4.runtime.version>2.4.16</hbase-2.4.runtime.version> - <hbase-2.5.runtime.version>2.5.3-hadoop3</hbase-2.5.runtime.version> + <hbase-2.5.0.runtime.version>2.5.3-hadoop3</hbase-2.5.0.runtime.version> + <hbase-2.5.runtime.version>2.5.5-hadoop3</hbase-2.5.runtime.version> <compileSource>1.8</compileSource> <maven.compiler.source>${compileSource}</maven.compiler.source> @@ -686,6 +688,11 @@ <artifactId>phoenix-client-embedded-hbase-2.4</artifactId> <version>${project.version}</version> </dependency> + <dependency> + <groupId>org.apache.phoenix</groupId> + <artifactId>phoenix-client-embedded-hbase-2.5.0</artifactId> + <version>${project.version}</version> + </dependency> <dependency> <groupId>org.apache.phoenix</groupId> <artifactId>phoenix-client-embedded-hbase-2.5</artifactId> @@ -701,6 +708,11 @@ <artifactId>phoenix-server-hbase-2.4</artifactId> <version>${project.version}</version> </dependency> + <dependency> + <groupId>org.apache.phoenix</groupId> + <artifactId>phoenix-server-hbase-2.5.0</artifactId> + <version>${project.version}</version> + </dependency> <dependency> <groupId>org.apache.phoenix</groupId> <artifactId>phoenix-server-hbase-2.5</artifactId> @@ -736,6 +748,11 @@ <artifactId>phoenix-hbase-compat-2.5.0</artifactId> <version>${project.version}</version> </dependency> + <dependency> + <groupId>org.apache.phoenix</groupId> + <artifactId>phoenix-hbase-compat-2.5.4</artifactId> + <version>${project.version}</version> + </dependency> <!-- Intra-project test dependencies --> <dependency> <groupId>org.apache.phoenix</groupId> @@ -1640,7 +1657,7 @@ </profile> <profile> <!-- This WILL work with the public -hadoop3 artifacts --> - <id>phoenix-hbase-compat-2.5.0</id> + <id>phoenix-hbase-compat-2.5.4</id> <activation> <property> <name>hbase.profile</name> @@ -1649,10 +1666,25 @@ </activation> <properties> <hbase.profile>2.5</hbase.profile> - <hbase.compat.version>2.5.0</hbase.compat.version> + <hbase.compat.version>2.5.4</hbase.compat.version> <hadoop.version>3.2.3</hadoop.version> <hbase.version>${hbase-2.5.runtime.version}</hbase.version> - <tephra.hbase.compat.version>2.4</tephra.hbase.compat.version> + </properties> + </profile> + <profile> + <!-- This WILL work with the public -hadoop3 artifacts --> + <id>phoenix-hbase-compat-2.5.0</id> + <activation> + <property> + <name>hbase.profile</name> + <value>2.5.0</value> + </property> + </activation> + <properties> + <hbase.profile>2.5.0</hbase.profile> + <hbase.compat.version>2.5.0</hbase.compat.version> + <hadoop.version>3.2.3</hadoop.version> + <hbase.version>${hbase-2.5.0.runtime.version}</hbase.version> </properties> </profile> <profile>