This is an automated email from the ASF dual-hosted git repository.
stoty pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/phoenix.git
The following commit(s) were added to refs/heads/master by this push:
new f18b5bd45a PHOENIX-7682 Review and simplify compatibility modules
(#2269)
f18b5bd45a is described below
commit f18b5bd45ac3d9a4e05aa1c1ac3d6cde472e6db1
Author: Istvan Toth <[email protected]>
AuthorDate: Thu Aug 7 14:16:48 2025 +0200
PHOENIX-7682 Review and simplify compatibility modules (#2269)
---
.../org/apache/phoenix/execute/DelegateHTable.java | 6 +++
.../phoenix/transaction/OmidTransactionTable.java | 5 ++
.../coprocessor/ReplicationSinkEndpoint.java | 34 +++++++++++-
.../phoenix/mapreduce/MultiHfileOutputFormat.java | 6 +--
.../java/org/apache/phoenix/util/ServerUtil.java | 4 +-
.../TestTrackingParallelWriterIndexCommitter.java | 5 +-
.../phoenix/compat/hbase/CompatDelegateHTable.java | 12 -----
.../compat/hbase/CompatOmidTransactionTable.java | 12 -----
.../apache/phoenix/compat/hbase/CompatUtil.java | 31 -----------
.../hbase/ReplicationSinkCompatEndpoint.java | 61 ----------------------
.../phoenix/compat/hbase/CompatDelegateHTable.java | 12 -----
.../compat/hbase/CompatOmidTransactionTable.java | 12 -----
.../apache/phoenix/compat/hbase/CompatUtil.java | 30 -----------
.../hbase/ReplicationSinkCompatEndpoint.java | 61 ----------------------
.../phoenix/compat/hbase/CompatDelegateHTable.java | 12 -----
.../compat/hbase/CompatOmidTransactionTable.java | 12 -----
.../apache/phoenix/compat/hbase/CompatUtil.java | 30 -----------
.../hbase/ReplicationSinkCompatEndpoint.java | 61 ----------------------
18 files changed, 49 insertions(+), 357 deletions(-)
diff --git
a/phoenix-core-client/src/main/java/org/apache/phoenix/execute/DelegateHTable.java
b/phoenix-core-client/src/main/java/org/apache/phoenix/execute/DelegateHTable.java
index 690f2c27c9..6ba1d932f0 100644
---
a/phoenix-core-client/src/main/java/org/apache/phoenix/execute/DelegateHTable.java
+++
b/phoenix-core-client/src/main/java/org/apache/phoenix/execute/DelegateHTable.java
@@ -39,6 +39,7 @@ import org.apache.hadoop.hbase.client.RegionLocator;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.client.ResultScanner;
import org.apache.hadoop.hbase.client.Row;
+import org.apache.hadoop.hbase.client.RowMutations;
import org.apache.hadoop.hbase.client.Scan;
import org.apache.hadoop.hbase.client.Table;
import org.apache.hadoop.hbase.client.TableDescriptor;
@@ -225,4 +226,9 @@ public class DelegateHTable extends CompatDelegateHTable
implements Table {
public RegionLocator getRegionLocator() throws IOException {
return delegate.getRegionLocator();
}
+
+ @Override
+ public Result mutateRow(RowMutations rm) throws IOException {
+ return delegate.mutateRow(rm);
+ }
}
diff --git
a/phoenix-core-client/src/main/java/org/apache/phoenix/transaction/OmidTransactionTable.java
b/phoenix-core-client/src/main/java/org/apache/phoenix/transaction/OmidTransactionTable.java
index 29eff6b608..98f79b4e13 100644
---
a/phoenix-core-client/src/main/java/org/apache/phoenix/transaction/OmidTransactionTable.java
+++
b/phoenix-core-client/src/main/java/org/apache/phoenix/transaction/OmidTransactionTable.java
@@ -336,4 +336,9 @@ public class OmidTransactionTable extends
CompatOmidTransactionTable implements
public RegionLocator getRegionLocator() throws IOException {
throw new UnsupportedOperationException();
}
+
+ @Override
+ public Result mutateRow(RowMutations rm) throws IOException {
+ throw new UnsupportedOperationException();
+ }
}
diff --git
a/phoenix-core-server/src/main/java/org/apache/phoenix/coprocessor/ReplicationSinkEndpoint.java
b/phoenix-core-server/src/main/java/org/apache/phoenix/coprocessor/ReplicationSinkEndpoint.java
index cd30c9a83e..1bb4171e91 100644
---
a/phoenix-core-server/src/main/java/org/apache/phoenix/coprocessor/ReplicationSinkEndpoint.java
+++
b/phoenix-core-server/src/main/java/org/apache/phoenix/coprocessor/ReplicationSinkEndpoint.java
@@ -17,13 +17,43 @@
*/
package org.apache.phoenix.coprocessor;
-import org.apache.phoenix.compat.hbase.ReplicationSinkCompatEndpoint;
+import java.io.IOException;
+import java.util.List;
+import java.util.Optional;
+import org.apache.hadoop.hbase.client.Mutation;
+import org.apache.hadoop.hbase.coprocessor.ObserverContext;
+import org.apache.hadoop.hbase.coprocessor.RegionServerCoprocessor;
+import org.apache.hadoop.hbase.coprocessor.RegionServerCoprocessorEnvironment;
+import org.apache.hadoop.hbase.coprocessor.RegionServerObserver;
+
+import org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos;
+import org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos;
/**
* This class is to be used as regionserver coproc when Phoenix metadata
attribute values like
* Tenant id, Schema name, logical table, table type etc need to be replicated
across the
* replication sink cluster.
*/
-public class ReplicationSinkEndpoint extends ReplicationSinkCompatEndpoint {
+public class ReplicationSinkEndpoint implements RegionServerCoprocessor,
RegionServerObserver {
+ @Override
+ public Optional<RegionServerObserver> getRegionServerObserver() {
+ return Optional.of(this);
+ }
+
+ @Override
+ public void
preReplicationSinkBatchMutate(ObserverContext<RegionServerCoprocessorEnvironment>
ctx,
+ AdminProtos.WALEntry walEntry, Mutation mutation) throws IOException {
+ RegionServerObserver.super.preReplicationSinkBatchMutate(ctx, walEntry,
mutation);
+ List<WALProtos.Attribute> attributeList =
walEntry.getKey().getExtendedAttributesList();
+ attachWALExtendedAttributesToMutation(mutation, attributeList);
+ }
+ private void attachWALExtendedAttributesToMutation(Mutation mutation,
+ List<WALProtos.Attribute> attributeList) {
+ if (attributeList != null) {
+ for (WALProtos.Attribute attribute : attributeList) {
+ mutation.setAttribute(attribute.getKey(),
attribute.getValue().toByteArray());
+ }
+ }
+ }
}
diff --git
a/phoenix-core-server/src/main/java/org/apache/phoenix/mapreduce/MultiHfileOutputFormat.java
b/phoenix-core-server/src/main/java/org/apache/phoenix/mapreduce/MultiHfileOutputFormat.java
index 833aebfa72..9847729b11 100644
---
a/phoenix-core-server/src/main/java/org/apache/phoenix/mapreduce/MultiHfileOutputFormat.java
+++
b/phoenix-core-server/src/main/java/org/apache/phoenix/mapreduce/MultiHfileOutputFormat.java
@@ -64,6 +64,7 @@ import org.apache.hadoop.hbase.mapreduce.ResultSerialization;
import org.apache.hadoop.hbase.mapreduce.TableMapReduceUtil;
import org.apache.hadoop.hbase.regionserver.BloomType;
import org.apache.hadoop.hbase.regionserver.StoreFileWriter;
+import org.apache.hadoop.hbase.regionserver.StoreUtils;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.SequenceFile;
@@ -74,7 +75,6 @@ import org.apache.hadoop.mapreduce.TaskAttemptContext;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
import org.apache.hadoop.mapreduce.lib.output.PathOutputCommitter;
import org.apache.hadoop.mapreduce.lib.partition.TotalOrderPartitioner;
-import org.apache.phoenix.compat.hbase.CompatUtil;
import org.apache.phoenix.mapreduce.bulkload.TableRowkeyPair;
import org.apache.phoenix.mapreduce.bulkload.TargetTableRef;
import org.apache.phoenix.mapreduce.bulkload.TargetTableRefFunctions;
@@ -253,8 +253,8 @@ public class MultiHfileOutputFormat extends
FileOutputFormat<TableRowkeyPair, Ce
Configuration tempConf = new Configuration(conf);
tempConf.setFloat(HConstants.HFILE_BLOCK_CACHE_SIZE_KEY, 0.0f);
HFileContextBuilder contextBuilder = new
HFileContextBuilder().withCompression(compression)
- .withChecksumType(CompatUtil.getChecksumType(conf))
-
.withBytesPerCheckSum(CompatUtil.getBytesPerChecksum(conf)).withBlockSize(blockSize)
+ .withChecksumType(StoreUtils.getChecksumType(conf))
+
.withBytesPerCheckSum(StoreUtils.getBytesPerChecksum(conf)).withBlockSize(blockSize)
.withDataBlockEncoding(encoding).withCellComparator(CellComparatorImpl.COMPARATOR);
HFileContext hFileContext = contextBuilder.build();
diff --git
a/phoenix-core-server/src/main/java/org/apache/phoenix/util/ServerUtil.java
b/phoenix-core-server/src/main/java/org/apache/phoenix/util/ServerUtil.java
index 0860c9a1a0..c46fe7f977 100644
--- a/phoenix-core-server/src/main/java/org/apache/phoenix/util/ServerUtil.java
+++ b/phoenix-core-server/src/main/java/org/apache/phoenix/util/ServerUtil.java
@@ -44,7 +44,6 @@ import
org.apache.hadoop.hbase.ipc.controller.InterRegionServerIndexRpcControlle
import org.apache.hadoop.hbase.regionserver.Region;
import org.apache.hadoop.hbase.regionserver.Region.RowLock;
import org.apache.hadoop.hbase.util.Bytes;
-import org.apache.phoenix.compat.hbase.CompatUtil;
import org.apache.phoenix.hbase.index.util.IndexManagementUtil;
import org.apache.phoenix.hbase.index.util.VersionUtil;
import org.apache.phoenix.hbase.index.write.IndexWriterUtils;
@@ -195,8 +194,7 @@ public class ServerUtil {
@Override
public Connection apply(ConnectionType t) {
try {
- return CompatUtil.createShortCircuitConnection(
- getTypeSpecificConfiguration(connectionType,
env.getConfiguration()), env);
+ return env.createConnection(getTypeSpecificConfiguration(t,
env.getConfiguration()));
} catch (IOException e) {
throw new RuntimeException(e);
}
diff --git
a/phoenix-core/src/it/java/org/apache/phoenix/hbase/index/write/TestTrackingParallelWriterIndexCommitter.java
b/phoenix-core/src/it/java/org/apache/phoenix/hbase/index/write/TestTrackingParallelWriterIndexCommitter.java
index a753a017d7..d2867d8079 100644
---
a/phoenix-core/src/it/java/org/apache/phoenix/hbase/index/write/TestTrackingParallelWriterIndexCommitter.java
+++
b/phoenix-core/src/it/java/org/apache/phoenix/hbase/index/write/TestTrackingParallelWriterIndexCommitter.java
@@ -26,7 +26,6 @@ import javax.annotation.concurrent.GuardedBy;
import org.apache.hadoop.hbase.Stoppable;
import org.apache.hadoop.hbase.client.Connection;
import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
-import org.apache.phoenix.compat.hbase.CompatUtil;
import org.apache.phoenix.hbase.index.table.HTableFactory;
import org.apache.phoenix.util.ServerUtil;
import org.slf4j.Logger;
@@ -53,8 +52,8 @@ public class TestTrackingParallelWriterIndexCommitter extends
TrackingParallelWr
@Override
public Connection apply(ServerUtil.ConnectionType t) {
try {
- return CompatUtil.createShortCircuitConnection(
- getTypeSpecificConfiguration(connectionType,
env.getConfiguration()), env);
+ return env.createConnection(
+ getTypeSpecificConfiguration(connectionType,
env.getConfiguration()));
} catch (IOException e) {
throw new RuntimeException(e);
}
diff --git
a/phoenix-hbase-compat-2.5.0/src/main/java/org/apache/phoenix/compat/hbase/CompatDelegateHTable.java
b/phoenix-hbase-compat-2.5.0/src/main/java/org/apache/phoenix/compat/hbase/CompatDelegateHTable.java
index 7ea0dddbbd..ed634aa0cd 100644
---
a/phoenix-hbase-compat-2.5.0/src/main/java/org/apache/phoenix/compat/hbase/CompatDelegateHTable.java
+++
b/phoenix-hbase-compat-2.5.0/src/main/java/org/apache/phoenix/compat/hbase/CompatDelegateHTable.java
@@ -24,8 +24,6 @@ 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.RegionLocator;
-import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.client.RowMutations;
import org.apache.hadoop.hbase.client.Table;
import org.apache.hadoop.hbase.filter.CompareFilter.CompareOp;
@@ -38,16 +36,6 @@ public abstract class CompatDelegateHTable implements Table {
this.delegate = delegate;
}
- @Override
- public RegionLocator getRegionLocator() throws IOException {
- return delegate.getRegionLocator();
- }
-
- @Override
- public Result mutateRow(RowMutations rm) throws IOException {
- return delegate.mutateRow(rm);
- }
-
@Override
public HTableDescriptor getTableDescriptor() throws IOException {
return delegate.getTableDescriptor();
diff --git
a/phoenix-hbase-compat-2.5.0/src/main/java/org/apache/phoenix/compat/hbase/CompatOmidTransactionTable.java
b/phoenix-hbase-compat-2.5.0/src/main/java/org/apache/phoenix/compat/hbase/CompatOmidTransactionTable.java
index a2dd34da6f..03d12c84ed 100644
---
a/phoenix-hbase-compat-2.5.0/src/main/java/org/apache/phoenix/compat/hbase/CompatOmidTransactionTable.java
+++
b/phoenix-hbase-compat-2.5.0/src/main/java/org/apache/phoenix/compat/hbase/CompatOmidTransactionTable.java
@@ -20,24 +20,12 @@ 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.RegionLocator;
-import org.apache.hadoop.hbase.client.Result;
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 RegionLocator getRegionLocator() throws IOException {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public Result mutateRow(RowMutations rm) throws IOException {
- throw new UnsupportedOperationException();
- }
-
@Override
public boolean checkAndPut(byte[] row, byte[] family, byte[] qualifier,
CompareOp compareOp,
byte[] value, Put put) throws IOException {
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 2f95c15b86..caba6f45c5 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
@@ -19,18 +19,9 @@ package org.apache.phoenix.compat.hbase;
import java.io.IOException;
import java.util.List;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.CellComparator;
import org.apache.hadoop.hbase.MetaTableAccessor;
import org.apache.hadoop.hbase.client.Connection;
import org.apache.hadoop.hbase.client.RegionInfo;
-import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
-import org.apache.hadoop.hbase.io.compress.Compression.Algorithm;
-import org.apache.hadoop.hbase.io.encoding.DataBlockEncoding;
-import org.apache.hadoop.hbase.io.hfile.HFileContext;
-import org.apache.hadoop.hbase.io.hfile.HFileContextBuilder;
-import org.apache.hadoop.hbase.regionserver.StoreUtils;
-import org.apache.hadoop.hbase.util.ChecksumType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -42,30 +33,8 @@ public class CompatUtil {
// Not to be instantiated
}
- public static HFileContext createHFileContext(Configuration conf, Algorithm
compression,
- Integer blockSize, DataBlockEncoding encoding, CellComparator comparator) {
-
- return new HFileContextBuilder().withCompression(compression)
- .withChecksumType(StoreUtils.getChecksumType(conf))
-
.withBytesPerCheckSum(StoreUtils.getBytesPerChecksum(conf)).withBlockSize(blockSize)
- .withDataBlockEncoding(encoding).build();
- }
-
public static List<RegionInfo> getMergeRegions(Connection conn, RegionInfo
regionInfo)
throws IOException {
return MetaTableAccessor.getMergeRegions(conn, regionInfo.getRegionName());
}
-
- public static ChecksumType getChecksumType(Configuration conf) {
- return StoreUtils.getChecksumType(conf);
- }
-
- public static int getBytesPerChecksum(Configuration conf) {
- return StoreUtils.getBytesPerChecksum(conf);
- }
-
- public static Connection createShortCircuitConnection(final Configuration
configuration,
- final RegionCoprocessorEnvironment env) throws IOException {
- return env.createConnection(configuration);
- }
}
diff --git
a/phoenix-hbase-compat-2.5.0/src/main/java/org/apache/phoenix/compat/hbase/ReplicationSinkCompatEndpoint.java
b/phoenix-hbase-compat-2.5.0/src/main/java/org/apache/phoenix/compat/hbase/ReplicationSinkCompatEndpoint.java
deleted file mode 100644
index 08e73164e3..0000000000
---
a/phoenix-hbase-compat-2.5.0/src/main/java/org/apache/phoenix/compat/hbase/ReplicationSinkCompatEndpoint.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * 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 java.util.Optional;
-import org.apache.hadoop.hbase.client.Mutation;
-import org.apache.hadoop.hbase.coprocessor.ObserverContext;
-import org.apache.hadoop.hbase.coprocessor.RegionServerCoprocessor;
-import org.apache.hadoop.hbase.coprocessor.RegionServerCoprocessorEnvironment;
-import org.apache.hadoop.hbase.coprocessor.RegionServerObserver;
-
-import org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos;
-import org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos;
-
-/**
- * Replication Sink compat endpoint that helps attach WAL attributes to
mutation. In order to do so,
- * this endpoint utilizes regionserver hook
- * {@link #preReplicationSinkBatchMutate(ObserverContext,
AdminProtos.WALEntry, Mutation)}
- */
-public class ReplicationSinkCompatEndpoint
- implements RegionServerCoprocessor, RegionServerObserver {
-
- @Override
- public Optional<RegionServerObserver> getRegionServerObserver() {
- return Optional.of(this);
- }
-
- @Override
- public void
preReplicationSinkBatchMutate(ObserverContext<RegionServerCoprocessorEnvironment>
ctx,
- AdminProtos.WALEntry walEntry, Mutation mutation) throws IOException {
- RegionServerObserver.super.preReplicationSinkBatchMutate(ctx, walEntry,
mutation);
- List<WALProtos.Attribute> attributeList =
walEntry.getKey().getExtendedAttributesList();
- attachWALExtendedAttributesToMutation(mutation, attributeList);
- }
-
- private void attachWALExtendedAttributesToMutation(Mutation mutation,
- List<WALProtos.Attribute> attributeList) {
- if (attributeList != null) {
- for (WALProtos.Attribute attribute : attributeList) {
- mutation.setAttribute(attribute.getKey(),
attribute.getValue().toByteArray());
- }
- }
- }
-}
diff --git
a/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
index 7ea0dddbbd..ed634aa0cd 100644
---
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
@@ -24,8 +24,6 @@ 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.RegionLocator;
-import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.client.RowMutations;
import org.apache.hadoop.hbase.client.Table;
import org.apache.hadoop.hbase.filter.CompareFilter.CompareOp;
@@ -38,16 +36,6 @@ public abstract class CompatDelegateHTable implements Table {
this.delegate = delegate;
}
- @Override
- public RegionLocator getRegionLocator() throws IOException {
- return delegate.getRegionLocator();
- }
-
- @Override
- public Result mutateRow(RowMutations rm) throws IOException {
- return delegate.mutateRow(rm);
- }
-
@Override
public HTableDescriptor getTableDescriptor() throws IOException {
return delegate.getTableDescriptor();
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
index a2dd34da6f..03d12c84ed 100644
---
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
@@ -20,24 +20,12 @@ 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.RegionLocator;
-import org.apache.hadoop.hbase.client.Result;
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 RegionLocator getRegionLocator() throws IOException {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public Result mutateRow(RowMutations rm) throws IOException {
- throw new UnsupportedOperationException();
- }
-
@Override
public boolean checkAndPut(byte[] row, byte[] family, byte[] qualifier,
CompareOp compareOp,
byte[] value, Put put) throws IOException {
diff --git
a/phoenix-hbase-compat-2.5.4/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
index e2bdc16d87..38a940aa43 100644
---
a/phoenix-hbase-compat-2.5.4/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
@@ -19,18 +19,9 @@ package org.apache.phoenix.compat.hbase;
import java.io.IOException;
import java.util.List;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.CellComparator;
import org.apache.hadoop.hbase.MetaTableAccessor;
import org.apache.hadoop.hbase.client.Connection;
import org.apache.hadoop.hbase.client.RegionInfo;
-import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
-import org.apache.hadoop.hbase.io.compress.Compression.Algorithm;
-import org.apache.hadoop.hbase.io.encoding.DataBlockEncoding;
-import org.apache.hadoop.hbase.io.hfile.HFileContext;
-import org.apache.hadoop.hbase.io.hfile.HFileContextBuilder;
-import org.apache.hadoop.hbase.regionserver.StoreUtils;
-import org.apache.hadoop.hbase.util.ChecksumType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -42,30 +33,9 @@ public class CompatUtil {
// Not to be instantiated
}
- public static HFileContext createHFileContext(Configuration conf, Algorithm
compression,
- Integer blockSize, DataBlockEncoding encoding, CellComparator comparator) {
-
- return new HFileContextBuilder().withCompression(compression)
- .withChecksumType(StoreUtils.getChecksumType(conf))
-
.withBytesPerCheckSum(StoreUtils.getBytesPerChecksum(conf)).withBlockSize(blockSize)
- .withDataBlockEncoding(encoding).build();
- }
-
public static List<RegionInfo> getMergeRegions(Connection conn, RegionInfo
regionInfo)
throws IOException {
return MetaTableAccessor.getMergeRegions(conn, regionInfo);
}
- public static ChecksumType getChecksumType(Configuration conf) {
- return StoreUtils.getChecksumType(conf);
- }
-
- public static int getBytesPerChecksum(Configuration conf) {
- return StoreUtils.getBytesPerChecksum(conf);
- }
-
- public static Connection createShortCircuitConnection(final Configuration
configuration,
- final RegionCoprocessorEnvironment env) throws IOException {
- return env.createConnection(configuration);
- }
}
diff --git
a/phoenix-hbase-compat-2.5.4/src/main/java/org/apache/phoenix/compat/hbase/ReplicationSinkCompatEndpoint.java
b/phoenix-hbase-compat-2.5.4/src/main/java/org/apache/phoenix/compat/hbase/ReplicationSinkCompatEndpoint.java
deleted file mode 100644
index 08e73164e3..0000000000
---
a/phoenix-hbase-compat-2.5.4/src/main/java/org/apache/phoenix/compat/hbase/ReplicationSinkCompatEndpoint.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * 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 java.util.Optional;
-import org.apache.hadoop.hbase.client.Mutation;
-import org.apache.hadoop.hbase.coprocessor.ObserverContext;
-import org.apache.hadoop.hbase.coprocessor.RegionServerCoprocessor;
-import org.apache.hadoop.hbase.coprocessor.RegionServerCoprocessorEnvironment;
-import org.apache.hadoop.hbase.coprocessor.RegionServerObserver;
-
-import org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos;
-import org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos;
-
-/**
- * Replication Sink compat endpoint that helps attach WAL attributes to
mutation. In order to do so,
- * this endpoint utilizes regionserver hook
- * {@link #preReplicationSinkBatchMutate(ObserverContext,
AdminProtos.WALEntry, Mutation)}
- */
-public class ReplicationSinkCompatEndpoint
- implements RegionServerCoprocessor, RegionServerObserver {
-
- @Override
- public Optional<RegionServerObserver> getRegionServerObserver() {
- return Optional.of(this);
- }
-
- @Override
- public void
preReplicationSinkBatchMutate(ObserverContext<RegionServerCoprocessorEnvironment>
ctx,
- AdminProtos.WALEntry walEntry, Mutation mutation) throws IOException {
- RegionServerObserver.super.preReplicationSinkBatchMutate(ctx, walEntry,
mutation);
- List<WALProtos.Attribute> attributeList =
walEntry.getKey().getExtendedAttributesList();
- attachWALExtendedAttributesToMutation(mutation, attributeList);
- }
-
- private void attachWALExtendedAttributesToMutation(Mutation mutation,
- List<WALProtos.Attribute> attributeList) {
- if (attributeList != null) {
- for (WALProtos.Attribute attribute : attributeList) {
- mutation.setAttribute(attribute.getKey(),
attribute.getValue().toByteArray());
- }
- }
- }
-}
diff --git
a/phoenix-hbase-compat-2.6.0/src/main/java/org/apache/phoenix/compat/hbase/CompatDelegateHTable.java
b/phoenix-hbase-compat-2.6.0/src/main/java/org/apache/phoenix/compat/hbase/CompatDelegateHTable.java
index 7ea0dddbbd..ed634aa0cd 100644
---
a/phoenix-hbase-compat-2.6.0/src/main/java/org/apache/phoenix/compat/hbase/CompatDelegateHTable.java
+++
b/phoenix-hbase-compat-2.6.0/src/main/java/org/apache/phoenix/compat/hbase/CompatDelegateHTable.java
@@ -24,8 +24,6 @@ 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.RegionLocator;
-import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.client.RowMutations;
import org.apache.hadoop.hbase.client.Table;
import org.apache.hadoop.hbase.filter.CompareFilter.CompareOp;
@@ -38,16 +36,6 @@ public abstract class CompatDelegateHTable implements Table {
this.delegate = delegate;
}
- @Override
- public RegionLocator getRegionLocator() throws IOException {
- return delegate.getRegionLocator();
- }
-
- @Override
- public Result mutateRow(RowMutations rm) throws IOException {
- return delegate.mutateRow(rm);
- }
-
@Override
public HTableDescriptor getTableDescriptor() throws IOException {
return delegate.getTableDescriptor();
diff --git
a/phoenix-hbase-compat-2.6.0/src/main/java/org/apache/phoenix/compat/hbase/CompatOmidTransactionTable.java
b/phoenix-hbase-compat-2.6.0/src/main/java/org/apache/phoenix/compat/hbase/CompatOmidTransactionTable.java
index a2dd34da6f..03d12c84ed 100644
---
a/phoenix-hbase-compat-2.6.0/src/main/java/org/apache/phoenix/compat/hbase/CompatOmidTransactionTable.java
+++
b/phoenix-hbase-compat-2.6.0/src/main/java/org/apache/phoenix/compat/hbase/CompatOmidTransactionTable.java
@@ -20,24 +20,12 @@ 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.RegionLocator;
-import org.apache.hadoop.hbase.client.Result;
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 RegionLocator getRegionLocator() throws IOException {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public Result mutateRow(RowMutations rm) throws IOException {
- throw new UnsupportedOperationException();
- }
-
@Override
public boolean checkAndPut(byte[] row, byte[] family, byte[] qualifier,
CompareOp compareOp,
byte[] value, Put put) throws IOException {
diff --git
a/phoenix-hbase-compat-2.6.0/src/main/java/org/apache/phoenix/compat/hbase/CompatUtil.java
b/phoenix-hbase-compat-2.6.0/src/main/java/org/apache/phoenix/compat/hbase/CompatUtil.java
index e2bdc16d87..38a940aa43 100644
---
a/phoenix-hbase-compat-2.6.0/src/main/java/org/apache/phoenix/compat/hbase/CompatUtil.java
+++
b/phoenix-hbase-compat-2.6.0/src/main/java/org/apache/phoenix/compat/hbase/CompatUtil.java
@@ -19,18 +19,9 @@ package org.apache.phoenix.compat.hbase;
import java.io.IOException;
import java.util.List;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.CellComparator;
import org.apache.hadoop.hbase.MetaTableAccessor;
import org.apache.hadoop.hbase.client.Connection;
import org.apache.hadoop.hbase.client.RegionInfo;
-import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
-import org.apache.hadoop.hbase.io.compress.Compression.Algorithm;
-import org.apache.hadoop.hbase.io.encoding.DataBlockEncoding;
-import org.apache.hadoop.hbase.io.hfile.HFileContext;
-import org.apache.hadoop.hbase.io.hfile.HFileContextBuilder;
-import org.apache.hadoop.hbase.regionserver.StoreUtils;
-import org.apache.hadoop.hbase.util.ChecksumType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -42,30 +33,9 @@ public class CompatUtil {
// Not to be instantiated
}
- public static HFileContext createHFileContext(Configuration conf, Algorithm
compression,
- Integer blockSize, DataBlockEncoding encoding, CellComparator comparator) {
-
- return new HFileContextBuilder().withCompression(compression)
- .withChecksumType(StoreUtils.getChecksumType(conf))
-
.withBytesPerCheckSum(StoreUtils.getBytesPerChecksum(conf)).withBlockSize(blockSize)
- .withDataBlockEncoding(encoding).build();
- }
-
public static List<RegionInfo> getMergeRegions(Connection conn, RegionInfo
regionInfo)
throws IOException {
return MetaTableAccessor.getMergeRegions(conn, regionInfo);
}
- public static ChecksumType getChecksumType(Configuration conf) {
- return StoreUtils.getChecksumType(conf);
- }
-
- public static int getBytesPerChecksum(Configuration conf) {
- return StoreUtils.getBytesPerChecksum(conf);
- }
-
- public static Connection createShortCircuitConnection(final Configuration
configuration,
- final RegionCoprocessorEnvironment env) throws IOException {
- return env.createConnection(configuration);
- }
}
diff --git
a/phoenix-hbase-compat-2.6.0/src/main/java/org/apache/phoenix/compat/hbase/ReplicationSinkCompatEndpoint.java
b/phoenix-hbase-compat-2.6.0/src/main/java/org/apache/phoenix/compat/hbase/ReplicationSinkCompatEndpoint.java
deleted file mode 100644
index 08e73164e3..0000000000
---
a/phoenix-hbase-compat-2.6.0/src/main/java/org/apache/phoenix/compat/hbase/ReplicationSinkCompatEndpoint.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * 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 java.util.Optional;
-import org.apache.hadoop.hbase.client.Mutation;
-import org.apache.hadoop.hbase.coprocessor.ObserverContext;
-import org.apache.hadoop.hbase.coprocessor.RegionServerCoprocessor;
-import org.apache.hadoop.hbase.coprocessor.RegionServerCoprocessorEnvironment;
-import org.apache.hadoop.hbase.coprocessor.RegionServerObserver;
-
-import org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos;
-import org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos;
-
-/**
- * Replication Sink compat endpoint that helps attach WAL attributes to
mutation. In order to do so,
- * this endpoint utilizes regionserver hook
- * {@link #preReplicationSinkBatchMutate(ObserverContext,
AdminProtos.WALEntry, Mutation)}
- */
-public class ReplicationSinkCompatEndpoint
- implements RegionServerCoprocessor, RegionServerObserver {
-
- @Override
- public Optional<RegionServerObserver> getRegionServerObserver() {
- return Optional.of(this);
- }
-
- @Override
- public void
preReplicationSinkBatchMutate(ObserverContext<RegionServerCoprocessorEnvironment>
ctx,
- AdminProtos.WALEntry walEntry, Mutation mutation) throws IOException {
- RegionServerObserver.super.preReplicationSinkBatchMutate(ctx, walEntry,
mutation);
- List<WALProtos.Attribute> attributeList =
walEntry.getKey().getExtendedAttributesList();
- attachWALExtendedAttributesToMutation(mutation, attributeList);
- }
-
- private void attachWALExtendedAttributesToMutation(Mutation mutation,
- List<WALProtos.Attribute> attributeList) {
- if (attributeList != null) {
- for (WALProtos.Attribute attribute : attributeList) {
- mutation.setAttribute(attribute.getKey(),
attribute.getValue().toByteArray());
- }
- }
- }
-}