From 4fb945f47d69c046b4c9355876045470efe74452 Mon Sep 17 00:00:00 2001 From: Shubham Roy Date: Mon, 8 Jun 2026 14:42:16 +0530 Subject: [PATCH 1/5] PHOENIX-7873: scaffold phoenix-hbase-compat-2.6.6 module (copy of 2.6.4) Co-Authored-By: Claude Opus 4.8 --- phoenix-hbase-compat-2.6.6/pom.xml | 111 ++++++++++++++ .../phoenix/compat/hbase/ByteStringer.java | 32 ++++ .../compat/hbase/CompatDelegateFilter.java | 37 +++++ .../compat/hbase/CompatDelegateHTable.java | 141 ++++++++++++++++++ .../hbase/CompatIndexHalfStoreFileReader.java | 40 +++++ .../compat/hbase/CompatIndexedHLogReader.java | 24 +++ .../CompatLocalIndexStoreFileScanner.java | 33 ++++ .../hbase/CompatOmidTransactionTable.java | 51 +++++++ .../compat/hbase/CompatPagingFilter.java | 40 +++++ .../hbase/CompatPhoenixRpcScheduler.java | 56 +++++++ .../compat/hbase/CompatScanMetrics.java | 127 ++++++++++++++++ ...ompatThreadLocalServerSideScanMetrics.java | 46 ++++++ .../phoenix/compat/hbase/CompatUtil.java | 41 +++++ .../compat/hbase/HbaseCompatCapabilities.java | 23 +++ .../phoenix/compat/hbase/package-info.java | 23 +++ 15 files changed, 825 insertions(+) create mode 100644 phoenix-hbase-compat-2.6.6/pom.xml create mode 100644 phoenix-hbase-compat-2.6.6/src/main/java/org/apache/phoenix/compat/hbase/ByteStringer.java create mode 100644 phoenix-hbase-compat-2.6.6/src/main/java/org/apache/phoenix/compat/hbase/CompatDelegateFilter.java create mode 100644 phoenix-hbase-compat-2.6.6/src/main/java/org/apache/phoenix/compat/hbase/CompatDelegateHTable.java create mode 100644 phoenix-hbase-compat-2.6.6/src/main/java/org/apache/phoenix/compat/hbase/CompatIndexHalfStoreFileReader.java create mode 100644 phoenix-hbase-compat-2.6.6/src/main/java/org/apache/phoenix/compat/hbase/CompatIndexedHLogReader.java create mode 100644 phoenix-hbase-compat-2.6.6/src/main/java/org/apache/phoenix/compat/hbase/CompatLocalIndexStoreFileScanner.java create mode 100644 phoenix-hbase-compat-2.6.6/src/main/java/org/apache/phoenix/compat/hbase/CompatOmidTransactionTable.java create mode 100644 phoenix-hbase-compat-2.6.6/src/main/java/org/apache/phoenix/compat/hbase/CompatPagingFilter.java create mode 100644 phoenix-hbase-compat-2.6.6/src/main/java/org/apache/phoenix/compat/hbase/CompatPhoenixRpcScheduler.java create mode 100644 phoenix-hbase-compat-2.6.6/src/main/java/org/apache/phoenix/compat/hbase/CompatScanMetrics.java create mode 100644 phoenix-hbase-compat-2.6.6/src/main/java/org/apache/phoenix/compat/hbase/CompatThreadLocalServerSideScanMetrics.java create mode 100644 phoenix-hbase-compat-2.6.6/src/main/java/org/apache/phoenix/compat/hbase/CompatUtil.java create mode 100644 phoenix-hbase-compat-2.6.6/src/main/java/org/apache/phoenix/compat/hbase/HbaseCompatCapabilities.java create mode 100644 phoenix-hbase-compat-2.6.6/src/main/java/org/apache/phoenix/compat/hbase/package-info.java diff --git a/phoenix-hbase-compat-2.6.6/pom.xml b/phoenix-hbase-compat-2.6.6/pom.xml new file mode 100644 index 00000000000..9d62ccde8e8 --- /dev/null +++ b/phoenix-hbase-compat-2.6.6/pom.xml @@ -0,0 +1,111 @@ + + + + 4.0.0 + + org.apache.phoenix + phoenix + 5.4.0-SNAPSHOT + + + phoenix-hbase-compat-2.6.6 + Phoenix Hbase 2.6.6 compatibility + Compatibility module for HBase 2.6.6+ + + + + 2.6.6-SNAPSHOT + + + + + + org.apache.hbase + hbase-client + ${hbase26.compat.version} + provided + + + org.apache.hbase + hbase-common + ${hbase26.compat.version} + provided + + + org.apache.hbase + hbase-server + ${hbase26.compat.version} + provided + + + + org.apache.hbase + hbase-hadoop-compat + ${hbase26.compat.version} + provided + + + org.apache.hbase + hbase-hadoop2-compat + ${hbase26.compat.version} + provided + + + org.apache.hbase + hbase-protocol + ${hbase26.compat.version} + provided + + + org.apache.hbase + hbase-protocol-shaded + ${hbase26.compat.version} + provided + + + org.apache.hbase + hbase-zookeeper + ${hbase26.compat.version} + provided + + + org.apache.hbase + hbase-metrics + ${hbase26.compat.version} + provided + + + org.apache.hbase + hbase-metrics-api + ${hbase26.compat.version} + provided + + + org.slf4j + slf4j-api + provided + + + + junit + junit + test + + + + diff --git a/phoenix-hbase-compat-2.6.6/src/main/java/org/apache/phoenix/compat/hbase/ByteStringer.java b/phoenix-hbase-compat-2.6.6/src/main/java/org/apache/phoenix/compat/hbase/ByteStringer.java new file mode 100644 index 00000000000..e8c3f2fff89 --- /dev/null +++ b/phoenix-hbase-compat-2.6.6/src/main/java/org/apache/phoenix/compat/hbase/ByteStringer.java @@ -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); + } +} diff --git a/phoenix-hbase-compat-2.6.6/src/main/java/org/apache/phoenix/compat/hbase/CompatDelegateFilter.java b/phoenix-hbase-compat-2.6.6/src/main/java/org/apache/phoenix/compat/hbase/CompatDelegateFilter.java new file mode 100644 index 00000000000..c1fb96f4f00 --- /dev/null +++ b/phoenix-hbase-compat-2.6.6/src/main/java/org/apache/phoenix/compat/hbase/CompatDelegateFilter.java @@ -0,0 +1,37 @@ +/* + * 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); + } + +} diff --git a/phoenix-hbase-compat-2.6.6/src/main/java/org/apache/phoenix/compat/hbase/CompatDelegateHTable.java b/phoenix-hbase-compat-2.6.6/src/main/java/org/apache/phoenix/compat/hbase/CompatDelegateHTable.java new file mode 100644 index 00000000000..ed634aa0cd2 --- /dev/null +++ b/phoenix-hbase-compat-2.6.6/src/main/java/org/apache/phoenix/compat/hbase/CompatDelegateHTable.java @@ -0,0 +1,141 @@ +/* + * 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 java.util.List; +import org.apache.hadoop.hbase.CompareOperator; +import org.apache.hadoop.hbase.HTableDescriptor; +import org.apache.hadoop.hbase.client.Delete; +import org.apache.hadoop.hbase.client.Get; +import org.apache.hadoop.hbase.client.Put; +import org.apache.hadoop.hbase.client.RowMutations; +import org.apache.hadoop.hbase.client.Table; +import org.apache.hadoop.hbase.filter.CompareFilter.CompareOp; + +public abstract class CompatDelegateHTable implements Table { + + protected final Table delegate; + + public CompatDelegateHTable(Table delegate) { + this.delegate = delegate; + } + + @Override + public HTableDescriptor getTableDescriptor() throws IOException { + return delegate.getTableDescriptor(); + } + + @Override + public boolean checkAndPut(byte[] row, byte[] family, byte[] qualifier, CompareOp compareOp, + byte[] value, Put put) throws IOException { + return delegate.checkAndPut(row, family, qualifier, compareOp, value, put); + } + + @Override + public boolean checkAndDelete(byte[] row, byte[] family, byte[] qualifier, CompareOp compareOp, + byte[] value, Delete delete) throws IOException { + return delegate.checkAndDelete(row, family, qualifier, compareOp, value, delete); + } + + @Override + public boolean checkAndMutate(byte[] row, byte[] family, byte[] qualifier, CompareOp compareOp, + byte[] value, RowMutations mutation) throws IOException { + return delegate.checkAndMutate(row, family, qualifier, compareOp, value, mutation); + } + + @Override + public boolean checkAndPut(byte[] row, byte[] family, byte[] qualifier, byte[] value, Put put) + throws IOException { + return delegate.checkAndPut(row, family, qualifier, value, put); + } + + @Override + public boolean checkAndDelete(byte[] row, byte[] family, byte[] qualifier, byte[] value, + Delete delete) throws IOException { + return delegate.checkAndDelete(row, family, qualifier, value, delete); + } + + @Override + public boolean checkAndPut(byte[] row, byte[] family, byte[] qualifier, CompareOperator op, + byte[] value, Put put) throws IOException { + return delegate.checkAndPut(row, family, qualifier, op, value, put); + } + + @Override + public boolean checkAndDelete(byte[] row, byte[] family, byte[] qualifier, CompareOperator op, + byte[] value, Delete delete) throws IOException { + return delegate.checkAndDelete(row, family, qualifier, op, value, delete); + } + + @Override + public boolean checkAndMutate(byte[] row, byte[] family, byte[] qualifier, CompareOperator op, + byte[] value, RowMutations mutation) throws IOException { + return delegate.checkAndMutate(row, family, qualifier, op, value, mutation); + } + + @Override + public CheckAndMutateBuilder checkAndMutate(byte[] row, byte[] family) { + return delegate.checkAndMutate(row, family); + } + + @Override + public void setOperationTimeout(int operationTimeout) { + delegate.setOperationTimeout(operationTimeout); + } + + @Override + public int getOperationTimeout() { + return delegate.getOperationTimeout(); + } + + @Override + public int getRpcTimeout() { + return delegate.getRpcTimeout(); + } + + @Override + public void setRpcTimeout(int rpcTimeout) { + delegate.setRpcTimeout(rpcTimeout); + } + + @Override + public int getReadRpcTimeout() { + return delegate.getReadRpcTimeout(); + } + + @Override + public void setReadRpcTimeout(int readRpcTimeout) { + delegate.setReadRpcTimeout(readRpcTimeout); + } + + @Override + public int getWriteRpcTimeout() { + return delegate.getWriteRpcTimeout(); + } + + @Override + public void setWriteRpcTimeout(int writeRpcTimeout) { + delegate.setWriteRpcTimeout(writeRpcTimeout); + } + + @Override + public boolean[] existsAll(List gets) throws IOException { + return delegate.existsAll(gets); + } +} diff --git a/phoenix-hbase-compat-2.6.6/src/main/java/org/apache/phoenix/compat/hbase/CompatIndexHalfStoreFileReader.java b/phoenix-hbase-compat-2.6.6/src/main/java/org/apache/phoenix/compat/hbase/CompatIndexHalfStoreFileReader.java new file mode 100644 index 00000000000..293fafd146e --- /dev/null +++ b/phoenix-hbase-compat-2.6.6/src/main/java/org/apache/phoenix/compat/hbase/CompatIndexHalfStoreFileReader.java @@ -0,0 +1,40 @@ +/* + * 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.conf.Configuration; +import org.apache.hadoop.fs.FileSystem; +import org.apache.hadoop.fs.Path; +import org.apache.hadoop.hbase.io.Reference; +import org.apache.hadoop.hbase.io.hfile.CacheConfig; +import org.apache.hadoop.hbase.io.hfile.HFileInfo; +import org.apache.hadoop.hbase.io.hfile.ReaderContext; +import org.apache.hadoop.hbase.regionserver.StoreFileInfo; +import org.apache.hadoop.hbase.regionserver.StoreFileReader; + +public class CompatIndexHalfStoreFileReader extends StoreFileReader { + + public CompatIndexHalfStoreFileReader(final FileSystem fs, final CacheConfig cacheConf, + final Configuration conf, final ReaderContext readerContext, final HFileInfo hFileInfo, Path p, + Reference r) throws IOException { + super(readerContext, hFileInfo, cacheConf, new StoreFileInfo(conf, fs, fs.getFileStatus(p), r), + conf); + } + +} diff --git a/phoenix-hbase-compat-2.6.6/src/main/java/org/apache/phoenix/compat/hbase/CompatIndexedHLogReader.java b/phoenix-hbase-compat-2.6.6/src/main/java/org/apache/phoenix/compat/hbase/CompatIndexedHLogReader.java new file mode 100644 index 00000000000..c23b0be5d87 --- /dev/null +++ b/phoenix-hbase-compat-2.6.6/src/main/java/org/apache/phoenix/compat/hbase/CompatIndexedHLogReader.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; + +import org.apache.hadoop.hbase.regionserver.wal.ProtobufWALStreamReader; + +public abstract class CompatIndexedHLogReader extends ProtobufWALStreamReader { + +} diff --git a/phoenix-hbase-compat-2.6.6/src/main/java/org/apache/phoenix/compat/hbase/CompatLocalIndexStoreFileScanner.java b/phoenix-hbase-compat-2.6.6/src/main/java/org/apache/phoenix/compat/hbase/CompatLocalIndexStoreFileScanner.java new file mode 100644 index 00000000000..62e328a54f9 --- /dev/null +++ b/phoenix-hbase-compat-2.6.6/src/main/java/org/apache/phoenix/compat/hbase/CompatLocalIndexStoreFileScanner.java @@ -0,0 +1,33 @@ +/* + * 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.io.encoding.DataBlockEncoding; +import org.apache.hadoop.hbase.regionserver.StoreFileScanner; + +public class CompatLocalIndexStoreFileScanner extends StoreFileScanner { + + public CompatLocalIndexStoreFileScanner(CompatIndexHalfStoreFileReader reader, + boolean cacheBlocks, boolean pread, boolean isCompaction, long readPt, long scannerOrder, + boolean canOptimizeForNonNullColumn) { + super(reader, reader.getScanner(cacheBlocks, pread, isCompaction), !isCompaction, + reader.getHFileReader().hasMVCCInfo(), readPt, scannerOrder, canOptimizeForNonNullColumn, + reader.getHFileReader().getDataBlockEncoding() == DataBlockEncoding.ROW_INDEX_V1); + } + +} diff --git a/phoenix-hbase-compat-2.6.6/src/main/java/org/apache/phoenix/compat/hbase/CompatOmidTransactionTable.java b/phoenix-hbase-compat-2.6.6/src/main/java/org/apache/phoenix/compat/hbase/CompatOmidTransactionTable.java new file mode 100644 index 00000000000..03d12c84ed1 --- /dev/null +++ b/phoenix-hbase-compat-2.6.6/src/main/java/org/apache/phoenix/compat/hbase/CompatOmidTransactionTable.java @@ -0,0 +1,51 @@ +/* + * 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.Delete; +import org.apache.hadoop.hbase.client.Put; +import org.apache.hadoop.hbase.client.RowMutations; +import org.apache.hadoop.hbase.client.Table; +import org.apache.hadoop.hbase.filter.CompareFilter.CompareOp; + +public abstract class CompatOmidTransactionTable implements Table { + + @Override + public boolean checkAndPut(byte[] row, byte[] family, byte[] qualifier, CompareOp compareOp, + byte[] value, Put put) throws IOException { + throw new UnsupportedOperationException(); + } + + @Override + public boolean checkAndDelete(byte[] row, byte[] family, byte[] qualifier, CompareOp compareOp, + byte[] value, Delete delete) throws IOException { + throw new UnsupportedOperationException(); + } + + @Override + public boolean checkAndMutate(byte[] row, byte[] family, byte[] qualifier, CompareOp compareOp, + byte[] value, RowMutations mutation) throws IOException { + throw new UnsupportedOperationException(); + } + + @Override + public CheckAndMutateBuilder checkAndMutate(byte[] row, byte[] family) { + throw new UnsupportedOperationException(); + } +} diff --git a/phoenix-hbase-compat-2.6.6/src/main/java/org/apache/phoenix/compat/hbase/CompatPagingFilter.java b/phoenix-hbase-compat-2.6.6/src/main/java/org/apache/phoenix/compat/hbase/CompatPagingFilter.java new file mode 100644 index 00000000000..84108750fc1 --- /dev/null +++ b/phoenix-hbase-compat-2.6.6/src/main/java/org/apache/phoenix/compat/hbase/CompatPagingFilter.java @@ -0,0 +1,40 @@ +/* + * 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 abstract class CompatPagingFilter extends FilterBase { + protected Filter delegate = null; + + public CompatPagingFilter(Filter delegate) { + this.delegate = delegate; + } + + @Override + public ReturnCode filterKeyValue(Cell v) throws IOException { + + if (delegate != null) { + return delegate.filterKeyValue(v); + } + return super.filterKeyValue(v); + } +} diff --git a/phoenix-hbase-compat-2.6.6/src/main/java/org/apache/phoenix/compat/hbase/CompatPhoenixRpcScheduler.java b/phoenix-hbase-compat-2.6.6/src/main/java/org/apache/phoenix/compat/hbase/CompatPhoenixRpcScheduler.java new file mode 100644 index 00000000000..a59843351f2 --- /dev/null +++ b/phoenix-hbase-compat-2.6.6/src/main/java/org/apache/phoenix/compat/hbase/CompatPhoenixRpcScheduler.java @@ -0,0 +1,56 @@ +/* + * 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 int getActiveRpcHandlerCount() { + return delegate.getActiveRpcHandlerCount(); + } + + @Override + public int getActiveBulkLoadRpcHandlerCount() { + return delegate.getActiveBulkLoadRpcHandlerCount(); + } + + @Override + public int getBulkLoadQueueLength() { + return delegate.getBulkLoadQueueLength(); + } + + public abstract boolean compatDispatch(CallRunner task) throws IOException, InterruptedException; +} diff --git a/phoenix-hbase-compat-2.6.6/src/main/java/org/apache/phoenix/compat/hbase/CompatScanMetrics.java b/phoenix-hbase-compat-2.6.6/src/main/java/org/apache/phoenix/compat/hbase/CompatScanMetrics.java new file mode 100644 index 00000000000..f26a9a60b09 --- /dev/null +++ b/phoenix-hbase-compat-2.6.6/src/main/java/org/apache/phoenix/compat/hbase/CompatScanMetrics.java @@ -0,0 +1,127 @@ +/* + * 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.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.concurrent.atomic.AtomicLong; +import org.apache.hadoop.hbase.client.Scan; +import org.apache.hadoop.hbase.client.metrics.ScanMetrics; +import org.apache.hadoop.hbase.client.metrics.ScanMetricsRegionInfo; +import org.apache.hadoop.hbase.client.metrics.ServerSideScanMetrics; + +public class CompatScanMetrics { + + public static class RegionMetricsInfo { + private final String encodedRegionName; + private final String serverName; + private final Map metrics; + + public RegionMetricsInfo(String encodedRegionName, String serverName, + Map metrics) { + this.encodedRegionName = encodedRegionName; + this.serverName = serverName; + this.metrics = metrics; + } + + public String getEncodedRegionName() { + return encodedRegionName; + } + + public String getServerName() { + return serverName; + } + + public Map getMetrics() { + return metrics; + } + } + + public static final String FS_READ_TIME_METRIC_NAME = + ServerSideScanMetrics.FS_READ_TIME_METRIC_NAME; + public static final String BYTES_READ_FROM_FS_METRIC_NAME = + ServerSideScanMetrics.BYTES_READ_FROM_FS_METRIC_NAME; + public static final String BYTES_READ_FROM_MEMSTORE_METRIC_NAME = + ServerSideScanMetrics.BYTES_READ_FROM_MEMSTORE_METRIC_NAME; + public static final String BYTES_READ_FROM_BLOCK_CACHE_METRIC_NAME = + ServerSideScanMetrics.BYTES_READ_FROM_BLOCK_CACHE_METRIC_NAME; + public static final String BLOCK_READ_OPS_COUNT_METRIC_NAME = + ServerSideScanMetrics.BLOCK_READ_OPS_COUNT_METRIC_NAME; + public static final String RPC_SCAN_PROCESSING_TIME_METRIC_NAME = + ServerSideScanMetrics.RPC_SCAN_PROCESSING_TIME_METRIC_NAME; + public static final String RPC_SCAN_QUEUE_WAIT_TIME_METRIC_NAME = + ServerSideScanMetrics.RPC_SCAN_QUEUE_WAIT_TIME_METRIC_NAME; + + private CompatScanMetrics() { + // Not to be instantiated + } + + public static boolean supportsFineGrainedReadMetrics() { + return true; + } + + public static Long getFsReadTime(ScanMetrics scanMetrics) { + return getCounterValue(scanMetrics, ServerSideScanMetrics.FS_READ_TIME_METRIC_NAME); + } + + public static Long getBytesReadFromFs(ScanMetrics scanMetrics) { + return getCounterValue(scanMetrics, ServerSideScanMetrics.BYTES_READ_FROM_FS_METRIC_NAME); + } + + public static Long getBytesReadFromMemstore(ScanMetrics scanMetrics) { + return getCounterValue(scanMetrics, ServerSideScanMetrics.BYTES_READ_FROM_MEMSTORE_METRIC_NAME); + } + + public static Long getBytesReadFromBlockCache(ScanMetrics scanMetrics) { + return getCounterValue(scanMetrics, + ServerSideScanMetrics.BYTES_READ_FROM_BLOCK_CACHE_METRIC_NAME); + } + + public static Long getBlockReadOpsCount(ScanMetrics scanMetrics) { + return getCounterValue(scanMetrics, ServerSideScanMetrics.BLOCK_READ_OPS_COUNT_METRIC_NAME); + } + + private static Long getCounterValue(ScanMetrics scanMetrics, String metricName) { + AtomicLong counter = scanMetrics.getCounter(metricName); + return counter != null ? counter.get() : 0L; + } + + public static boolean supportsScanMetricsByRegion() { + return true; + } + + public static void enableScanMetricsByRegion(Scan scan, boolean enabled) { + scan.setEnableScanMetricsByRegion(enabled); + } + + public static List collectRegionMetrics(ScanMetrics scanMetrics) { + Map> byRegion = scanMetrics.collectMetricsByRegion(); + if (byRegion == null || byRegion.isEmpty()) { + return Collections.emptyList(); + } + List result = new ArrayList<>(); + for (Map.Entry> entry : byRegion.entrySet()) { + ScanMetricsRegionInfo regionInfo = entry.getKey(); + result.add(new RegionMetricsInfo(regionInfo.getEncodedRegionName(), + regionInfo.getServerName().toString(), entry.getValue())); + } + return result; + } +} diff --git a/phoenix-hbase-compat-2.6.6/src/main/java/org/apache/phoenix/compat/hbase/CompatThreadLocalServerSideScanMetrics.java b/phoenix-hbase-compat-2.6.6/src/main/java/org/apache/phoenix/compat/hbase/CompatThreadLocalServerSideScanMetrics.java new file mode 100644 index 00000000000..ab3b0a11e45 --- /dev/null +++ b/phoenix-hbase-compat-2.6.6/src/main/java/org/apache/phoenix/compat/hbase/CompatThreadLocalServerSideScanMetrics.java @@ -0,0 +1,46 @@ +/* + * 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.monitoring.ThreadLocalServerSideScanMetrics; + +public class CompatThreadLocalServerSideScanMetrics { + private CompatThreadLocalServerSideScanMetrics() { + // Not to be instantiated + } + + public static void addFsReadTime(long fsReadTimeInMs) { + ThreadLocalServerSideScanMetrics.addFsReadTime(fsReadTimeInMs); + } + + public static void addBytesReadFromFs(long bytesReadFromFS) { + ThreadLocalServerSideScanMetrics.addBytesReadFromFs(bytesReadFromFS); + } + + public static void addBytesReadFromMemstore(long bytesReadFromMemstore) { + ThreadLocalServerSideScanMetrics.addBytesReadFromMemstore(bytesReadFromMemstore); + } + + public static void addBytesReadFromBlockCache(long bytesReadFromBlockCache) { + ThreadLocalServerSideScanMetrics.addBytesReadFromBlockCache(bytesReadFromBlockCache); + } + + public static void addBlockReadOpsCount(long blockReadOpsCount) { + ThreadLocalServerSideScanMetrics.addBlockReadOpsCount(blockReadOpsCount); + } +} diff --git a/phoenix-hbase-compat-2.6.6/src/main/java/org/apache/phoenix/compat/hbase/CompatUtil.java b/phoenix-hbase-compat-2.6.6/src/main/java/org/apache/phoenix/compat/hbase/CompatUtil.java new file mode 100644 index 00000000000..38a940aa43e --- /dev/null +++ b/phoenix-hbase-compat-2.6.6/src/main/java/org/apache/phoenix/compat/hbase/CompatUtil.java @@ -0,0 +1,41 @@ +/* + * 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 java.util.List; +import org.apache.hadoop.hbase.MetaTableAccessor; +import org.apache.hadoop.hbase.client.Connection; +import org.apache.hadoop.hbase.client.RegionInfo; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class CompatUtil { + + private static final Logger LOGGER = LoggerFactory.getLogger(CompatUtil.class); + + private CompatUtil() { + // Not to be instantiated + } + + public static List getMergeRegions(Connection conn, RegionInfo regionInfo) + throws IOException { + return MetaTableAccessor.getMergeRegions(conn, regionInfo); + } + +} diff --git a/phoenix-hbase-compat-2.6.6/src/main/java/org/apache/phoenix/compat/hbase/HbaseCompatCapabilities.java b/phoenix-hbase-compat-2.6.6/src/main/java/org/apache/phoenix/compat/hbase/HbaseCompatCapabilities.java new file mode 100644 index 00000000000..ccd416a9143 --- /dev/null +++ b/phoenix-hbase-compat-2.6.6/src/main/java/org/apache/phoenix/compat/hbase/HbaseCompatCapabilities.java @@ -0,0 +1,23 @@ +/* + * 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.6.6/src/main/java/org/apache/phoenix/compat/hbase/package-info.java b/phoenix-hbase-compat-2.6.6/src/main/java/org/apache/phoenix/compat/hbase/package-info.java new file mode 100644 index 00000000000..7c098f49719 --- /dev/null +++ b/phoenix-hbase-compat-2.6.6/src/main/java/org/apache/phoenix/compat/hbase/package-info.java @@ -0,0 +1,23 @@ +/* + * 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. + */ + +/** + * This package contains compatibility classes for bridging differences + * between different versions of HBase. + */ +package org.apache.phoenix.compat.hbase; From a98d6f7bfe1f6e0ed689f804f75b68e6058cdc81 Mon Sep 17 00:00:00 2001 From: Shubham Roy Date: Mon, 8 Jun 2026 14:47:07 +0530 Subject: [PATCH 2/5] PHOENIX-7873: wire phoenix-hbase-compat-2.6.6 into build (profiles, depMgmt, enforcer, assembly) Co-Authored-By: Claude Opus 4.8 --- phoenix-assembly/pom.xml | 5 ++++ phoenix-core-client/pom.xml | 3 +++ pom.xml | 54 ++++++++++++++++++++++++++++++++++--- 3 files changed, 58 insertions(+), 4 deletions(-) diff --git a/phoenix-assembly/pom.xml b/phoenix-assembly/pom.xml index d9b97188a95..a336f260ad4 100644 --- a/phoenix-assembly/pom.xml +++ b/phoenix-assembly/pom.xml @@ -289,6 +289,11 @@ phoenix-hbase-compat-2.6.4 ${project.version} + + org.apache.phoenix + phoenix-hbase-compat-2.6.6 + ${project.version} + diff --git a/phoenix-core-client/pom.xml b/phoenix-core-client/pom.xml index 095b5dd5c74..3647073a183 100644 --- a/phoenix-core-client/pom.xml +++ b/phoenix-core-client/pom.xml @@ -299,6 +299,9 @@ || ("${hbase.compat.version}".equals("2.6.4") && hbaseMinor == 6 && hbasePatch >=4) + || ("${hbase.compat.version}".equals("2.6.6") + && hbaseMinor == 6 + && hbasePatch >=6) ) diff --git a/pom.xml b/pom.xml index c90d831def5..e9a68c1d198 100644 --- a/pom.xml +++ b/pom.xml @@ -45,6 +45,7 @@ + phoenix-hbase-compat-2.6.6 phoenix-hbase-compat-2.6.4 phoenix-hbase-compat-2.6.0 phoenix-hbase-compat-2.5.4 @@ -80,7 +81,9 @@ 2.5.14-hadoop3 2.6.1-hadoop3 2.6.3-hadoop3 - 2.6.5-hadoop3 + 2.6.5-hadoop3 + + 2.6.6-SNAPSHOT 1.8 ${compileSource} @@ -270,6 +273,11 @@ phoenix-client-embedded-hbase-2.6 ${project.version} + + org.apache.phoenix + phoenix-client-embedded-hbase-2.6.5 + ${project.version} + org.apache.phoenix phoenix-client-embedded-hbase-2.6.0 @@ -310,6 +318,11 @@ phoenix-client-lite-hbase-2.6 ${project.version} + + org.apache.phoenix + phoenix-client-lite-hbase-2.6.5 + ${project.version} + org.apache.phoenix phoenix-server-hbase-2.5.0 @@ -340,6 +353,11 @@ phoenix-server-hbase-2.6 ${project.version} + + org.apache.phoenix + phoenix-server-hbase-2.6.5 + ${project.version} + org.apache.phoenix phoenix-mapreduce-byo-shaded-hbase-hbase-2.5.0 @@ -365,6 +383,11 @@ phoenix-mapreduce-byo-shaded-hbase-hbase-2.6 ${project.version} + + org.apache.phoenix + phoenix-mapreduce-byo-shaded-hbase-hbase-2.6.5 + ${project.version} + org.apache.phoenix phoenix-mapreduce-byo-shaded-hbase-hbase-2.6.3 @@ -405,6 +428,11 @@ phoenix-hbase-compat-2.6.4 ${project.version} + + org.apache.phoenix + phoenix-hbase-compat-2.6.6 + ${project.version} + org.apache.phoenix @@ -2231,8 +2259,10 @@ - - phoenix-hbase-compat-2.6.4 + + phoenix-hbase-compat-2.6.6 hbase.profile @@ -2241,10 +2271,26 @@ 2.6 - 2.6.4 + 2.6.6 ${hbase-2.6.runtime.version} + + + phoenix-hbase-compat-2.6.5 + + + hbase.profile + 2.6.5 + + + + 2.6.5 + 2.6.4 + ${hbase-2.6.5.runtime.version} + + phoenix-hbase-compat-2.6.3 From 389cbf0e3a5119f2541c774b4efaf8e36905e9e1 Mon Sep 17 00:00:00 2001 From: Shubham Roy Date: Mon, 8 Jun 2026 14:59:51 +0530 Subject: [PATCH 3/5] PHOENIX-7873: forward getSkipHint/getHintForRejectedRow in 2.6.6 compat filters Co-Authored-By: Claude Opus 4.8 --- .../compat/hbase/CompatDelegateFilter.java | 10 +++ .../compat/hbase/CompatPagingFilter.java | 16 +++++ .../hbase/CompatDelegateFilterTest.java | 62 ++++++++++++++++ .../compat/hbase/CompatPagingFilterTest.java | 71 +++++++++++++++++++ 4 files changed, 159 insertions(+) create mode 100644 phoenix-hbase-compat-2.6.6/src/test/java/org/apache/phoenix/compat/hbase/CompatDelegateFilterTest.java create mode 100644 phoenix-hbase-compat-2.6.6/src/test/java/org/apache/phoenix/compat/hbase/CompatPagingFilterTest.java diff --git a/phoenix-hbase-compat-2.6.6/src/main/java/org/apache/phoenix/compat/hbase/CompatDelegateFilter.java b/phoenix-hbase-compat-2.6.6/src/main/java/org/apache/phoenix/compat/hbase/CompatDelegateFilter.java index c1fb96f4f00..f6afc54519c 100644 --- a/phoenix-hbase-compat-2.6.6/src/main/java/org/apache/phoenix/compat/hbase/CompatDelegateFilter.java +++ b/phoenix-hbase-compat-2.6.6/src/main/java/org/apache/phoenix/compat/hbase/CompatDelegateFilter.java @@ -34,4 +34,14 @@ 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); + } + } diff --git a/phoenix-hbase-compat-2.6.6/src/main/java/org/apache/phoenix/compat/hbase/CompatPagingFilter.java b/phoenix-hbase-compat-2.6.6/src/main/java/org/apache/phoenix/compat/hbase/CompatPagingFilter.java index 84108750fc1..441efd014e7 100644 --- a/phoenix-hbase-compat-2.6.6/src/main/java/org/apache/phoenix/compat/hbase/CompatPagingFilter.java +++ b/phoenix-hbase-compat-2.6.6/src/main/java/org/apache/phoenix/compat/hbase/CompatPagingFilter.java @@ -37,4 +37,20 @@ public ReturnCode filterKeyValue(Cell v) throws IOException { } return super.filterKeyValue(v); } + + @Override + public Cell getHintForRejectedRow(Cell firstRowCell) throws IOException { + if (delegate != null) { + return delegate.getHintForRejectedRow(firstRowCell); + } + return super.getHintForRejectedRow(firstRowCell); + } + + @Override + public Cell getSkipHint(Cell skippedCell) throws IOException { + if (delegate != null) { + return delegate.getSkipHint(skippedCell); + } + return super.getSkipHint(skippedCell); + } } diff --git a/phoenix-hbase-compat-2.6.6/src/test/java/org/apache/phoenix/compat/hbase/CompatDelegateFilterTest.java b/phoenix-hbase-compat-2.6.6/src/test/java/org/apache/phoenix/compat/hbase/CompatDelegateFilterTest.java new file mode 100644 index 00000000000..c78a4bf08f7 --- /dev/null +++ b/phoenix-hbase-compat-2.6.6/src/test/java/org/apache/phoenix/compat/hbase/CompatDelegateFilterTest.java @@ -0,0 +1,62 @@ +/* + * 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 static org.junit.Assert.assertSame; + +import java.io.IOException; +import org.apache.hadoop.hbase.Cell; +import org.apache.hadoop.hbase.KeyValue; +import org.apache.hadoop.hbase.filter.FilterBase; +import org.apache.hadoop.hbase.util.Bytes; +import org.junit.Test; + +public class CompatDelegateFilterTest { + + /** A delegate that returns distinct sentinel cells from each hint method. */ + private static class HintingDelegate extends FilterBase { + final Cell rejectedRowHint = new KeyValue(Bytes.toBytes("rejected"), Bytes.toBytes("f"), + Bytes.toBytes("q"), Bytes.toBytes("v")); + final Cell skipHint = new KeyValue(Bytes.toBytes("skip"), Bytes.toBytes("f"), + Bytes.toBytes("q"), Bytes.toBytes("v")); + + @Override + public Cell getHintForRejectedRow(Cell firstRowCell) throws IOException { + return rejectedRowHint; + } + + @Override + public Cell getSkipHint(Cell skippedCell) throws IOException { + return skipHint; + } + } + + @Test + public void forwardsGetHintForRejectedRowToDelegate() throws IOException { + HintingDelegate delegate = new HintingDelegate(); + CompatDelegateFilter filter = new CompatDelegateFilter(delegate); + assertSame(delegate.rejectedRowHint, filter.getHintForRejectedRow(null)); + } + + @Test + public void forwardsGetSkipHintToDelegate() throws IOException { + HintingDelegate delegate = new HintingDelegate(); + CompatDelegateFilter filter = new CompatDelegateFilter(delegate); + assertSame(delegate.skipHint, filter.getSkipHint(null)); + } +} diff --git a/phoenix-hbase-compat-2.6.6/src/test/java/org/apache/phoenix/compat/hbase/CompatPagingFilterTest.java b/phoenix-hbase-compat-2.6.6/src/test/java/org/apache/phoenix/compat/hbase/CompatPagingFilterTest.java new file mode 100644 index 00000000000..4c3b2b01771 --- /dev/null +++ b/phoenix-hbase-compat-2.6.6/src/test/java/org/apache/phoenix/compat/hbase/CompatPagingFilterTest.java @@ -0,0 +1,71 @@ +/* + * 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 static org.junit.Assert.assertNull; +import static org.junit.Assert.assertSame; + +import java.io.IOException; +import org.apache.hadoop.hbase.Cell; +import org.apache.hadoop.hbase.KeyValue; +import org.apache.hadoop.hbase.filter.Filter; +import org.apache.hadoop.hbase.filter.FilterBase; +import org.apache.hadoop.hbase.util.Bytes; +import org.junit.Test; + +public class CompatPagingFilterTest { + + /** Minimal concrete subclass so the abstract compat base can be instantiated. */ + private static class TestPagingFilter extends CompatPagingFilter { + TestPagingFilter(Filter delegate) { + super(delegate); + } + } + + private static class HintingDelegate extends FilterBase { + final Cell rejectedRowHint = new KeyValue(Bytes.toBytes("rejected"), Bytes.toBytes("f"), + Bytes.toBytes("q"), Bytes.toBytes("v")); + final Cell skipHint = new KeyValue(Bytes.toBytes("skip"), Bytes.toBytes("f"), + Bytes.toBytes("q"), Bytes.toBytes("v")); + + @Override + public Cell getHintForRejectedRow(Cell firstRowCell) throws IOException { + return rejectedRowHint; + } + + @Override + public Cell getSkipHint(Cell skippedCell) throws IOException { + return skipHint; + } + } + + @Test + public void forwardsToDelegateWhenPresent() throws IOException { + HintingDelegate delegate = new HintingDelegate(); + TestPagingFilter filter = new TestPagingFilter(delegate); + assertSame(delegate.rejectedRowHint, filter.getHintForRejectedRow(null)); + assertSame(delegate.skipHint, filter.getSkipHint(null)); + } + + @Test + public void returnsNullWhenDelegateAbsent() throws IOException { + TestPagingFilter filter = new TestPagingFilter(null); + assertNull(filter.getHintForRejectedRow(null)); + assertNull(filter.getSkipHint(null)); + } +} From 544760419691e900fa9f1b50866a274e8fef0743 Mon Sep 17 00:00:00 2001 From: Shubham Roy Date: Mon, 8 Jun 2026 15:13:48 +0530 Subject: [PATCH 4/5] PHOENIX-7873: re-parent DelegateFilter onto CompatDelegateFilter to inherit hint forwarding DelegateFilter now extends CompatDelegateFilter (removing its own shadowing delegate field) so that the version-gated getSkipHint / getHintForRejectedRow forwarding added in the 2.6.6 compat module is inherited by DelegateFilter and its subclasses (AllVersionsIndexRebuildFilter, UnverifiedRowFilter). A structural-only test (DelegateFilterStructureTest) is added in phoenix-core, alongside the existing filter tests; it asserts the inheritance wiring without referencing the new Filter methods, so it compiles under every hbase.profile. Co-Authored-By: Claude Opus 4.8 --- .../apache/phoenix/filter/DelegateFilter.java | 8 +-- .../filter/DelegateFilterStructureTest.java | 55 +++++++++++++++++++ 2 files changed, 58 insertions(+), 5 deletions(-) create mode 100644 phoenix-core/src/test/java/org/apache/phoenix/filter/DelegateFilterStructureTest.java diff --git a/phoenix-core-client/src/main/java/org/apache/phoenix/filter/DelegateFilter.java b/phoenix-core-client/src/main/java/org/apache/phoenix/filter/DelegateFilter.java index 01cdb6e3db1..e651c2c7017 100644 --- a/phoenix-core-client/src/main/java/org/apache/phoenix/filter/DelegateFilter.java +++ b/phoenix-core-client/src/main/java/org/apache/phoenix/filter/DelegateFilter.java @@ -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 diff --git a/phoenix-core/src/test/java/org/apache/phoenix/filter/DelegateFilterStructureTest.java b/phoenix-core/src/test/java/org/apache/phoenix/filter/DelegateFilterStructureTest.java new file mode 100644 index 00000000000..3e4ededa023 --- /dev/null +++ b/phoenix-core/src/test/java/org/apache/phoenix/filter/DelegateFilterStructureTest.java @@ -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); + } +} From 5aec99ae39628bd3e06b7508b1c0a40c3b69ac01 Mon Sep 17 00:00:00 2001 From: Shubham Roy Date: Mon, 8 Jun 2026 16:55:49 +0530 Subject: [PATCH 5/5] PHOENIX-7873: document the HBase 2.6.6 GA version-flip TODOs Expand the two TODO(PHOENIX-7873) markers into step-by-step instructions for the GA cutover (flip both 2.6.6-SNAPSHOT values to 2.6.6-hadoop3 in lockstep, remove the comments), and cross-reference each marker to the other so neither is missed. No functional change. Co-Authored-By: Claude Opus 4.8 --- phoenix-hbase-compat-2.6.6/pom.xml | 7 ++++++- pom.xml | 8 +++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/phoenix-hbase-compat-2.6.6/pom.xml b/phoenix-hbase-compat-2.6.6/pom.xml index 9d62ccde8e8..da73cbfc5db 100644 --- a/phoenix-hbase-compat-2.6.6/pom.xml +++ b/phoenix-hbase-compat-2.6.6/pom.xml @@ -28,7 +28,12 @@ Compatibility module for HBase 2.6.6+ - + 2.6.6-SNAPSHOT diff --git a/pom.xml b/pom.xml index e9a68c1d198..81f6d4d63da 100644 --- a/pom.xml +++ b/pom.xml @@ -82,7 +82,13 @@ 2.6.1-hadoop3 2.6.3-hadoop3 2.6.5-hadoop3 - + 2.6.6-SNAPSHOT 1.8