From e8fb2696d6154f20fd4d6e45ca58763e69145116 Mon Sep 17 00:00:00 2001 From: Simon Cheung Date: Tue, 5 Dec 2023 21:50:02 +0800 Subject: [PATCH 1/2] chore: fix curl failed to request https urls (#2378) --- hugegraph-server/hugegraph-dist/src/assembly/static/bin/util.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hugegraph-server/hugegraph-dist/src/assembly/static/bin/util.sh b/hugegraph-server/hugegraph-dist/src/assembly/static/bin/util.sh index 64980403b1..fa3f94a215 100755 --- a/hugegraph-server/hugegraph-dist/src/assembly/static/bin/util.sh +++ b/hugegraph-server/hugegraph-dist/src/assembly/static/bin/util.sh @@ -141,7 +141,7 @@ function wait_for_startup() { return 1 fi - status=$(curl -I -s -w "%{http_code}" -o /dev/null "$server_url") + status=$(curl -I -s -k -w "%{http_code}" -o /dev/null "$server_url") if [[ $status -eq 200 || $status -eq 401 ]]; then echo "OK" echo "Started [pid $pid]" From 47aa8be8508293bbda76c93b461292efc84a75c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=AE=87?= <940643974@qq.com> Date: Thu, 7 Dec 2023 12:26:22 +0800 Subject: [PATCH 2/2] refact(api): update common 1.2 & fix jersey client code problem (#2365) * update common version and fix rest client problem * use stage * fix dependency issue * test * test * test * test * fix * chore: improve the ci logic * fix core-version * Empty test * fix code issue * fix: 3rd party changes * code optimize * refactor the AbsJerseyRestClient * fix code issue --------- Co-authored-by: imbajin --- .github/configs/settings.xml | 2 + .github/workflows/check-dependencies.yml | 6 +- .github/workflows/ci.yml | 43 +++-- .github/workflows/codeql-analysis.yml | 6 +- .github/workflows/licence-checker.yml | 2 + .../api/gremlin/AbstractJerseyRestClient.java | 158 ++++++++++++++++++ .../hugegraph/api/gremlin/GremlinClient.java | 66 +++++--- .../apache/hugegraph/version/ApiVersion.java | 5 + hugegraph-server/hugegraph-core/pom.xml | 28 +++- .../apache/hugegraph/version/CoreVersion.java | 24 +-- .../scripts/dependency/check_dependencies.sh | 17 +- .../scripts/dependency/known-dependencies.txt | 12 +- .../src/assembly/travis/install-backend.sh | 2 + .../src/assembly/travis/install-cassandra.sh | 1 - .../src/assembly/travis/install-hbase.sh | 2 +- .../backend/store/palo/PaloHttpClient.java | 15 +- hugegraph-server/pom.xml | 2 +- 17 files changed, 301 insertions(+), 90 deletions(-) create mode 100644 hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/AbstractJerseyRestClient.java diff --git a/.github/configs/settings.xml b/.github/configs/settings.xml index 3fcc52dea3..294ded1cb2 100644 --- a/.github/configs/settings.xml +++ b/.github/configs/settings.xml @@ -5,7 +5,9 @@ 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. diff --git a/.github/workflows/check-dependencies.yml b/.github/workflows/check-dependencies.yml index 119d55bb52..5350d53fe6 100644 --- a/.github/workflows/check-dependencies.yml +++ b/.github/workflows/check-dependencies.yml @@ -5,7 +5,7 @@ on: branches: - /^release-.*$/ pull_request: - + permissions: contents: read @@ -17,7 +17,7 @@ jobs: SCRIPT_DEPENDENCY: hugegraph-server/hugegraph-dist/scripts/dependency steps: - name: Checkout source - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up JDK 11 uses: actions/setup-java@v3 with: @@ -44,7 +44,7 @@ jobs: runs-on: ubuntu-latest steps: - name: 'Checkout Repository' - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: 'Dependency Review' uses: actions/dependency-review-action@v3 # Refer: https://github.com/actions/dependency-review-action diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f6d276e90a..5907bffa30 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,48 +30,44 @@ jobs: JAVA_VERSION: [ '8', '11' ] steps: - - name: Install JDK ${{ matrix.JAVA_VERSION }} - uses: actions/setup-java@v3 - with: - java-version: ${{ matrix.JAVA_VERSION }} - distribution: 'zulu' - - - name: Cache Maven packages - uses: actions/cache@v3 - with: - path: ~/.m2 - key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} - restore-keys: ${{ runner.os }}-m2 - - name: Checkout uses: actions/checkout@v4 with: fetch-depth: 2 - - name: Compile - run: | - mvn clean compile -U -Dmaven.javadoc.skip=true -ntp - - - name: Install JDK 8 + # TODO: Remove this step after install-backend.sh updated + - name: Install Java8 for backend uses: actions/setup-java@v3 with: java-version: '8' distribution: 'zulu' - - name: Prepare env and service + + - name: Prepare backend environment run: | - $TRAVIS_DIR/install-backend.sh $BACKEND + $TRAVIS_DIR/install-backend.sh $BACKEND && jps -l - - name: Install JDK ${{ matrix.JAVA_VERSION }} + - name: Install Java ${{ matrix.JAVA_VERSION }} uses: actions/setup-java@v3 with: java-version: ${{ matrix.JAVA_VERSION }} distribution: 'zulu' - - name: use staged maven repo settings + - name: Cache Maven packages + uses: actions/cache@v3 + with: + path: ~/.m2 + key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-m2 + + - name: Use staged maven repo settings if: ${{ env.USE_STAGE == 'true' }} run: | cp $HOME/.m2/settings.xml /tmp/settings.xml - mv -vf .github/configs/settings.xml $HOME/.m2/settings.xml + cp -vf .github/configs/settings.xml $HOME/.m2/settings.xml && cat $HOME/.m2/settings.xml + + - name: Compile + run: | + mvn clean compile -U -Dmaven.javadoc.skip=true -ntp - name: Run unit test run: | @@ -99,4 +95,5 @@ jobs: - name: Upload coverage to Codecov uses: codecov/codecov-action@v3 with: + token: ${{ secrets.CODECOV_TOKEN }} file: ${{ env.REPORT_DIR }}/*.xml diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 958e5b1bdc..9165bfda94 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -4,8 +4,8 @@ on: push: branches: [ master, release-* ] pull_request: - # The branches below must be a subset of the branches above - # branches: [ master ] # enable in all PR + # The branches below must be a subset of the branches above + # branches: [ master ] # enable in all PRs schedule: - cron: '33 0 * * 5' @@ -27,7 +27,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Java JDK uses: actions/setup-java@v3 diff --git a/.github/workflows/licence-checker.yml b/.github/workflows/licence-checker.yml index 3d14cc0620..2510b44de1 100644 --- a/.github/workflows/licence-checker.yml +++ b/.github/workflows/licence-checker.yml @@ -10,6 +10,8 @@ on: jobs: check-license: runs-on: ubuntu-latest + env: + USE_STAGE: 'true' # Whether to include the stage repository. steps: - uses: actions/checkout@v4 diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/AbstractJerseyRestClient.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/AbstractJerseyRestClient.java new file mode 100644 index 0000000000..181abc46d5 --- /dev/null +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/AbstractJerseyRestClient.java @@ -0,0 +1,158 @@ +/* + * 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.hugegraph.api.gremlin; + +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; + +import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; +import org.apache.http.pool.PoolStats; +import org.apache.hugegraph.util.ExecutorUtil; +import org.glassfish.jersey.apache.connector.ApacheClientProperties; +import org.glassfish.jersey.apache.connector.ApacheConnectorProvider; +import org.glassfish.jersey.client.ClientConfig; +import org.glassfish.jersey.client.ClientProperties; +import org.glassfish.jersey.client.JerseyClientBuilder; +import org.glassfish.jersey.message.GZipEncoder; + +import jakarta.ws.rs.client.Client; +import jakarta.ws.rs.client.WebTarget; + +/** + * This class is a simplified class of AbstractRestClient from hugegraph-common. + * For some reason, we replace the rest implementation from jersey to okhttp. + * But GremlinClient still uses jersey-client to forward request, so we copy the old + * AbstractRestClient from hugegraph-common and rename the name to AbstractJerseyRestClient. + * Because we don't need the full feature of AbstractRestClient, so we reduce some useless code. + */ +public abstract class AbstractJerseyRestClient { + + /** + * Time unit: hour + */ + private static final long TTL = 24L; + /** + * Time unit: ms + */ + private static final long IDLE_TIME = 40L * 1000L; + private static final String PROPERTY_MAX_TOTAL = "maxTotal"; + private static final String PROPERTY_MAX_PER_ROUTE = "maxPerRoute"; + private static final String PROPERTY_IDLE_TIME = "idleTime"; + private static final String CONNECTION_MANAGER = ApacheClientProperties.CONNECTION_MANAGER; + + private final Client client; + private final WebTarget webTarget; + private final PoolingHttpClientConnectionManager pool; + private ScheduledExecutorService cleanExecutor; + + public AbstractJerseyRestClient(String url, int timeout, int maxTotal, int maxPerRoute) { + this(url, new ConfigBuilder().configTimeout(timeout) + .configPool(maxTotal, maxPerRoute) + .build()); + } + + public AbstractJerseyRestClient(String url, ClientConfig config) { + this.pool = configConnectionManager(config); + + this.client = JerseyClientBuilder.newClient(config); + this.client.register(GZipEncoder.class); + this.webTarget = this.client.target(url); + + cleanThreadPoolExecutor(config); + } + + private static PoolingHttpClientConnectionManager configConnectionManager(ClientConfig conf) { + /* + * Using httpclient with connection pooling, and configuring the + * jersey connector. But the jersey that has been released in the maven central + * repository seems to have a bug: https://github.com/jersey/jersey/pull/3752 + */ + PoolingHttpClientConnectionManager pool = + new PoolingHttpClientConnectionManager(TTL, TimeUnit.HOURS); + Integer maxTotal = (Integer) conf.getProperty(PROPERTY_MAX_TOTAL); + Integer maxPerRoute = (Integer) conf.getProperty(PROPERTY_MAX_PER_ROUTE); + + if (maxTotal != null) { + pool.setMaxTotal(maxTotal); + } + if (maxPerRoute != null) { + pool.setDefaultMaxPerRoute(maxPerRoute); + } + conf.property(CONNECTION_MANAGER, pool); + conf.connectorProvider(new ApacheConnectorProvider()); + return pool; + } + + private void cleanThreadPoolExecutor(ClientConfig config) { + this.cleanExecutor = ExecutorUtil.newScheduledThreadPool("conn-clean-worker-%d"); + Number idleTimeProp = (Number) config.getProperty(PROPERTY_IDLE_TIME); + final long idleTime = idleTimeProp == null ? IDLE_TIME : idleTimeProp.longValue(); + final long checkPeriod = idleTime / 2L; + this.cleanExecutor.scheduleWithFixedDelay(() -> { + PoolStats stats = this.pool.getTotalStats(); + int using = stats.getLeased() + stats.getPending(); + if (using > 0) { + // Do clean only when all connections are idle + return; + } + // Release connections when all clients are inactive + this.pool.closeIdleConnections(idleTime, TimeUnit.MILLISECONDS); + this.pool.closeExpiredConnections(); + }, checkPeriod, checkPeriod, TimeUnit.MILLISECONDS); + } + + protected WebTarget getWebTarget() { + return this.webTarget; + } + + public void close() { + try { + if (this.pool != null) { + this.pool.close(); + this.cleanExecutor.shutdownNow(); + } + } finally { + this.client.close(); + } + } + + private static class ConfigBuilder { + + private final ClientConfig config; + + ConfigBuilder() { + this.config = new ClientConfig(); + } + + public ConfigBuilder configTimeout(int timeout) { + this.config.property(ClientProperties.CONNECT_TIMEOUT, timeout); + this.config.property(ClientProperties.READ_TIMEOUT, timeout); + return this; + } + + public ConfigBuilder configPool(int maxTotal, int maxPerRoute) { + this.config.property(PROPERTY_MAX_TOTAL, maxTotal); + this.config.property(PROPERTY_MAX_PER_ROUTE, maxPerRoute); + return this; + } + + public ClientConfig build() { + return this.config; + } + } +} diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/GremlinClient.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/GremlinClient.java index 793884e4da..72af6e8cb1 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/GremlinClient.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/GremlinClient.java @@ -20,6 +20,9 @@ import java.util.List; import java.util.Map; +import org.apache.hugegraph.api.filter.CompressInterceptor; +import org.apache.hugegraph.util.E; + import jakarta.ws.rs.client.Entity; import jakarta.ws.rs.client.WebTarget; import jakarta.ws.rs.core.HttpHeaders; @@ -27,43 +30,52 @@ import jakarta.ws.rs.core.MultivaluedMap; import jakarta.ws.rs.core.Response; -import org.apache.hugegraph.api.filter.CompressInterceptor; -import org.apache.hugegraph.rest.AbstractRestClient; -import org.apache.hugegraph.testutil.Whitebox; -import org.apache.hugegraph.util.E; - -public class GremlinClient extends AbstractRestClient { - - private final WebTarget webTarget; +/** + * GremlinClient is a client for interacting with a Gremlin server. + * It extends the AbstractJerseyRestClient and provides methods for sending GET and POST requests. + */ +public class GremlinClient extends AbstractJerseyRestClient { - public GremlinClient(String url, int timeout, - int maxTotal, int maxPerRoute) { + /** + * Constructs a GremlinClient with the specified URL, timeout, maxTotal, and maxPerRoute. + * + * @param url The URL of the Gremlin server this client will interact with. + * @param timeout The timeout for the client. + * @param maxTotal The maximum total connections for the client. + * @param maxPerRoute The maximum connections per route for the client. + */ + public GremlinClient(String url, int timeout, int maxTotal, int maxPerRoute) { super(url, timeout, maxTotal, maxPerRoute); - this.webTarget = Whitebox.getInternalState(this, "target"); - E.checkNotNull(this.webTarget, "target"); - } - - @Override - protected void checkStatus(Response response, Response.Status... statuses) { - // pass } + /** + * Sends a POST request to the Gremlin server. + * + * @param auth The authorization token for the request. + * @param req The body of the request. + * @return The response from the server. + */ public Response doPostRequest(String auth, String req) { Entity body = Entity.entity(req, MediaType.APPLICATION_JSON); - return this.webTarget.request() - .header(HttpHeaders.AUTHORIZATION, auth) - .accept(MediaType.APPLICATION_JSON) - .acceptEncoding(CompressInterceptor.GZIP) - .post(body); + return this.getWebTarget().request() + .header(HttpHeaders.AUTHORIZATION, auth) + .accept(MediaType.APPLICATION_JSON) + .acceptEncoding(CompressInterceptor.GZIP) + .post(body); } - public Response doGetRequest(String auth, - MultivaluedMap params) { - WebTarget target = this.webTarget; + /** + * Sends a GET request to the Gremlin server. + * + * @param auth The authorization token for the request. + * @param params The query parameters for the request. + * @return The response from the server. + */ + public Response doGetRequest(String auth, MultivaluedMap params) { + WebTarget target = this.getWebTarget(); for (Map.Entry> entry : params.entrySet()) { E.checkArgument(entry.getValue().size() == 1, - "Invalid query param '%s', can only accept " + - "one value, but got %s", + "Invalid query param '%s', can only accept one value, but got %s", entry.getKey(), entry.getValue()); target = target.queryParam(entry.getKey(), entry.getValue().get(0)); } diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/version/ApiVersion.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/version/ApiVersion.java index a6b7f7c241..c75f65ab82 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/version/ApiVersion.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/version/ApiVersion.java @@ -20,6 +20,11 @@ import org.apache.hugegraph.util.VersionUtil; import org.apache.hugegraph.util.VersionUtil.Version; +/** + * This class represents the API version of the HugeGraph system. + * It contains a version number and a method to check the compatibility + * with the core version of the system. + */ public final class ApiVersion { /* diff --git a/hugegraph-server/hugegraph-core/pom.xml b/hugegraph-server/hugegraph-core/pom.xml index de312c9378..bdbb2ace43 100644 --- a/hugegraph-server/hugegraph-core/pom.xml +++ b/hugegraph-server/hugegraph-core/pom.xml @@ -14,8 +14,8 @@ License for the specific language governing permissions and limitations under the License. --> - 4.0.0 @@ -52,6 +52,23 @@ hugegraph-common + + + org.glassfish.jersey.core + jersey-client + ${jersey.version} + + + org.glassfish.jersey.connectors + jersey-apache-connector + ${jersey.version} + + + org.glassfish.jersey.inject + jersey-hk2 + ${jersey.version} + + org.apache.tinkerpop @@ -287,10 +304,13 @@ protobuf-maven-plugin 0.6.1 - com.google.protobuf:protoc:${protobuf.version}:exe:${os.detected.classifier} + + com.google.protobuf:protoc:${protobuf.version}:exe:${os.detected.classifier} + protoc-java ${project.basedir}/src/main/resources/proto - ${basedir}/target/generated-sources/protobuf/java + ${basedir}/target/generated-sources/protobuf/java + diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/version/CoreVersion.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/version/CoreVersion.java index 480236ffb6..46b84ebfe9 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/version/CoreVersion.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/version/CoreVersion.java @@ -22,22 +22,24 @@ public class CoreVersion { - static { - // Check versions of the dependency packages - CoreVersion.check(); - } - public static final String NAME = "hugegraph-core"; - public static final String DEFAULT_VERSION = "1.5.0"; - - // The second parameter of Version.of() is for IDE running without JAR + /** + * The second parameter of Version.of() is for IDE running without JAR + */ public static final Version VERSION = Version.of(CoreVersion.class, DEFAULT_VERSION); + /** + * Update it when the gremlin version changed, search "tinkerpop.version" in pom + */ + public static final String GREMLIN_VERSION = "3.5.1"; - public static final String GREMLIN_VERSION = "3.4.3"; + static { + // Check versions of the dependency packages + CoreVersion.check(); + } public static void check() { - // Check version of hugegraph-common - VersionUtil.check(CommonVersion.VERSION, "1.0", "1.1", CommonVersion.NAME); + // Check the version of hugegraph-common + VersionUtil.check(CommonVersion.VERSION, "1.0", "1.35", CommonVersion.NAME); } } diff --git a/hugegraph-server/hugegraph-dist/scripts/dependency/check_dependencies.sh b/hugegraph-server/hugegraph-dist/scripts/dependency/check_dependencies.sh index 309063faa5..024c05e35e 100644 --- a/hugegraph-server/hugegraph-dist/scripts/dependency/check_dependencies.sh +++ b/hugegraph-server/hugegraph-dist/scripts/dependency/check_dependencies.sh @@ -16,17 +16,20 @@ # under the License. # -BASE_PATH=$(cd $(dirname $0); pwd) +BASE_PATH=$( + cd "$(dirname "$0")" || exit 1 + pwd +) # check whether there are new third-party dependencies by diff command, # diff generated 'current-dependencies.txt' file with 'known-dependencies.txt' file. -diff -w -B -U0 <(sort < ${BASE_PATH}/known-dependencies.txt) \ -<(sort < ${BASE_PATH}/current-dependencies.txt) > ${BASE_PATH}/result.txt +diff -w -B -U0 <(sort <"${BASE_PATH}"/known-dependencies.txt) \ + <(sort <"${BASE_PATH}"/current-dependencies.txt) >${BASE_PATH}/result.txt # if has new third-party,the Action will fail and print diff -if [ -s ${BASE_PATH}/result.txt ]; then - cat ${BASE_PATH}/result.txt - exit 1 +if [ -s "${BASE_PATH}"/result.txt ]; then + cat "${BASE_PATH}"/result.txt + exit 1 else - echo 'All third dependencies is known!' + echo 'All third dependencies is known!' fi diff --git a/hugegraph-server/hugegraph-dist/scripts/dependency/known-dependencies.txt b/hugegraph-server/hugegraph-dist/scripts/dependency/known-dependencies.txt index 0069eea761..92e406a122 100644 --- a/hugegraph-server/hugegraph-dist/scripts/dependency/known-dependencies.txt +++ b/hugegraph-server/hugegraph-dist/scripts/dependency/known-dependencies.txt @@ -2,6 +2,7 @@ accessors-smart-1.2.jar airline-0.8.jar animal-sniffer-annotations-1.19.jar annotations-4.1.1.4.jar +annotations-13.0.jar ansj_seg-5.1.6.jar antlr-runtime-3.5.2.jar aopalliance-repackaged-3.0.1.jar @@ -45,6 +46,7 @@ commons-configuration2-2.8.0.jar commons-io-2.7.jar commons-lang-2.6.jar commons-lang3-3.11.jar +commons-lang3-3.12.0.jar commons-logging-1.1.1.jar commons-logging-1.2.jar commons-math3-3.2.jar @@ -127,6 +129,7 @@ jackson-jaxrs-base-2.14.0-rc1.jar jackson-jaxrs-json-provider-2.14.0-rc1.jar jackson-module-jakarta-xmlbind-annotations-2.15.2.jar jackson-module-jaxb-annotations-2.14.0-rc1.jar +jakarta.activation-2.0.0.jar jakarta.activation-2.0.1.jar jakarta.activation-api-1.2.2.jar jakarta.annotation-api-2.0.0.jar @@ -134,7 +137,7 @@ jakarta.inject-api-2.0.0.jar jakarta.servlet-api-5.0.0.jar jakarta.validation-api-3.0.0.jar jakarta.ws.rs-api-3.0.0.jar -jakarta.xml.bind-api-4.0.0-RC2.jar +jakarta.xml.bind-api-3.0.0.jar jamm-0.3.2.jar java-cup-runtime-11b-20160615.jar javapoet-1.8.0.jar @@ -201,10 +204,15 @@ kerby-config-2.0.0.jar kerby-pkix-2.0.0.jar kerby-util-2.0.0.jar kerby-xdr-2.0.0.jar +kotlin-stdlib-1.6.20.jar +kotlin-stdlib-common-1.5.31.jar +kotlin-stdlib-jdk7-1.6.10.jar +kotlin-stdlib-jdk8-1.6.10.jar listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar log4j-api-2.17.1.jar log4j-core-2.17.1.jar log4j-slf4j-impl-2.17.1.jar +logging-interceptor-4.10.0.jar lookout-api-1.4.1.jar lucene-analyzers-common-8.11.2.jar lucene-analyzers-smartcn-8.11.2.jar @@ -232,6 +240,8 @@ nlp-lang-1.7.7.jar objenesis-2.6.jar ohc-core-0.7.4.jar ohc-core-j8-0.5.1.jar +okhttp-4.10.0.jar +okio-jvm-3.0.0.jar opentracing-api-0.22.0.jar opentracing-mock-0.22.0.jar opentracing-noop-0.22.0.jar diff --git a/hugegraph-server/hugegraph-dist/src/assembly/travis/install-backend.sh b/hugegraph-server/hugegraph-dist/src/assembly/travis/install-backend.sh index 64c53a875b..21e2f11e6b 100755 --- a/hugegraph-server/hugegraph-dist/src/assembly/travis/install-backend.sh +++ b/hugegraph-server/hugegraph-dist/src/assembly/travis/install-backend.sh @@ -31,12 +31,14 @@ fi case $BACKEND in cassandra) + # TODO: replace it with docker "$TRAVIS_DIR"/install-cassandra.sh ;; scylladb) "$TRAVIS_DIR"/install-scylladb.sh ;; hbase) + # TODO: replace it with hbase2.3+ to avoid java8 env "$TRAVIS_DIR"/install-hbase.sh ;; mysql) diff --git a/hugegraph-server/hugegraph-dist/src/assembly/travis/install-cassandra.sh b/hugegraph-server/hugegraph-dist/src/assembly/travis/install-cassandra.sh index 2bdfe0bf6a..d83d890dee 100755 --- a/hugegraph-server/hugegraph-dist/src/assembly/travis/install-cassandra.sh +++ b/hugegraph-server/hugegraph-dist/src/assembly/travis/install-cassandra.sh @@ -17,7 +17,6 @@ # set -ev -TRAVIS_DIR=`dirname $0` CASS_DOWNLOAD_ADDRESS="http://archive.apache.org/dist/cassandra" CASS_VERSION="4.0.10" CASS_PACKAGE="apache-cassandra-${CASS_VERSION}" diff --git a/hugegraph-server/hugegraph-dist/src/assembly/travis/install-hbase.sh b/hugegraph-server/hugegraph-dist/src/assembly/travis/install-hbase.sh index 9de48f277e..bdee3e75ab 100755 --- a/hugegraph-server/hugegraph-dist/src/assembly/travis/install-hbase.sh +++ b/hugegraph-server/hugegraph-dist/src/assembly/travis/install-hbase.sh @@ -17,7 +17,7 @@ # set -ev -TRAVIS_DIR=`dirname $0` +TRAVIS_DIR=$(dirname $0) HBASE_DOWNLOAD_ADDRESS="http://archive.apache.org/dist/hbase" HBASE_VERSION="2.0.2" HBASE_PACKAGE="hbase-${HBASE_VERSION}" diff --git a/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloHttpClient.java b/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloHttpClient.java index 8ee2f94129..281746e2ee 100644 --- a/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloHttpClient.java +++ b/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloHttpClient.java @@ -19,15 +19,15 @@ import java.util.Map; -import jakarta.ws.rs.core.MultivaluedHashMap; -import jakarta.ws.rs.core.MultivaluedMap; -import jakarta.ws.rs.core.Response; - import org.apache.hugegraph.config.HugeConfig; import org.apache.hugegraph.rest.AbstractRestClient; import org.apache.hugegraph.rest.RestClient; +import org.apache.hugegraph.rest.RestHeaders; + import com.google.common.collect.ImmutableMap; +import okhttp3.Response; + public class PaloHttpClient { private final RestClient client; @@ -51,8 +51,8 @@ public void bulkLoadAsync(String table, String body, String label) { // Format path String path = table + "/_load"; // Format headers - MultivaluedMap headers = new MultivaluedHashMap<>(); - headers.putSingle("Expect", "100-continue"); + RestHeaders headers = new RestHeaders(); + headers.add("Expect", "100-continue"); // Format params Map params = ImmutableMap.of("label", label); // Send request @@ -68,8 +68,7 @@ public Client(String url, String user, String password, int timeout) { } @Override - protected void checkStatus(Response response, - Response.Status... statuses) { + protected void checkStatus(Response response, int... statuses) { // pass } } diff --git a/hugegraph-server/pom.xml b/hugegraph-server/pom.xml index 6ab44d9bd0..2d5a51cb99 100644 --- a/hugegraph-server/pom.xml +++ b/hugegraph-server/pom.xml @@ -57,7 +57,7 @@ bash 3.1.2 8.45 - 1.0.0 + 1.2.0 1.47.0 3.21.7 1.36