This is an automated email from the ASF dual-hosted git repository. stoty pushed a commit to branch 4.16 in repository https://gitbox.apache.org/repos/asf/phoenix.git
The following commit(s) were added to refs/heads/4.16 by this push: new 7558ed2 PHOENIX-6638 Test suite fails with -Dwithout.tephra 7558ed2 is described below commit 7558ed2c380c5e2e82c923a73114843aedddc700 Author: Istvan Toth <st...@apache.org> AuthorDate: Tue Feb 1 10:31:14 2022 +0100 PHOENIX-6638 Test suite fails with -Dwithout.tephra --- .../phoenix/transaction/TephraTransactionProvider.java | 10 +++++----- .../org/apache/phoenix/transaction/TransactionFactory.java | 13 ++++++++----- pom.xml | 12 ++++++++++-- 3 files changed, 23 insertions(+), 12 deletions(-) diff --git a/phoenix-core/src/main/java/org/apache/phoenix/transaction/TephraTransactionProvider.java b/phoenix-core/src/main/java/org/apache/phoenix/transaction/TephraTransactionProvider.java index f3ff188..9a216ee 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/transaction/TephraTransactionProvider.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/transaction/TephraTransactionProvider.java @@ -52,24 +52,24 @@ import com.google.inject.util.Providers; public class TephraTransactionProvider implements PhoenixTransactionProvider { private static final TephraTransactionProvider INSTANCE = new TephraTransactionProvider(); - + public static final TephraTransactionProvider getInstance() { return INSTANCE; } - + private TephraTransactionProvider() { } - + @Override public String toString() { return getProvider().toString(); } - + @Override public PhoenixTransactionContext getTransactionContext(byte[] txnBytes) throws IOException { return new TephraTransactionContext(txnBytes); } - + @Override public PhoenixTransactionContext getTransactionContext(PhoenixConnection connection) throws SQLException { return new TephraTransactionContext(connection); diff --git a/phoenix-core/src/main/java/org/apache/phoenix/transaction/TransactionFactory.java b/phoenix-core/src/main/java/org/apache/phoenix/transaction/TransactionFactory.java index ec55920..ab0d4c9 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/transaction/TransactionFactory.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/transaction/TransactionFactory.java @@ -18,20 +18,23 @@ package org.apache.phoenix.transaction; import java.io.IOException; -import java.util.List; import org.apache.phoenix.coprocessor.MetaDataProtocol; public class TransactionFactory { - private static PhoenixTransactionProvider tephraTransactionProvider; + private static final PhoenixTransactionProvider tephraTransactionProvider; static{ + boolean tephraEnabled = true; try { - tephraTransactionProvider = (PhoenixTransactionProvider) - Class.forName("org.apache.phoenix.transaction.TephraTransactionProvider") - .getMethod("getInstance").invoke(null); + Class.forName("org.apache.tephra.TransactionFailureException"); } catch (Throwable e) { + tephraEnabled = false; + } + if (tephraEnabled) { + tephraTransactionProvider = TephraTransactionProvider.getInstance(); + } else { tephraTransactionProvider = NotAvailableTransactionProvider.getInstance(); } } diff --git a/pom.xml b/pom.xml index 86fb020..fa66753 100644 --- a/pom.xml +++ b/pom.xml @@ -1251,7 +1251,11 @@ <artifactId>maven-failsafe-plugin</artifactId> <configuration> <classpathDependencyExcludes> - org.apache.tephra:tephra-api,org.apache.tephra:tephra-core,org.apache.thrift:libthrift + <classpathDependencyExclude>org.apache.tephra:tephra-api</classpathDependencyExclude> + <classpathDependencyExclude>org.apache.tephra:tephra-core-shaded</classpathDependencyExclude> + <classpathDependencyExclude>org.apache.tephra:tephra-core</classpathDependencyExclude> + <classpathDependencyExclude>org.apache.tephra:tephra-hbase-compat-${tephra.hbase.compat.version}</classpathDependencyExclude> + <classpathDependencyExclude>org.apache.thrift:libthrift</classpathDependencyExclude> </classpathDependencyExcludes> </configuration> </plugin> @@ -1260,7 +1264,11 @@ <artifactId>maven-surefire-plugin</artifactId> <configuration> <classpathDependencyExcludes> - org.apache.tephra:tephra-api,org.apache.tephra:tephra-core,org.apache.thrift:libthrift + <classpathDependencyExclude>org.apache.tephra:tephra-api</classpathDependencyExclude> + <classpathDependencyExclude>org.apache.tephra:tephra-core-shaded</classpathDependencyExclude> + <classpathDependencyExclude>org.apache.tephra:tephra-core</classpathDependencyExclude> + <classpathDependencyExclude>org.apache.tephra:tephra-hbase-compat-${tephra.hbase.compat.version}</classpathDependencyExclude> + <classpathDependencyExclude>org.apache.thrift:libthrift</classpathDependencyExclude> </classpathDependencyExcludes> </configuration> </plugin>