You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by st...@apache.org on 2023/09/20 12:22:59 UTC
[phoenix] branch 5.1 updated: PHOENIX-7027 Add compatibility module for Hbase 2.5.4 and upgrade Hbase version to 2.5.5
This is an automated email from the ASF dual-hosted git repository.
stoty pushed a commit to branch 5.1
in repository https://gitbox.apache.org/repos/asf/phoenix.git
The following commit(s) were added to refs/heads/5.1 by this push:
new f2171e50ca PHOENIX-7027 Add compatibility module for Hbase 2.5.4 and upgrade Hbase version to 2.5.5
f2171e50ca is described below
commit f2171e50cab8027589d2f821f54b6c540f17e139
Author: Istvan Toth <st...@apache.org>
AuthorDate: Wed Sep 20 13:51:06 2023 +0200
PHOENIX-7027 Add compatibility module for Hbase 2.5.4 and upgrade Hbase version to 2.5.5
---
phoenix-core/pom.xml | 3 +
.../IndexHalfStoreFileReaderGenerator.java | 4 +-
.../apache/phoenix/compat/hbase/CompatUtil.java | 7 +
.../apache/phoenix/compat/hbase/CompatUtil.java | 7 +
.../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.0/pom.xml | 2 +-
.../apache/phoenix/compat/hbase/CompatUtil.java | 7 +
.../pom.xml | 8 +-
.../phoenix/compat/hbase/CompatDelegateHTable.java | 44 +++++
.../compat/hbase/CompatOmidTransactionTable.java | 38 ++++
.../phoenix/compat/hbase/CompatPermissionUtil.java | 59 ++++++
.../compat/hbase/CompatPhoenixRpcScheduler.java | 69 ++++++++
.../compat/hbase/CompatSteppingSplitPolicy.java | 24 +++
.../compat/hbase/CompatStoreFileReader.java | 48 +++++
.../apache/phoenix/compat/hbase/CompatUtil.java | 7 +
.../compat/hbase/HbaseCompatCapabilities.java | 39 ++++
.../apache/phoenix/compat/hbase/OffsetCell.java | 136 ++++++++++++++
.../CompatBaseScannerRegionObserver.java | 197 +++++++++++++++++++++
.../coprocessor/CompatIndexRegionObserver.java | 40 +++++
.../phoenix/compat/hbase/test/DelegateCell.java | 139 +++++++++++++++
pom.xml | 46 ++++-
23 files changed, 935 insertions(+), 10 deletions(-)
diff --git a/phoenix-core/pom.xml b/phoenix-core/pom.xml
index 7f753c94d3..c199f57025 100644
--- a/phoenix-core/pom.xml
+++ b/phoenix-core/pom.xml
@@ -75,6 +75,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..e503b9e0d9 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
@@ -125,8 +125,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.1.6/src/main/java/org/apache/phoenix/compat/hbase/CompatUtil.java b/phoenix-hbase-compat-2.1.6/src/main/java/org/apache/phoenix/compat/hbase/CompatUtil.java
index 6977af5b0a..e358959806 100644
--- a/phoenix-hbase-compat-2.1.6/src/main/java/org/apache/phoenix/compat/hbase/CompatUtil.java
+++ b/phoenix-hbase-compat-2.1.6/src/main/java/org/apache/phoenix/compat/hbase/CompatUtil.java
@@ -24,6 +24,7 @@ import org.apache.hadoop.hbase.MetaTableAccessor;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.Admin;
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.exceptions.DeserializationException;
@@ -36,6 +37,7 @@ import org.apache.hadoop.hbase.util.ChecksumType;
import org.apache.hbase.thirdparty.com.google.common.collect.ListMultimap;
import java.io.IOException;
+import java.util.List;
public class CompatUtil {
@@ -91,4 +93,9 @@ public class CompatUtil {
//Short Circuit connections are broken before 2.4.12
return org.apache.hadoop.hbase.client.ConnectionFactory.createConnection(configuration);
}
+
+ public static List<RegionInfo> getMergeRegions(Connection conn, RegionInfo regionInfo)
+ throws IOException {
+ return MetaTableAccessor.getMergeRegions(conn, regionInfo.getRegionName());
+ }
}
diff --git a/phoenix-hbase-compat-2.2.5/src/main/java/org/apache/phoenix/compat/hbase/CompatUtil.java b/phoenix-hbase-compat-2.2.5/src/main/java/org/apache/phoenix/compat/hbase/CompatUtil.java
index 59a87ece90..9a33c7dafa 100644
--- a/phoenix-hbase-compat-2.2.5/src/main/java/org/apache/phoenix/compat/hbase/CompatUtil.java
+++ b/phoenix-hbase-compat-2.2.5/src/main/java/org/apache/phoenix/compat/hbase/CompatUtil.java
@@ -24,6 +24,7 @@ import org.apache.hadoop.hbase.MetaTableAccessor;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.Admin;
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.exceptions.DeserializationException;
@@ -36,6 +37,7 @@ import org.apache.hadoop.hbase.util.ChecksumType;
import org.apache.hbase.thirdparty.com.google.common.collect.ListMultimap;
import java.io.IOException;
+import java.util.List;
public class CompatUtil {
@@ -91,4 +93,9 @@ public class CompatUtil {
//Short Circuit connections are broken before 2.4.12
return org.apache.hadoop.hbase.client.ConnectionFactory.createConnection(configuration);
}
+
+ public static List<RegionInfo> getMergeRegions(Connection conn, RegionInfo regionInfo)
+ throws IOException {
+ return MetaTableAccessor.getMergeRegions(conn, regionInfo.getRegionName());
+ }
}
diff --git a/phoenix-hbase-compat-2.3.0/src/main/java/org/apache/phoenix/compat/hbase/CompatUtil.java b/phoenix-hbase-compat-2.3.0/src/main/java/org/apache/phoenix/compat/hbase/CompatUtil.java
index 2fbeebba08..3c77cff8d6 100644
--- a/phoenix-hbase-compat-2.3.0/src/main/java/org/apache/phoenix/compat/hbase/CompatUtil.java
+++ b/phoenix-hbase-compat-2.3.0/src/main/java/org/apache/phoenix/compat/hbase/CompatUtil.java
@@ -27,6 +27,7 @@ import org.apache.hadoop.hbase.ServerName;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.Admin;
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.exceptions.DeserializationException;
@@ -44,6 +45,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
+import java.util.List;
public class CompatUtil {
@@ -151,4 +153,9 @@ public class CompatUtil {
//Short Circuit connections are broken before 2.4.12
return org.apache.hadoop.hbase.client.ConnectionFactory.createConnection(configuration);
}
+
+ public static List<RegionInfo> getMergeRegions(Connection conn, RegionInfo regionInfo)
+ throws IOException {
+ return MetaTableAccessor.getMergeRegions(conn, regionInfo.getRegionName());
+ }
}
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 e9c51d2639..c1a0de178c 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
@@ -27,6 +27,7 @@ import org.apache.hadoop.hbase.ServerName;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.Admin;
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.exceptions.DeserializationException;
@@ -44,6 +45,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
+import java.util.List;
public class CompatUtil {
@@ -152,4 +154,9 @@ public class CompatUtil {
//Short Circuit connections are broken before 2.4.12
return org.apache.hadoop.hbase.client.ConnectionFactory.createConnection(configuration);
}
+
+ public static List<RegionInfo> getMergeRegions(Connection conn, RegionInfo regionInfo)
+ throws IOException {
+ return MetaTableAccessor.getMergeRegions(conn, regionInfo.getRegionName());
+ }
}
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 1588d5963c..21011f0969 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,6 +18,7 @@
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.Cell;
@@ -29,6 +30,7 @@ import org.apache.hadoop.hbase.ServerName;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.Admin;
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.exceptions.DeserializationException;
@@ -159,4 +161,9 @@ public class CompatUtil {
return org.apache.hadoop.hbase.client.ConnectionFactory.createConnection(configuration);
}
}
+
+ public static List<RegionInfo> getMergeRegions(Connection conn, RegionInfo regionInfo)
+ throws IOException {
+ return MetaTableAccessor.getMergeRegions(conn, regionInfo.getRegionName());
+ }
}
diff --git a/phoenix-hbase-compat-2.5.0/pom.xml b/phoenix-hbase-compat-2.5.0/pom.xml
index 1d5f26eb61..cf5bf12e12 100644
--- a/phoenix-hbase-compat-2.5.0/pom.xml
+++ b/phoenix-hbase-compat-2.5.0/pom.xml
@@ -28,7 +28,7 @@
<artifactId>phoenix-hbase-compat-2.5.0</artifactId>
<name>Phoenix Hbase 2.5.0 compatibility</name>
- <description>Compatibility module for HBase 2.5.0+</description>
+ <description>Compatibility module for HBase 2.5.0 - 2.5.3</description>
<properties>
<hbase25.compat.version>2.5.0</hbase25.compat.version>
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 9697b35ef6..97e5960046 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,6 +18,7 @@
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.Cell;
@@ -29,6 +30,7 @@ import org.apache.hadoop.hbase.ServerName;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.Admin;
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.exceptions.DeserializationException;
@@ -151,4 +153,9 @@ public class CompatUtil {
final RegionCoprocessorEnvironment env) throws IOException {
return env.createConnection(configuration);
}
+
+ public static List<RegionInfo> getMergeRegions(Connection conn, RegionInfo regionInfo)
+ throws IOException {
+ return MetaTableAccessor.getMergeRegions(conn, regionInfo.getRegionName());
+ }
}
diff --git a/phoenix-hbase-compat-2.5.0/pom.xml b/phoenix-hbase-compat-2.5.4/pom.xml
similarity index 94%
copy from phoenix-hbase-compat-2.5.0/pom.xml
copy to phoenix-hbase-compat-2.5.4/pom.xml
index 1d5f26eb61..6b54621d96 100644
--- a/phoenix-hbase-compat-2.5.0/pom.xml
+++ b/phoenix-hbase-compat-2.5.4/pom.xml
@@ -26,12 +26,12 @@
<version>5.1.4-SNAPSHOT</version>
</parent>
- <artifactId>phoenix-hbase-compat-2.5.0</artifactId>
- <name>Phoenix Hbase 2.5.0 compatibility</name>
- <description>Compatibility module for HBase 2.5.0+</description>
+ <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.0</hbase25.compat.version>
+ <hbase25.compat.version>2.5.4</hbase25.compat.version>
</properties>
<dependencies>
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/CompatPermissionUtil.java b/phoenix-hbase-compat-2.5.4/src/main/java/org/apache/phoenix/compat/hbase/CompatPermissionUtil.java
new file mode 100644
index 0000000000..80a99b3a3d
--- /dev/null
+++ b/phoenix-hbase-compat-2.5.4/src/main/java/org/apache/phoenix/compat/hbase/CompatPermissionUtil.java
@@ -0,0 +1,59 @@
+/*
+ * 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.hbase.TableName;
+import org.apache.hadoop.hbase.security.User;
+import org.apache.hadoop.hbase.security.access.AccessChecker;
+import org.apache.hadoop.hbase.security.access.Permission;
+import org.apache.hadoop.hbase.security.access.UserPermission;
+import org.apache.hadoop.hbase.zookeeper.ZKWatcher;
+
+public class CompatPermissionUtil {
+
+ private CompatPermissionUtil() {
+ //Not to be instantiated
+ }
+
+ public static AccessChecker newAccessChecker(final Configuration conf, ZKWatcher zk) {
+ //Ignore ZK parameter
+ return new AccessChecker(conf);
+ }
+
+ public static void stopAccessChecker(AccessChecker accessChecker) throws IOException {
+ //NOOP
+ }
+
+ public static String getUserFromUP(UserPermission userPermission) {
+ return userPermission.getUser();
+ }
+
+ public static Permission getPermissionFromUP(UserPermission userPermission) {
+ return userPermission.getPermission();
+ }
+
+ public static boolean authorizeUserTable(AccessChecker accessChecker, User user,
+ TableName table, Permission.Action action) {
+ // This also checks for group access
+ return accessChecker.getAuthManager().authorizeUserTable(user, table, action);
+ }
+
+}
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..63265789c7
--- /dev/null
+++ b/phoenix-hbase-compat-2.5.4/src/main/java/org/apache/phoenix/compat/hbase/CompatPhoenixRpcScheduler.java
@@ -0,0 +1,69 @@
+/*
+ * 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 int getMetaPriorityQueueLength() {
+ return this.delegate.getMetaPriorityQueueLength();
+ }
+
+ @Override
+ public int getActiveGeneralRpcHandlerCount() {
+ return this.delegate.getActiveGeneralRpcHandlerCount();
+ }
+
+ @Override
+ public int getActivePriorityRpcHandlerCount() {
+ return this.delegate.getActivePriorityRpcHandlerCount();
+ }
+
+ @Override
+ public int getActiveMetaPriorityRpcHandlerCount() {
+ return this.delegate.getActiveMetaPriorityRpcHandlerCount();
+ }
+
+ @Override
+ public int getActiveReplicationRpcHandlerCount() {
+ return this.delegate.getActiveReplicationRpcHandlerCount();
+ }
+
+ @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.4/src/main/java/org/apache/phoenix/compat/hbase/CompatSteppingSplitPolicy.java b/phoenix-hbase-compat-2.5.4/src/main/java/org/apache/phoenix/compat/hbase/CompatSteppingSplitPolicy.java
new file mode 100644
index 0000000000..f185153996
--- /dev/null
+++ b/phoenix-hbase-compat-2.5.4/src/main/java/org/apache/phoenix/compat/hbase/CompatSteppingSplitPolicy.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.SteppingSplitPolicy;
+
+public class CompatSteppingSplitPolicy extends SteppingSplitPolicy {
+
+}
diff --git a/phoenix-hbase-compat-2.5.4/src/main/java/org/apache/phoenix/compat/hbase/CompatStoreFileReader.java b/phoenix-hbase-compat-2.5.4/src/main/java/org/apache/phoenix/compat/hbase/CompatStoreFileReader.java
new file mode 100644
index 0000000000..03aa257233
--- /dev/null
+++ b/phoenix-hbase-compat-2.5.4/src/main/java/org/apache/phoenix/compat/hbase/CompatStoreFileReader.java
@@ -0,0 +1,48 @@
+/*
+ * 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.concurrent.atomic.AtomicInteger;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hbase.fs.HFileSystem;
+import org.apache.hadoop.hbase.io.FSDataInputStreamWrapper;
+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.io.hfile.ReaderContext.ReaderType;
+import org.apache.hadoop.hbase.regionserver.StoreFileReader;
+
+public class CompatStoreFileReader extends StoreFileReader {
+
+ public CompatStoreFileReader(final FileSystem fs, final Path p,
+ final FSDataInputStreamWrapper in, long size, final CacheConfig cacheConf,
+ boolean primaryReplicaStoreFile, AtomicInteger refCount, final Configuration conf)
+ throws IOException {
+ super(new ReaderContext(p, in, size, new HFileSystem(fs), primaryReplicaStoreFile,
+ ReaderType.STREAM),
+ new HFileInfo(new ReaderContext(p, in, size, new HFileSystem(fs),
+ primaryReplicaStoreFile, ReaderType.STREAM), conf),
+ cacheConf, refCount, conf);
+ getHFileReader().getHFileInfo().initMetaAndIndex(getHFileReader());
+ }
+
+}
\ No newline at end of file
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 95%
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 9697b35ef6..eb6ae8c7df 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,6 +18,7 @@
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.Cell;
@@ -29,6 +30,7 @@ import org.apache.hadoop.hbase.ServerName;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.Admin;
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.exceptions.DeserializationException;
@@ -151,4 +153,9 @@ public class CompatUtil {
final RegionCoprocessorEnvironment env) throws IOException {
return env.createConnection(configuration);
}
+
+ public static List<RegionInfo> getMergeRegions(Connection conn, RegionInfo regionInfo)
+ throws IOException {
+ return MetaTableAccessor.getMergeRegions(conn, regionInfo);
+ }
}
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..2cb9cdfd61
--- /dev/null
+++ b/phoenix-hbase-compat-2.5.4/src/main/java/org/apache/phoenix/compat/hbase/HbaseCompatCapabilities.java
@@ -0,0 +1,39 @@
+/*
+ * 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 {
+
+ public static boolean isMaxLookbackTimeSupported() {
+ return true;
+ }
+
+ //In HBase 2.1 and 2.2, a lookback query won't return any results if covered by a future delete,
+ //but in 2.3 and later we have the preSoreScannerOpen hook that overrides that behavior
+ public static boolean isLookbackBeyondDeletesSupported() { return true; }
+
+ //HBase 2.1 does not have HBASE-22710, which is necessary for raw scan skip scan and
+ // AllVersionsIndexRebuild filters to
+ // show all versions properly. HBase 2.2.5+ and HBase 2.3.0+ have this fix.
+ public static boolean isRawFilterSupported() { return true; }
+
+ //HBase 2.3+ has preWALAppend() on RegionObserver (HBASE-22623)
+ public static boolean hasPreWALAppend() { return true; }
+
+}
diff --git a/phoenix-hbase-compat-2.5.4/src/main/java/org/apache/phoenix/compat/hbase/OffsetCell.java b/phoenix-hbase-compat-2.5.4/src/main/java/org/apache/phoenix/compat/hbase/OffsetCell.java
new file mode 100644
index 0000000000..c5485a5e9b
--- /dev/null
+++ b/phoenix-hbase-compat-2.5.4/src/main/java/org/apache/phoenix/compat/hbase/OffsetCell.java
@@ -0,0 +1,136 @@
+/*
+ * 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.Cell;
+
+public class OffsetCell implements Cell {
+
+ private Cell cell;
+ private int offset;
+
+ public OffsetCell(Cell cell, int offset) {
+ this.cell = cell;
+ this.offset = offset;
+ }
+
+ @Override
+ public byte[] getRowArray() {
+ return cell.getRowArray();
+ }
+
+ @Override
+ public int getRowOffset() {
+ return cell.getRowOffset() + offset;
+ }
+
+ @Override
+ public short getRowLength() {
+ return (short) (cell.getRowLength() - offset);
+ }
+
+ @Override
+ public byte[] getFamilyArray() {
+ return cell.getFamilyArray();
+ }
+
+ @Override
+ public int getFamilyOffset() {
+ return cell.getFamilyOffset();
+ }
+
+ @Override
+ public byte getFamilyLength() {
+ return cell.getFamilyLength();
+ }
+
+ @Override
+ public byte[] getQualifierArray() {
+ return cell.getQualifierArray();
+ }
+
+ @Override
+ public int getQualifierOffset() {
+ return cell.getQualifierOffset();
+ }
+
+ @Override
+ public int getQualifierLength() {
+ return cell.getQualifierLength();
+ }
+
+ @Override
+ public long getTimestamp() {
+ return cell.getTimestamp();
+ }
+
+ @Override
+ public byte getTypeByte() {
+ return cell.getTypeByte();
+ }
+
+ @Override public long getSequenceId() {
+ return cell.getSequenceId();
+ }
+
+ @Override
+ public byte[] getValueArray() {
+ return cell.getValueArray();
+ }
+
+ @Override
+ public int getValueOffset() {
+ return cell.getValueOffset();
+ }
+
+ @Override
+ public int getValueLength() {
+ return cell.getValueLength();
+ }
+
+ @Override
+ public byte[] getTagsArray() {
+ return cell.getTagsArray();
+ }
+
+ @Override
+ public int getTagsOffset() {
+ return cell.getTagsOffset();
+ }
+
+ @Override
+ public int getTagsLength() {
+ return cell.getTagsLength();
+ }
+
+ @Override
+ public Type getType() {
+ return cell.getType();
+ }
+
+ @Override
+ public long heapSize() {
+ return cell.heapSize();
+ }
+
+ @Override
+ public int getSerializedSize() {
+ return cell.getSerializedSize() - offset;
+ }
+
+}
diff --git a/phoenix-hbase-compat-2.5.4/src/main/java/org/apache/phoenix/compat/hbase/coprocessor/CompatBaseScannerRegionObserver.java b/phoenix-hbase-compat-2.5.4/src/main/java/org/apache/phoenix/compat/hbase/coprocessor/CompatBaseScannerRegionObserver.java
new file mode 100644
index 0000000000..cd1a7f5636
--- /dev/null
+++ b/phoenix-hbase-compat-2.5.4/src/main/java/org/apache/phoenix/compat/hbase/coprocessor/CompatBaseScannerRegionObserver.java
@@ -0,0 +1,197 @@
+/*
+ * 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.coprocessor;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.HConstants;
+import org.apache.hadoop.hbase.KeepDeletedCells;
+import org.apache.hadoop.hbase.MemoryCompactionPolicy;
+import org.apache.hadoop.hbase.client.ColumnFamilyDescriptor;
+import org.apache.hadoop.hbase.client.Scan;
+import org.apache.hadoop.hbase.coprocessor.ObserverContext;
+import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
+import org.apache.hadoop.hbase.coprocessor.RegionObserver;
+import org.apache.hadoop.hbase.regionserver.FlushLifeCycleTracker;
+import org.apache.hadoop.hbase.regionserver.ScanOptions;
+import org.apache.hadoop.hbase.regionserver.ScanType;
+import org.apache.hadoop.hbase.regionserver.Store;
+import org.apache.hadoop.hbase.regionserver.compactions.CompactionLifeCycleTracker;
+import org.apache.hadoop.hbase.regionserver.compactions.CompactionRequest;
+import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
+
+import java.io.IOException;
+
+public class CompatBaseScannerRegionObserver implements RegionObserver {
+
+ public static final String PHOENIX_MAX_LOOKBACK_AGE_CONF_KEY =
+ "phoenix.max.lookback.age.seconds";
+ public static final int DEFAULT_PHOENIX_MAX_LOOKBACK_AGE = 0;
+
+ public void preCompactScannerOpen(ObserverContext<RegionCoprocessorEnvironment> c, Store store,
+ ScanType scanType, ScanOptions options, CompactionLifeCycleTracker tracker,
+ CompactionRequest request) throws IOException {
+ Configuration conf = c.getEnvironment().getConfiguration();
+ if (isMaxLookbackTimeEnabled(conf)) {
+ setScanOptionsForFlushesAndCompactions(conf, options, store, scanType);
+ }
+ }
+
+ public void preFlushScannerOpen(ObserverContext<RegionCoprocessorEnvironment> c, Store store,
+ ScanOptions options, FlushLifeCycleTracker tracker) throws IOException {
+ Configuration conf = c.getEnvironment().getConfiguration();
+ if (isMaxLookbackTimeEnabled(conf)) {
+ setScanOptionsForFlushesAndCompactions(conf, options, store, ScanType.COMPACT_RETAIN_DELETES);
+ }
+ }
+
+ public void preMemStoreCompactionCompactScannerOpen(
+ ObserverContext<RegionCoprocessorEnvironment> c, Store store, ScanOptions options)
+ throws IOException {
+ Configuration conf = c.getEnvironment().getConfiguration();
+ if (isMaxLookbackTimeEnabled(conf)) {
+ MemoryCompactionPolicy inMemPolicy =
+ store.getColumnFamilyDescriptor().getInMemoryCompaction();
+ ScanType scanType;
+ //the eager and adaptive in-memory compaction policies can purge versions; the others
+ // can't. (Eager always does; adaptive sometimes does)
+ if (inMemPolicy.equals(MemoryCompactionPolicy.EAGER) ||
+ inMemPolicy.equals(MemoryCompactionPolicy.ADAPTIVE)) {
+ scanType = ScanType.COMPACT_DROP_DELETES;
+ } else {
+ scanType = ScanType.COMPACT_RETAIN_DELETES;
+ }
+ setScanOptionsForFlushesAndCompactions(conf, options, store, scanType);
+ }
+ }
+
+ public void preStoreScannerOpen(ObserverContext<RegionCoprocessorEnvironment> ctx, Store store,
+ ScanOptions options) throws IOException {
+
+ if (!storeFileScanDoesntNeedAlteration(options)) {
+ //PHOENIX-4277 -- When doing a point-in-time (SCN) Scan, HBase by default will hide
+ // mutations that happen before a delete marker. This overrides that behavior.
+ options.setMinVersions(options.getMinVersions());
+ KeepDeletedCells keepDeletedCells = KeepDeletedCells.TRUE;
+ if (store.getColumnFamilyDescriptor().getTimeToLive() != HConstants.FOREVER) {
+ keepDeletedCells = KeepDeletedCells.TTL;
+ }
+ options.setKeepDeletedCells(keepDeletedCells);
+ }
+ }
+
+ private boolean storeFileScanDoesntNeedAlteration(ScanOptions options) {
+ Scan scan = options.getScan();
+ boolean isRaw = scan.isRaw();
+ //true if keep deleted cells is either TRUE or TTL
+ boolean keepDeletedCells = options.getKeepDeletedCells().equals(KeepDeletedCells.TRUE) ||
+ options.getKeepDeletedCells().equals(KeepDeletedCells.TTL);
+ boolean timeRangeIsLatest = scan.getTimeRange().getMax() == HConstants.LATEST_TIMESTAMP;
+ boolean timestampIsTransactional =
+ isTransactionalTimestamp(scan.getTimeRange().getMax());
+ return isRaw
+ || keepDeletedCells
+ || timeRangeIsLatest
+ || timestampIsTransactional;
+ }
+
+ private boolean isTransactionalTimestamp(long ts) {
+ //have to use the HBase edge manager because the Phoenix one is in phoenix-core
+ return ts > (long) (EnvironmentEdgeManager.currentTime() * 1.1);
+ }
+
+ /*
+ * If KeepDeletedCells.FALSE, KeepDeletedCells.TTL ,
+ * let delete markers age once lookback age is done.
+ */
+ public KeepDeletedCells getKeepDeletedCells(ScanOptions options, ScanType scanType) {
+ //if we're doing a minor compaction or flush, always set keep deleted cells
+ //to true. Otherwise, if keep deleted cells is false or TTL, use KeepDeletedCells TTL,
+ //where the value of the ttl might be overriden to the max lookback age elsewhere
+ return (options.getKeepDeletedCells() == KeepDeletedCells.TRUE
+ || scanType.equals(ScanType.COMPACT_RETAIN_DELETES)) ?
+ KeepDeletedCells.TRUE : KeepDeletedCells.TTL;
+ }
+
+ /*
+ * if the user set a TTL we should leave MIN_VERSIONS at the default (0 in most of the cases).
+ * Otherwise the data (1st version) will not be removed after the TTL. If no TTL, we want
+ * Math.max(maxVersions, minVersions, 1)
+ */
+ public int getMinVersions(ScanOptions options, ColumnFamilyDescriptor cfDescriptor) {
+ return cfDescriptor.getTimeToLive() != HConstants.FOREVER ? options.getMinVersions()
+ : Math.max(Math.max(options.getMinVersions(),
+ cfDescriptor.getMaxVersions()),1);
+ }
+
+ /**
+ *
+ * @param conf HBase Configuration
+ * @param columnDescriptor ColumnFamilyDescriptor for the store being compacted
+ * @param options ScanOptions of overrides to the compaction scan
+ * @return Time to live in milliseconds, based on both HBase TTL and Phoenix max lookback age
+ */
+ public long getTimeToLiveForCompactions(Configuration conf,
+ ColumnFamilyDescriptor columnDescriptor,
+ ScanOptions options) {
+ long ttlConfigured = columnDescriptor.getTimeToLive();
+ long ttlInMillis = ttlConfigured * 1000;
+ long maxLookbackTtl = getMaxLookbackInMillis(conf);
+ if (isMaxLookbackTimeEnabled(maxLookbackTtl)) {
+ if (ttlConfigured == HConstants.FOREVER
+ && columnDescriptor.getKeepDeletedCells() != KeepDeletedCells.TRUE) {
+ // If user configured default TTL(FOREVER) and keep deleted cells to false or
+ // TTL then to remove unwanted delete markers we should change ttl to max lookback age
+ ttlInMillis = maxLookbackTtl;
+ } else {
+ //if there is a TTL, use TTL instead of max lookback age.
+ // Max lookback age should be more recent or equal to TTL
+ ttlInMillis = Math.max(ttlInMillis, maxLookbackTtl);
+ }
+ }
+
+ return ttlInMillis;
+ }
+
+ public void setScanOptionsForFlushesAndCompactions(Configuration conf,
+ ScanOptions options,
+ final Store store,
+ ScanType type) {
+ ColumnFamilyDescriptor cfDescriptor = store.getColumnFamilyDescriptor();
+ options.setTTL(getTimeToLiveForCompactions(conf, cfDescriptor,
+ options));
+ options.setKeepDeletedCells(getKeepDeletedCells(options, type));
+ options.setMaxVersions(Integer.MAX_VALUE);
+ options.setMinVersions(getMinVersions(options, cfDescriptor));
+ }
+
+ public static long getMaxLookbackInMillis(Configuration conf){
+ //config param is in seconds, switch to millis
+ return conf.getLong(PHOENIX_MAX_LOOKBACK_AGE_CONF_KEY,
+ DEFAULT_PHOENIX_MAX_LOOKBACK_AGE) * 1000;
+ }
+
+ public static boolean isMaxLookbackTimeEnabled(Configuration conf){
+ return isMaxLookbackTimeEnabled(conf.getLong(PHOENIX_MAX_LOOKBACK_AGE_CONF_KEY,
+ DEFAULT_PHOENIX_MAX_LOOKBACK_AGE));
+ }
+
+ public static boolean isMaxLookbackTimeEnabled(long maxLookbackTime){
+ return maxLookbackTime > 0L;
+ }
+
+}
diff --git a/phoenix-hbase-compat-2.5.4/src/main/java/org/apache/phoenix/compat/hbase/coprocessor/CompatIndexRegionObserver.java b/phoenix-hbase-compat-2.5.4/src/main/java/org/apache/phoenix/compat/hbase/coprocessor/CompatIndexRegionObserver.java
new file mode 100644
index 0000000000..f887ed3492
--- /dev/null
+++ b/phoenix-hbase-compat-2.5.4/src/main/java/org/apache/phoenix/compat/hbase/coprocessor/CompatIndexRegionObserver.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.coprocessor;
+
+import org.apache.hadoop.hbase.coprocessor.RegionObserver;
+import org.apache.hadoop.hbase.wal.WALKey;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class CompatIndexRegionObserver implements RegionObserver {
+
+ public static void appendToWALKey(WALKey key, String attrKey, byte[] attrValue) {
+ key.addExtendedAttribute(attrKey, attrValue);
+ }
+
+ public static byte[] getAttributeValueFromWALKey(WALKey key, String attrKey) {
+ return key.getExtendedAttribute(attrKey);
+ }
+
+ public static Map<String, byte[]> getAttributeValuesFromWALKey(WALKey key) {
+ return new HashMap<String, byte[]>(key.getExtendedAttributes());
+ }
+
+}
diff --git a/phoenix-hbase-compat-2.5.4/src/main/java/org/apache/phoenix/compat/hbase/test/DelegateCell.java b/phoenix-hbase-compat-2.5.4/src/main/java/org/apache/phoenix/compat/hbase/test/DelegateCell.java
new file mode 100644
index 0000000000..0c7dfd8f5c
--- /dev/null
+++ b/phoenix-hbase-compat-2.5.4/src/main/java/org/apache/phoenix/compat/hbase/test/DelegateCell.java
@@ -0,0 +1,139 @@
+/*
+ * 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.test;
+
+import org.apache.hadoop.hbase.Cell;
+
+public class DelegateCell implements Cell {
+ private final Cell delegate;
+ private final String name;
+ public DelegateCell(Cell delegate, String name) {
+ this.delegate = delegate;
+ this.name = name;
+ }
+
+ @Override
+ public int getValueOffset() {
+ return delegate.getValueOffset();
+ }
+
+ @Override
+ public int getValueLength() {
+ return delegate.getValueLength();
+ }
+
+ @Override
+ public byte[] getValueArray() {
+ return delegate.getValueArray();
+ }
+
+ @Override
+ public byte getTypeByte() {
+ return delegate.getTypeByte();
+ }
+
+ @Override
+ public long getTimestamp() {
+ return delegate.getTimestamp();
+ }
+
+ @Override
+ public int getTagsOffset() {
+ return delegate.getTagsOffset();
+ }
+
+ @Override
+ public byte[] getTagsArray() {
+ return delegate.getTagsArray();
+ }
+
+ @Override
+ public int getRowOffset() {
+ return delegate.getRowOffset();
+ }
+
+ @Override
+ public short getRowLength() {
+ return delegate.getRowLength();
+ }
+
+ @Override
+ public byte[] getRowArray() {
+ return delegate.getRowArray();
+ }
+
+ @Override
+ public int getQualifierOffset() {
+ return delegate.getQualifierOffset();
+ }
+
+ @Override
+ public int getQualifierLength() {
+ return delegate.getQualifierLength();
+ }
+
+ @Override
+ public byte[] getQualifierArray() {
+ return delegate.getQualifierArray();
+ }
+
+ @Override
+ public int getFamilyOffset() {
+ return delegate.getFamilyOffset();
+ }
+
+ @Override
+ public byte getFamilyLength() {
+ return delegate.getFamilyLength();
+ }
+
+ @Override
+ public byte[] getFamilyArray() {
+ return delegate.getFamilyArray();
+ }
+
+ @Override
+ public String toString() {
+ return name;
+ }
+
+ @Override
+ public long getSequenceId() {
+ return delegate.getSequenceId();
+ }
+
+ @Override
+ public int getTagsLength() {
+ return delegate.getTagsLength();
+ }
+
+ @Override
+ public Type getType() {
+ return delegate.getType();
+ }
+
+ @Override
+ public long heapSize() {
+ return delegate.heapSize();
+ }
+
+ @Override
+ public int getSerializedSize() {
+ return delegate.getSerializedSize();
+ }
+}
diff --git a/pom.xml b/pom.xml
index 431110986f..24e725cc11 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>
@@ -82,14 +83,15 @@
<hbase.suffix>hbase-${hbase.profile}</hbase.suffix>
<!-- This is used by the release script only -->
- <hbase.profile.list>2.1 2.2 2.3 2.4.0 2.4 2.5</hbase.profile.list>
+ <hbase.profile.list>2.1 2.2 2.3 2.4.0 2.4 2.5 2.5.0</hbase.profile.list>
<!-- The default hbase versions to build with (override with hbase.version) -->
<hbase-2.1.runtime.version>2.1.10</hbase-2.1.runtime.version>
<hbase-2.2.runtime.version>2.2.7</hbase-2.2.runtime.version>
<hbase-2.3.runtime.version>2.3.7</hbase-2.3.runtime.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>
@@ -704,6 +706,11 @@
<artifactId>phoenix-client-hbase-2.4</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.phoenix</groupId>
+ <artifactId>phoenix-client-hbase-2.5.0</artifactId>
+ <version>${project.version}</version>
+ </dependency>
<dependency>
<groupId>org.apache.phoenix</groupId>
<artifactId>phoenix-client-hbase-2.5</artifactId>
@@ -734,6 +741,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>
@@ -764,6 +776,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>
@@ -814,6 +831,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>
@@ -1781,6 +1803,24 @@
<profile>
<!-- PHOENIX-5993 This won't work with the public HBase 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.runtime.version}</hbase.version>
+ <zookeeper.version>3.5.7</zookeeper.version>
+ <tephra.hbase.compat.version>2.4</tephra.hbase.compat.version>
+ </properties>
+ </profile>
+ <profile>
+ <!-- PHOENIX-5993 This won't work with the public HBase artifacts -->
+ <id>phoenix-hbase-compat-2.5.4</id>
<activation>
<property>
<name>hbase.profile</name>
@@ -1789,7 +1829,7 @@
</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>
<zookeeper.version>3.5.7</zookeeper.version>