From 8601254fbab93b1f8cd5f3352f271bb0e84de191 Mon Sep 17 00:00:00 2001 From: legendPei <804141866@qq.com> Date: Sat, 25 Jul 2026 16:00:43 +0800 Subject: [PATCH 01/15] feat(server): remove legacy backends --- .../src/main/resources/jar.txt | 5 - hugegraph-server/AGENTS.md | 13 +- hugegraph-server/hugegraph-api/pom.xml | 2 +- hugegraph-server/hugegraph-cassandra/pom.xml | 108 -- .../driver/core/querybuilder/Clauses.java | 88 -- .../cassandra/CassandraBackendEntry.java | 41 - .../cassandra/CassandraEntryIterator.java | 195 ---- .../store/cassandra/CassandraFeatures.java | 137 --- .../store/cassandra/CassandraMetrics.java | 324 ------ .../store/cassandra/CassandraOptions.java | 176 ---- .../store/cassandra/CassandraSerializer.java | 225 ---- .../store/cassandra/CassandraSessionPool.java | 494 --------- .../store/cassandra/CassandraShard.java | 319 ------ .../store/cassandra/CassandraStore.java | 814 -------------- .../cassandra/CassandraStoreProvider.java | 75 -- .../store/cassandra/CassandraTable.java | 679 ------------ .../store/cassandra/CassandraTables.java | 995 ------------------ .../hugegraph/backend/query/Condition.java | 4 +- .../apache/hugegraph/backend/store/Shard.java | 2 +- .../backend/tx/GraphTransaction.java | 5 +- .../apache/hugegraph/config/CoreOptions.java | 4 +- .../security/HugeSecurityManager.java | 41 +- .../apache/hugegraph/task/TaskCallable.java | 10 +- .../example/docker-compose-cassandra.yml | 61 -- hugegraph-server/hugegraph-dist/pom.xml | 31 - .../src/assembly/static/conf/log4j2.xml | 6 - .../src/assembly/travis/install-backend.sh | 17 - .../src/assembly/travis/install-cassandra.sh | 44 - .../travis/install-mysql-via-docker.sh | 34 - .../src/assembly/travis/install-mysql.sh | 38 - .../travis/install-postgresql-via-docker.sh | 36 - .../src/assembly/travis/install-postgresql.sh | 33 - .../src/assembly/travis/install-scylladb.sh | 65 -- .../src/assembly/travis/mysql.cnf | 37 - .../src/assembly/travis/run-api-test.sh | 4 - .../org/apache/hugegraph/cmd/InitStore.java | 4 +- .../src/main/resources/log4j2.xml | 8 - .../apache/hugegraph/example/Example1.java | 2 +- .../hugegraph/example/PerfExample1.java | 13 +- .../hugegraph/example/PerfExample2.java | 13 +- .../src/main/resources/log4j2.xml | 8 - hugegraph-server/hugegraph-mysql/pom.xml | 49 - .../store/mysql/MysqlBackendEntry.java | 41 - .../store/mysql/MysqlEntryIterator.java | 197 ---- .../backend/store/mysql/MysqlFeatures.java | 131 --- .../backend/store/mysql/MysqlMetrics.java | 32 - .../backend/store/mysql/MysqlOptions.java | 117 -- .../backend/store/mysql/MysqlSerializer.java | 175 --- .../backend/store/mysql/MysqlSessions.java | 546 ---------- .../backend/store/mysql/MysqlStore.java | 513 --------- .../store/mysql/MysqlStoreProvider.java | 76 -- .../backend/store/mysql/MysqlTable.java | 847 --------------- .../backend/store/mysql/MysqlTables.java | 667 ------------ .../backend/store/mysql/MysqlUtil.java | 129 --- .../backend/store/mysql/ResultSetWrapper.java | 62 -- .../backend/store/mysql/WhereBuilder.java | 295 ------ hugegraph-server/hugegraph-palo/pom.xml | 50 - .../backend/store/palo/PaloFeatures.java | 134 --- .../backend/store/palo/PaloFile.java | 192 ---- .../backend/store/palo/PaloHttpClient.java | 75 -- .../backend/store/palo/PaloLoadInfo.java | 190 ---- .../backend/store/palo/PaloOptions.java | 108 -- .../backend/store/palo/PaloSerializer.java | 45 - .../backend/store/palo/PaloSessions.java | 317 ------ .../backend/store/palo/PaloStore.java | 50 - .../backend/store/palo/PaloStoreProvider.java | 175 --- .../backend/store/palo/PaloTable.java | 113 -- .../backend/store/palo/PaloTables.java | 472 --------- hugegraph-server/hugegraph-postgresql/pom.xml | 48 - .../store/postgresql/PostgresqlOptions.java | 49 - .../postgresql/PostgresqlSerializer.java | 58 - .../store/postgresql/PostgresqlSessions.java | 135 --- .../store/postgresql/PostgresqlStore.java | 35 - .../postgresql/PostgresqlStoreProvider.java | 221 ---- .../store/postgresql/PostgresqlTable.java | 170 --- .../store/postgresql/PostgresqlTables.java | 291 ----- hugegraph-server/hugegraph-scylladb/pom.xml | 39 - .../store/scylladb/ScyllaDBFeatures.java | 33 - .../store/scylladb/ScyllaDBMetrics.java | 69 -- .../store/scylladb/ScyllaDBStoreProvider.java | 173 --- .../store/scylladb/ScyllaDBTablesWithMV.java | 301 ------ hugegraph-server/hugegraph-test/pom.xml | 27 - .../apache/hugegraph/api/MetricsApiTest.java | 124 --- .../apache/hugegraph/core/EdgeCoreTest.java | 39 +- .../apache/hugegraph/core/VertexCoreTest.java | 39 +- .../apache/hugegraph/tinkerpop/TestGraph.java | 2 +- .../apache/hugegraph/unit/UnitTestSuite.java | 10 - .../unit/cassandra/CassandraTest.java | 437 -------- .../hugegraph/unit/mysql/MysqlUtilTest.java | 59 -- .../unit/mysql/WhereBuilderTest.java | 123 --- .../src/main/resources/log4j2.xml | 8 - hugegraph-server/pom.xml | 5 - install-dist/release-docs/LICENSE | 3 - install-dist/release-docs/NOTICE | 40 - .../licenses/LICENSE-cassandra-all-4.0.10.txt | 240 ----- .../LICENSE-cassandra-driver-core-3.6.0.txt | 202 ---- .../licenses/LICENSE-postgresql-42.4.3.txt | 33 - .../scripts/dependency/known-dependencies.txt | 3 - 98 files changed, 39 insertions(+), 13985 deletions(-) delete mode 100644 hugegraph-server/hugegraph-cassandra/pom.xml delete mode 100644 hugegraph-server/hugegraph-cassandra/src/main/java/com/datastax/driver/core/querybuilder/Clauses.java delete mode 100644 hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraBackendEntry.java delete mode 100644 hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraEntryIterator.java delete mode 100644 hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraFeatures.java delete mode 100644 hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraMetrics.java delete mode 100644 hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraOptions.java delete mode 100644 hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraSerializer.java delete mode 100644 hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraSessionPool.java delete mode 100644 hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraShard.java delete mode 100644 hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraStore.java delete mode 100644 hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraStoreProvider.java delete mode 100644 hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraTable.java delete mode 100644 hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraTables.java delete mode 100644 hugegraph-server/hugegraph-dist/docker/example/docker-compose-cassandra.yml delete mode 100755 hugegraph-server/hugegraph-dist/src/assembly/travis/install-cassandra.sh delete mode 100755 hugegraph-server/hugegraph-dist/src/assembly/travis/install-mysql-via-docker.sh delete mode 100755 hugegraph-server/hugegraph-dist/src/assembly/travis/install-mysql.sh delete mode 100755 hugegraph-server/hugegraph-dist/src/assembly/travis/install-postgresql-via-docker.sh delete mode 100755 hugegraph-server/hugegraph-dist/src/assembly/travis/install-postgresql.sh delete mode 100755 hugegraph-server/hugegraph-dist/src/assembly/travis/install-scylladb.sh delete mode 100644 hugegraph-server/hugegraph-dist/src/assembly/travis/mysql.cnf delete mode 100644 hugegraph-server/hugegraph-mysql/pom.xml delete mode 100644 hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlBackendEntry.java delete mode 100644 hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlEntryIterator.java delete mode 100644 hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlFeatures.java delete mode 100644 hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlMetrics.java delete mode 100644 hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlOptions.java delete mode 100644 hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlSerializer.java delete mode 100644 hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlSessions.java delete mode 100644 hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlStore.java delete mode 100644 hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlStoreProvider.java delete mode 100644 hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlTable.java delete mode 100644 hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlTables.java delete mode 100644 hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlUtil.java delete mode 100644 hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/ResultSetWrapper.java delete mode 100644 hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/WhereBuilder.java delete mode 100644 hugegraph-server/hugegraph-palo/pom.xml delete mode 100644 hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloFeatures.java delete mode 100644 hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloFile.java delete mode 100644 hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloHttpClient.java delete mode 100644 hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloLoadInfo.java delete mode 100644 hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloOptions.java delete mode 100644 hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloSerializer.java delete mode 100644 hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloSessions.java delete mode 100644 hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloStore.java delete mode 100644 hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloStoreProvider.java delete mode 100644 hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloTable.java delete mode 100644 hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloTables.java delete mode 100644 hugegraph-server/hugegraph-postgresql/pom.xml delete mode 100644 hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlOptions.java delete mode 100644 hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlSerializer.java delete mode 100644 hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlSessions.java delete mode 100644 hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlStore.java delete mode 100644 hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlStoreProvider.java delete mode 100644 hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlTable.java delete mode 100644 hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlTables.java delete mode 100644 hugegraph-server/hugegraph-scylladb/pom.xml delete mode 100644 hugegraph-server/hugegraph-scylladb/src/main/java/org/apache/hugegraph/backend/store/scylladb/ScyllaDBFeatures.java delete mode 100644 hugegraph-server/hugegraph-scylladb/src/main/java/org/apache/hugegraph/backend/store/scylladb/ScyllaDBMetrics.java delete mode 100644 hugegraph-server/hugegraph-scylladb/src/main/java/org/apache/hugegraph/backend/store/scylladb/ScyllaDBStoreProvider.java delete mode 100644 hugegraph-server/hugegraph-scylladb/src/main/java/org/apache/hugegraph/backend/store/scylladb/ScyllaDBTablesWithMV.java delete mode 100644 hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/cassandra/CassandraTest.java delete mode 100644 hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/mysql/MysqlUtilTest.java delete mode 100644 hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/mysql/WhereBuilderTest.java delete mode 100644 install-dist/release-docs/licenses/LICENSE-cassandra-all-4.0.10.txt delete mode 100644 install-dist/release-docs/licenses/LICENSE-cassandra-driver-core-3.6.0.txt delete mode 100644 install-dist/release-docs/licenses/LICENSE-postgresql-42.4.3.txt diff --git a/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/resources/jar.txt b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/resources/jar.txt index 7a566545ce..596b6f5340 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/resources/jar.txt +++ b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/resources/jar.txt @@ -1,14 +1,9 @@ hugegraph-api-${revision}.jar -hugegraph-cassandra-${revision}.jar hugegraph-common-${revision}.jar hugegraph-core-${revision}.jar hugegraph-dist-${revision}.jar hugegraph-hbase-${revision}.jar hugegraph-hstore-${revision}.jar -hugegraph-mysql-${revision}.jar -hugegraph-palo-${revision}.jar -hugegraph-postgresql-${revision}.jar hugegraph-rocksdb-${revision}.jar hugegraph-rpc-${revision}.jar -hugegraph-scylladb-${revision}.jar hugegraph-struct-${revision}.jar diff --git a/hugegraph-server/AGENTS.md b/hugegraph-server/AGENTS.md index c5b58591cb..0365dd6965 100644 --- a/hugegraph-server/AGENTS.md +++ b/hugegraph-server/AGENTS.md @@ -8,7 +8,7 @@ HugeGraph Server is the graph engine layer of Apache HugeGraph, consisting of: - **REST API Layer** (hugegraph-api): RESTful APIs for graph operations, Gremlin/Cypher queries, schema management, and authentication - **Graph Engine Layer** (hugegraph-core): TinkerPop 3 implementation, schema management, traversal optimization, task scheduling - **Backend Interface**: Abstraction layer for pluggable storage backends -- **Storage Backend Implementations**: RocksDB (default), HStore (distributed), and legacy backends (MySQL, PostgreSQL, Cassandra, ScyllaDB, HBase, Palo) +- **Storage Backend Implementations**: RocksDB (default), HStore (distributed), HBase, and Memory Technology: Java 11+, Maven 3.5+, Apache TinkerPop 3.5.1, Jersey 3.0 (REST), gRPC (distributed communication) @@ -50,7 +50,7 @@ mvn checkstyle:check - `memory`: In-memory backend (default for tests) - `rocksdb`: RocksDB backend - `hbase`: HBase backend -- `mysql`, `postgresql`, `cassandra`, `scylladb`, `palo`: Other backends +- `hstore`: HStore backend ```bash # Unit tests (from hugegraph-server/) @@ -78,7 +78,7 @@ All tests are in `hugegraph-test/` which depends on all other modules. Tests are ## Module Structure -Multi-module Maven project with 13 submodules: +Multi-module Maven project with 8 submodules: ``` hugegraph-server/ @@ -86,12 +86,7 @@ hugegraph-server/ ├── hugegraph-api # REST API, Gremlin/Cypher endpoints, authentication ├── hugegraph-rocksdb # RocksDB backend (default, embedded) ├── hugegraph-hstore # HStore backend (distributed, production) -├── hugegraph-mysql # MySQL backend (legacy) -├── hugegraph-postgresql # PostgreSQL backend (legacy) -├── hugegraph-cassandra # Cassandra backend (legacy) -├── hugegraph-scylladb # ScyllaDB backend (legacy) -├── hugegraph-hbase # HBase backend (legacy) -├── hugegraph-palo # Palo backend (legacy) +├── hugegraph-hbase # HBase backend ├── hugegraph-dist # Distribution packaging, scripts, configs ├── hugegraph-test # All test suites └── hugegraph-example # Example code diff --git a/hugegraph-server/hugegraph-api/pom.xml b/hugegraph-server/hugegraph-api/pom.xml index 8fd6821ca9..f1a8b918bd 100644 --- a/hugegraph-server/hugegraph-api/pom.xml +++ b/hugegraph-server/hugegraph-api/pom.xml @@ -70,7 +70,7 @@ com.alipay.sofa hessian - + io.netty netty-all diff --git a/hugegraph-server/hugegraph-cassandra/pom.xml b/hugegraph-server/hugegraph-cassandra/pom.xml deleted file mode 100644 index a99dbf4a62..0000000000 --- a/hugegraph-server/hugegraph-cassandra/pom.xml +++ /dev/null @@ -1,108 +0,0 @@ - - - - - org.apache.hugegraph - hugegraph-server - ${revision} - ../pom.xml - - 4.0.0 - - hugegraph-cassandra - - - - org.apache.hugegraph - hugegraph-core - ${revision} - - - org.apache.cassandra - cassandra-all - 4.0.10 - - - org.slf4j - log4j-over-slf4j - - - org.slf4j - jcl-over-slf4j - - - ch.qos.logback - logback-core - - - ch.qos.logback - logback-classic - - - it.unimi.dsi - fastutil - - - org.apache.cassandra - cassandra-thrift - - - org.eclipse.jdt.core.compiler - ecj - - - org.jboss.logging - jboss-logging - - - - - com.datastax.cassandra - cassandra-driver-core - 3.6.0 - - - io.netty - netty-handler - - - com.github.jnr - jnr-posix - - - - - - io.netty - netty-all - 4.1.44.Final - - - - - - - org.apache.maven.plugins - maven-clean-plugin - - - - - diff --git a/hugegraph-server/hugegraph-cassandra/src/main/java/com/datastax/driver/core/querybuilder/Clauses.java b/hugegraph-server/hugegraph-cassandra/src/main/java/com/datastax/driver/core/querybuilder/Clauses.java deleted file mode 100644 index 502fb152b8..0000000000 --- a/hugegraph-server/hugegraph-cassandra/src/main/java/com/datastax/driver/core/querybuilder/Clauses.java +++ /dev/null @@ -1,88 +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 com.datastax.driver.core.querybuilder; - -import java.util.List; - -import com.datastax.driver.core.CodecRegistry; -import com.datastax.driver.core.querybuilder.Clause.ContainsClause; -import com.datastax.driver.core.querybuilder.Clause.ContainsKeyClause; - -public class Clauses { - - public static boolean needAllowFiltering(Clause clause) { - return clause instanceof ContainsKeyClause || clause instanceof ContainsClause; - } - - public static Clause and(Clause left, Clause right) { - return new AndClause(left, right); - } - - public static Clause in(String name, List values) { - return new Clause.InClause(name, values); - } - - static class BinClause extends Clause { - - private final Clause left; - private final String op; - private final Clause right; - - public BinClause(Clause left, String op, Clause right) { - this.left = left; - this.op = op; - this.right = right; - } - - @Override - String name() { - return null; - } - - @Override - Object firstValue() { - return null; - } - - @Override - boolean containsBindMarker() { - return Utils.containsBindMarker(this.left) || Utils.containsBindMarker(this.right); - } - - @Override - void appendTo(StringBuilder sb, List variables, - CodecRegistry codecRegistry) { - // NOTE: '(? AND ?)' is not supported by Cassandra: - // SyntaxError: line xx missing ')' at 'AND' - // sb.append("("); - this.left.appendTo(sb, variables, codecRegistry); - sb.append(" "); - sb.append(this.op); - sb.append(" "); - this.right.appendTo(sb, variables, codecRegistry); - // sb.append(")"); - } - } - - static class AndClause extends BinClause { - - public AndClause(Clause left, Clause right) { - super(left, "AND", right); - } - } -} diff --git a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraBackendEntry.java b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraBackendEntry.java deleted file mode 100644 index 18a923b10e..0000000000 --- a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraBackendEntry.java +++ /dev/null @@ -1,41 +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.hugegraph.backend.store.cassandra; - -import org.apache.hugegraph.backend.id.Id; -import org.apache.hugegraph.backend.serializer.TableBackendEntry; -import org.apache.hugegraph.type.HugeType; - -public class CassandraBackendEntry extends TableBackendEntry { - - public CassandraBackendEntry(Id id) { - super(id); - } - - public CassandraBackendEntry(HugeType type) { - this(type, null); - } - - public CassandraBackendEntry(HugeType type, Id id) { - this(new Row(type, id)); - } - - public CassandraBackendEntry(TableBackendEntry.Row row) { - super(row); - } -} diff --git a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraEntryIterator.java b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraEntryIterator.java deleted file mode 100644 index 2f057007f1..0000000000 --- a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraEntryIterator.java +++ /dev/null @@ -1,195 +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.hugegraph.backend.store.cassandra; - -import java.util.Iterator; -import java.util.List; -import java.util.function.BiFunction; - -import org.apache.hugegraph.backend.page.PageState; -import org.apache.hugegraph.backend.query.Query; -import org.apache.hugegraph.backend.store.BackendEntry; -import org.apache.hugegraph.backend.store.BackendEntryIterator; -import org.apache.hugegraph.util.E; - -import com.datastax.driver.core.ExecutionInfo; -import com.datastax.driver.core.PagingState; -import com.datastax.driver.core.ResultSet; -import com.datastax.driver.core.Row; - -public class CassandraEntryIterator extends BackendEntryIterator { - - private final ResultSet results; - private final Iterator rows; - private final BiFunction merger; - - private int fetchedPageSize; - private long expected; - private BackendEntry next; - - public CassandraEntryIterator(ResultSet results, Query query, - BiFunction merger) { - super(query); - this.results = results; - this.rows = results.iterator(); - this.merger = merger; - - this.fetchedPageSize = results.getAvailableWithoutFetching(); - this.next = null; - - if (query.paging()) { - assert query.offset() == 0L; - assert query.limit() >= 0L || query.noLimit() : query.limit(); - // Skip page offset - this.expected = PageState.fromString(query.page()).offset(); - this.skipPageOffset(query.page()); - // Check the number of available rows - E.checkState(this.fetchedPageSize <= query.limit(), - "Unexpected fetched page size: %s", - this.fetchedPageSize); - if (results.isFullyFetched()) { - /* - * All results fetched - * NOTE: it may be enough or not enough for the entire page - */ - this.expected = this.fetchedPageSize; - } else { - /* - * Not fully fetched, that's fetchedPageSize == query.limit(), - * - * NOTE: but there may be fetchedPageSize < query.limit(), means - * not fetched the entire page (ScyllaDB may go here #1340), - * try to fetch next page later until got the expected count. - * Can simulate by: `select.setFetchSize(total - 1)` - */ - this.expected = query.total(); - } - } else { - this.expected = query.total(); - this.skipOffset(); - } - } - - @Override - public void close() throws Exception { - // pass - } - - @Override - protected final boolean fetch() { - assert this.current == null; - if (this.next != null) { - this.current = this.next; - this.next = null; - } - - while (this.expected > 0L && this.rows.hasNext()) { - // Limit expected count, due to rows.hasNext() will fetch next page - this.expected--; - Row row = this.rows.next(); - if (this.query.paging()) { - // Update fetchedPageSize if auto fetch the next page - if (this.expected > 0L && this.availableLocal() == 0) { - if (this.rows.hasNext()) { - this.fetchedPageSize = this.availableLocal(); - } - } - } - BackendEntry merged = this.merger.apply(this.current, row); - if (this.current == null) { - // The first time to read - this.current = merged; - } else if (merged == this.current) { - // The next entry belongs to the current entry - assert merged != null; - } else { - // New entry - assert this.next == null; - this.next = merged; - break; - } - } - return this.current != null; - } - - @Override - protected final long sizeOf(BackendEntry entry) { - CassandraBackendEntry e = (CassandraBackendEntry) entry; - int subRowsSize = e.subRows().size(); - return subRowsSize > 0 ? subRowsSize : 1L; - } - - @Override - protected final long skip(BackendEntry entry, long skip) { - CassandraBackendEntry e = (CassandraBackendEntry) entry; - E.checkState(e.subRows().size() > skip, "Invalid entry to skip"); - for (long i = 0; i < skip; i++) { - e.subRows().remove(0); - } - return e.subRows().size(); - } - - @Override - protected PageState pageState() { - byte[] position; - int offset = 0; - int count = (int) this.count(); - assert this.fetched() == count; - int extra = this.availableLocal(); - List infos = this.results.getAllExecutionInfo(); - if (extra > 0 && infos.size() >= 2) { - /* - * Go back to the previous page if there are still available - * results fetched to local memory but not consumed, and set page - * offset with consumed amount of results. - * - * Safely, we should get the remaining size of the current page by: - * `Whitebox.getInternalState(results, "currentPage").size()` - * instead of - * `results.getAvailableWithoutFetching()` - */ - ExecutionInfo previous = infos.get(infos.size() - 2); - PagingState page = previous.getPagingState(); - position = page.toBytes(); - offset = this.fetchedPageSize - extra; - } else { - PagingState page = this.results.getExecutionInfo().getPagingState(); - if (page == null || this.expected > 0L) { - // Call isExhausted() will lead to try to fetch the next page - E.checkState(this.results.isExhausted(), - "Unexpected paging state with expected=%s, " + - "ensure consume all the fetched results before " + - "calling pageState()", this.expected); - position = PageState.EMPTY_BYTES; - } else { - /* - * Exist page position which used to fetch the next page. - * Maybe it happens to the last page (that's the position is - * at the end of results and next page is empty) - */ - position = page.toBytes(); - } - } - - return new PageState(position, offset, count); - } - - private int availableLocal() { - return this.results.getAvailableWithoutFetching(); - } -} diff --git a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraFeatures.java b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraFeatures.java deleted file mode 100644 index 0993fde1be..0000000000 --- a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraFeatures.java +++ /dev/null @@ -1,137 +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.hugegraph.backend.store.cassandra; - -import org.apache.hugegraph.backend.store.BackendFeatures; - -public class CassandraFeatures implements BackendFeatures { - - @Override - public boolean supportsFatherAndSubEdgeLabel() { - return false; - } - - @Override - public boolean supportsScanToken() { - return true; - } - - @Override - public boolean supportsScanKeyPrefix() { - return false; - } - - @Override - public boolean supportsScanKeyRange() { - return false; - } - - @Override - public boolean supportsQuerySchemaByName() { - // Cassandra support secondary index - return true; - } - - @Override - public boolean supportsQueryByLabel() { - // Cassandra support secondary index - return true; - } - - @Override - public boolean supportsQueryWithInCondition() { - return true; - } - - @Override - public boolean supportsQueryWithRangeCondition() { - return true; - } - - @Override - public boolean supportsQueryWithOrderBy() { - return true; - } - - @Override - public boolean supportsQueryWithContains() { - return true; - } - - @Override - public boolean supportsQueryWithContainsKey() { - return true; - } - - @Override - public boolean supportsQueryByPage() { - return true; - } - - @Override - public boolean supportsQuerySortByInputIds() { - return false; - } - - @Override - public boolean supportsDeleteEdgeByLabel() { - return true; - } - - @Override - public boolean supportsUpdateVertexProperty() { - return true; - } - - @Override - public boolean supportsMergeVertexProperty() { - return false; - } - - @Override - public boolean supportsUpdateEdgeProperty() { - return true; - } - - @Override - public boolean supportsTransaction() { - // Cassandra support tx(atomicity level) with batch API - // https://docs.datastax.com/en/cassandra/2.1/cassandra/dml/dml_atomicity_c.html - return true; - } - - @Override - public boolean supportsNumberType() { - return true; - } - - @Override - public boolean supportsAggregateProperty() { - return false; - } - - @Override - public boolean supportsTtl() { - return true; - } - - @Override - public boolean supportsOlapProperties() { - return true; - } -} diff --git a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraMetrics.java b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraMetrics.java deleted file mode 100644 index 400efd024c..0000000000 --- a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraMetrics.java +++ /dev/null @@ -1,324 +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.hugegraph.backend.store.cassandra; - -import java.io.IOException; -import java.lang.management.MemoryUsage; -import java.net.Inet4Address; -import java.net.Inet6Address; -import java.net.InetAddress; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.function.Function; - -import org.apache.cassandra.metrics.CassandraMetricsRegistry.JmxCounterMBean; -import org.apache.cassandra.metrics.CassandraMetricsRegistry.JmxTimerMBean; -import org.apache.cassandra.tools.NodeProbe; -import org.apache.cassandra.tools.nodetool.Compact; -import org.apache.hugegraph.backend.store.BackendMetrics; -import org.apache.hugegraph.backend.store.BackendStoreProvider; -import org.apache.hugegraph.backend.store.BackendTable; -import org.apache.hugegraph.backend.store.cassandra.CassandraTables.Edge; -import org.apache.hugegraph.backend.store.cassandra.CassandraTables.Vertex; -import org.apache.hugegraph.config.HugeConfig; -import org.apache.hugegraph.testutil.Whitebox; -import org.apache.hugegraph.util.E; -import org.apache.hugegraph.util.InsertionOrderUtil; -import org.apache.hugegraph.util.Log; -import org.apache.hugegraph.util.UnitUtil; -import org.apache.tinkerpop.gremlin.util.NumberHelper; -import org.slf4j.Logger; - -import com.datastax.driver.core.Cluster; -import com.datastax.driver.core.Host; -import com.google.common.collect.ImmutableList; - -public class CassandraMetrics implements BackendMetrics { - - private static final Logger LOG = Log.logger(CassandraMetrics.class); - - private final Cluster cluster; - private final int port; - private final String username; - private final String password; - - private final String keyspace; - private final List tables; - - public CassandraMetrics(HugeConfig conf, - CassandraSessionPool sessions, - String keyspace) { - E.checkNotNull(conf, "config"); - E.checkArgumentNotNull(sessions, - "Cassandra sessions have not been initialized"); - this.cluster = sessions.cluster(); - this.port = conf.get(CassandraOptions.CASSANDRA_JMX_PORT); - this.username = conf.get(CassandraOptions.CASSANDRA_USERNAME); - this.password = conf.get(CassandraOptions.CASSANDRA_PASSWORD); - assert this.username != null && this.password != null; - - this.keyspace = keyspace; - String g = BackendStoreProvider.GRAPH_STORE; - String v = BackendTable.joinTableName(g, Vertex.TABLE); - String oe = BackendTable.joinTableName(g, "o" + Edge.TABLE_SUFFIX); - String ie = BackendTable.joinTableName(g, "i" + Edge.TABLE_SUFFIX); - this.tables = ImmutableList.of(v, oe, ie); - } - - @Override - public Map metrics() { - return this.executeAllHosts(this::getMetricsByHost); - } - - protected String keyspace() { - return this.keyspace; - } - - protected List tables() { - return this.tables; - } - - protected Map getMetricsByHost(String host) { - Map metrics = InsertionOrderUtil.newMap(); - // JMX client operations for Cassandra. - try (NodeProbe probe = this.newNodeProbe(host)) { - MemoryUsage heapUsage = probe.getHeapMemoryUsage(); - metrics.put(MEM_MAX, UnitUtil.bytesToMB(heapUsage.getMax())); - metrics.put(MEM_COMMITTED, - UnitUtil.bytesToMB(heapUsage.getCommitted())); - metrics.put(MEM_USED, UnitUtil.bytesToMB(heapUsage.getUsed())); - metrics.put(MEM_USED + READABLE, - UnitUtil.bytesToReadableString(heapUsage.getUsed())); - metrics.put(MEM_UNIT, "MB"); - - long diskSize = UnitUtil.bytesFromReadableString( - probe.getLoadString()); - metrics.put(DISK_USAGE, UnitUtil.bytesToGB(diskSize)); - metrics.put(DISK_USAGE + READABLE, - UnitUtil.bytesToReadableString(diskSize)); - metrics.put(DISK_USAGE + "_details", probe.getLoadMap(false)); - metrics.put(DISK_UNIT, "GB"); - - // Uptime Metrics - metrics.put("uptime", probe.getUptime()); - metrics.put("uptime_readable", - UnitUtil.timestampToReadableString(probe.getUptime())); - metrics.put("time_unit", "ms"); - - // Table/Cache/Compaction Metrics - this.appendExtraMetrics(metrics, probe); - - // Nodes Metrics - metrics.put("live_nodes", probe.getLiveNodes(false)); - metrics.put("joining_nodes", probe.getJoiningNodes(false)); - metrics.put("moving_nodes", probe.getMovingNodes(false)); - metrics.put("leaving_nodes", probe.getLeavingNodes(false)); - metrics.put("unreachable_nodes", probe.getUnreachableNodes(false)); - - // Others - metrics.put("keyspaces", probe.getKeyspaces()); - metrics.put("num_tables", probe.getNumberOfTables()); - metrics.put("exception_count", probe.getExceptionCount()); - - /* - * TODO: add metrics: - * probe.getAndResetGCStats() - * probe.getCfsProxy(keyspace, cf).estimateKeys() - * probe.takeSnapshot(snapshotName, table, options, keyspaces) - */ - } catch (Throwable e) { - LOG.debug("Unable to get metrics from host '{}':", host, e); - metrics.put(EXCEPTION, e.toString()); - } - return metrics; - } - - protected void appendExtraMetrics(Map metrics, - NodeProbe probe) { - // Table counter Metrics - appendCounterMetrics(metrics, probe, this.keyspace, this.tables, - "EstimatedPartitionCount"); - appendCounterMetrics(metrics, probe, this.keyspace, this.tables, - "DroppedMutations"); - appendCounterMetrics(metrics, probe, this.keyspace, this.tables, - "PendingFlushes"); - appendCounterMetrics(metrics, probe, this.keyspace, this.tables, - "KeyCacheHitRate"); - appendCounterMetrics(metrics, probe, this.keyspace, this.tables, - "BloomFilterFalseRatio"); - - // Table timer Metrics - appendTimerMetrics(metrics, probe, this.keyspace, "WriteLatency"); - appendTimerMetrics(metrics, probe, this.keyspace, "ReadLatency"); - appendTimerMetrics(metrics, probe, null, "WriteLatency"); - appendTimerMetrics(metrics, probe, null, "ReadLatency"); - - // Cache Metrics - appendCacheMetrics(metrics, probe, "KeyCache", "Size"); - appendCacheMetrics(metrics, probe, "KeyCache", "Entries"); - appendCacheMetrics(metrics, probe, "RowCache", "Size"); - appendCacheMetrics(metrics, probe, "RowCache", "Entries"); - appendCacheMetrics(metrics, probe, "CounterCache", "Size"); - appendCacheMetrics(metrics, probe, "CounterCache", "Entries"); - - // Compaction Metrics - appendCompactionMetrics(metrics, probe, "CompletedTasks"); - appendCompactionMetrics(metrics, probe, "PendingTasks"); - appendCompactionMetrics(metrics, probe, "BytesCompacted"); - } - - protected static void appendCounterMetrics(Map metrics, - NodeProbe probe, - String keyspace, - List tables, - String metric) { - // "EstimatedPartitionCount" => "estimated_partition_count" - String name = humpToLine(metric); - - // Aggregation of metrics for the whole host tables - Number number = 0; - for (String table : tables) { - // like: "hugegraph", "g_v", "EstimatedPartitionCount" - Object value = probe.getColumnFamilyMetric(keyspace, table, metric); - if (!(value instanceof Number)) { - value = Double.parseDouble(value.toString()); - } - number = NumberHelper.add(number, (Number) value); - } - metrics.put(name, number); - } - - protected static void appendTimerMetrics(Map metrics, - NodeProbe probe, - String keyspace, - String metric) { - // "ReadLatency" => "read_latency_hugegraph" - String suffix = keyspace == null ? "*" : keyspace; - String name = humpToLine(metric + "_" + suffix); - // Aggregation of metrics for the whole host if keyspace=null - JmxTimerMBean value = (JmxTimerMBean) probe.getColumnFamilyMetric( - keyspace, null, metric); - Map timerMap = InsertionOrderUtil.newMap(); - timerMap.put("count", value.getCount()); - timerMap.put("min", value.getMin()); - timerMap.put("mean", value.getMean()); - timerMap.put("max", value.getMax()); - timerMap.put("stddev", value.getStdDev()); - timerMap.put("p50", value.get50thPercentile()); - timerMap.put("p75", value.get75thPercentile()); - timerMap.put("p95", value.get95thPercentile()); - timerMap.put("p98", value.get98thPercentile()); - timerMap.put("p99", value.get99thPercentile()); - timerMap.put("p999", value.get999thPercentile()); - timerMap.put("duration_unit", value.getDurationUnit()); - timerMap.put("mean_rate", value.getMeanRate()); - timerMap.put("m15_rate", value.getFifteenMinuteRate()); - timerMap.put("m5_rate", value.getFiveMinuteRate()); - timerMap.put("m1_rate", value.getOneMinuteRate()); - timerMap.put("rate_unit", value.getRateUnit()); - - metrics.put(name, timerMap); - } - - protected static void appendCompactionMetrics(Map metrics, - NodeProbe probe, - String metric) { - // "CompletedTasks" => "compaction_completed_tasks" - String name = humpToLine("compaction" + metric); - Object value = probe.getCompactionMetric(metric); - if (value instanceof JmxCounterMBean) { - value = ((JmxCounterMBean) value).getCount(); - } - metrics.put(name, value); - } - - protected static void appendCacheMetrics(Map metrics, - NodeProbe probe, - String cacheType, - String metric) { - // "RowCache" + "Size" => "row_cache_size" - String name = humpToLine(cacheType + metric); - metrics.put(name, probe.getCacheMetric(cacheType, metric)); - } - - private static String humpToLine(String name) { - name = name.replaceAll("[A-Z]", "_$0").toLowerCase(); - if (!name.isEmpty() && name.charAt(0) == '_') { - name = name.substring(1); - } - return name; - } - - public Map compact() { - return this.executeAllHosts(this::compactHost); - } - - private Object compactHost(String host) { - try (NodeProbe probe = this.newNodeProbe(host)) { - Compact compact = new Compact(); - /* - * Set the keyspace to be compacted - * NOTE: use Whitebox due to no public api is provided, args format - * is [ ...], the first arg means keyspace. - */ - Whitebox.invoke(compact, "args", new Class[]{Object.class}, - "add", this.keyspace); - compact.execute(probe); - return "OK"; - } catch (Throwable e) { - return e.toString(); - } - } - - private Map executeAllHosts(Function func) { - Set hosts = this.cluster.getMetadata().getAllHosts(); - - Map results = InsertionOrderUtil.newMap(); - results.put(CLUSTER_ID, this.cluster.getClusterName()); - results.put(NODES, hosts.size()); - - Map hostsResults = InsertionOrderUtil.newMap(); - for (Host host : hosts) { - InetAddress address = host.getAddress(); - String hostAddress; - if (address instanceof Inet4Address) { - hostAddress = host.getAddress().getHostAddress(); - /* - * Translate IPv4 to IPv6 to fix issue #1843 - * TODO: delete this workaround code after fixed CASSANDRA-17581 - */ - hostAddress = "::FFFF:" + hostAddress; - } else { - assert address instanceof Inet6Address; - hostAddress = host.getAddress().getHostAddress(); - } - hostsResults.put(hostAddress, func.apply(hostAddress)); - } - results.put(SERVERS, hostsResults); - - return results; - } - - private NodeProbe newNodeProbe(String host) throws IOException { - LOG.debug("Probe to cassandra node: '{}:{}'", host, this.port); - return this.username.isEmpty() ? - new NodeProbe(host, this.port) : - new NodeProbe(host, this.port, this.username, this.password); - } -} diff --git a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraOptions.java b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraOptions.java deleted file mode 100644 index 6cb3b41389..0000000000 --- a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraOptions.java +++ /dev/null @@ -1,176 +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.hugegraph.backend.store.cassandra; - -import static org.apache.hugegraph.config.OptionChecker.allowValues; -import static org.apache.hugegraph.config.OptionChecker.disallowEmpty; -import static org.apache.hugegraph.config.OptionChecker.positiveInt; -import static org.apache.hugegraph.config.OptionChecker.rangeInt; - -import org.apache.hugegraph.config.ConfigListOption; -import org.apache.hugegraph.config.ConfigOption; -import org.apache.hugegraph.config.OptionHolder; - -public class CassandraOptions extends OptionHolder { - - private CassandraOptions() { - super(); - } - - private static volatile CassandraOptions instance; - - public static synchronized CassandraOptions instance() { - if (instance == null) { - instance = new CassandraOptions(); - instance.registerOptions(); - } - return instance; - } - - public static final ConfigOption CASSANDRA_HOST = - new ConfigOption<>( - "cassandra.host", - "The seeds hostname or ip address of cassandra cluster.", - disallowEmpty(), - "localhost" - ); - - public static final ConfigOption CASSANDRA_PORT = - new ConfigOption<>( - "cassandra.port", - "The seeds port address of cassandra cluster.", - rangeInt(1, 65535), - 9042 - ); - - public static final ConfigOption CASSANDRA_USERNAME = - new ConfigOption<>( - "cassandra.username", - "The username to use to login to cassandra cluster.", - "" - ); - - public static final ConfigOption CASSANDRA_PASSWORD = - new ConfigOption<>( - "cassandra.password", - "The password corresponding to cassandra.username.", - "" - ); - - public static final ConfigOption CASSANDRA_CONN_TIMEOUT = - new ConfigOption<>( - "cassandra.connect_timeout", - "The cassandra driver connect server timeout(seconds).", - rangeInt(1, 30), - 5 - ); - - public static final ConfigOption CASSANDRA_READ_TIMEOUT = - new ConfigOption<>( - "cassandra.read_timeout", - "The cassandra driver read from server timeout(seconds).", - rangeInt(1, 120), - 20 - ); - - public static final ConfigOption CASSANDRA_STRATEGY = - new ConfigOption<>( - "cassandra.keyspace.strategy", - "The replication strategy of keyspace, valid value is " + - "SimpleStrategy or NetworkTopologyStrategy.", - allowValues("SimpleStrategy", "NetworkTopologyStrategy"), - "SimpleStrategy" - ); - - public static final ConfigListOption CASSANDRA_REPLICATION = - new ConfigListOption<>( - "cassandra.keyspace.replication", - "The keyspace replication factor of SimpleStrategy, " + - "like '[3]'. Or replicas in each datacenter of " + - "NetworkTopologyStrategy, like '[dc1:2,dc2:1]'.", - disallowEmpty(), - "3" - ); - - public static final ConfigOption CASSANDRA_COMPRESSION = - new ConfigOption<>( - "cassandra.compression_type", - "The compression algorithm of cassandra transport: none/snappy/lz4.", - allowValues("none", "snappy", "lz4"), - "none" - ); - - public static final ConfigOption CASSANDRA_JMX_PORT = - new ConfigOption<>( - "cassandra.jmx_port", - "The port of JMX API service for cassandra", - rangeInt(1, 65535), - 7199 - ); - - public static final ConfigOption AGGR_TIMEOUT = - new ConfigOption<>( - "cassandra.aggregation_timeout", - "The timeout in seconds of waiting for aggregation.", - positiveInt(), - 12 * 60 * 60 - ); - - public static final ConfigOption CASSANDRA_RECONNECT_BASE_DELAY = - new ConfigOption<>( - "cassandra.reconnect_base_delay", - "The base delay in milliseconds used by the driver's " + - "exponential reconnection policy when a Cassandra host " + - "becomes unreachable.", - rangeInt(100L, Long.MAX_VALUE), - 1000L - ); - - public static final ConfigOption CASSANDRA_RECONNECT_MAX_DELAY = - new ConfigOption<>( - "cassandra.reconnect_max_delay", - "The maximum delay in milliseconds used by the driver's " + - "exponential reconnection policy when a Cassandra host " + - "becomes unreachable.", - rangeInt(1000L, Long.MAX_VALUE), - 10_000L - ); - - public static final ConfigOption CASSANDRA_QUERY_RETRY_MAX_ATTEMPTS = - new ConfigOption<>( - "cassandra.query_retry_max_attempts", - "The maximum number of retry attempts applied at query-time when " + - "a Cassandra host is temporarily unreachable. " + - "OperationTimedOutException is retried only for " + - "idempotent statements. " + - "Set to 0 to disable query-time retries.", - rangeInt(0, Integer.MAX_VALUE), - 3 - ); - - public static final ConfigOption CASSANDRA_QUERY_RETRY_INTERVAL = - new ConfigOption<>( - "cassandra.query_retry_interval", - "The interval in milliseconds between query-time retries " + - "when a Cassandra host is temporarily unreachable. The " + - "actual wait grows with exponential backoff, capped at " + - "cassandra.reconnect_max_delay.", - rangeInt(100L, Long.MAX_VALUE), - 1000L - ); -} diff --git a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraSerializer.java b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraSerializer.java deleted file mode 100644 index fc3c499a81..0000000000 --- a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraSerializer.java +++ /dev/null @@ -1,225 +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.hugegraph.backend.store.cassandra; - -import java.nio.ByteBuffer; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.apache.hugegraph.backend.BackendException; -import org.apache.hugegraph.backend.id.Id; -import org.apache.hugegraph.backend.id.IdGenerator; -import org.apache.hugegraph.backend.id.IdUtil; -import org.apache.hugegraph.backend.serializer.BytesBuffer; -import org.apache.hugegraph.backend.serializer.TableBackendEntry; -import org.apache.hugegraph.backend.serializer.TableSerializer; -import org.apache.hugegraph.backend.store.BackendEntry; -import org.apache.hugegraph.config.HugeConfig; -import org.apache.hugegraph.schema.PropertyKey; -import org.apache.hugegraph.schema.SchemaElement; -import org.apache.hugegraph.structure.HugeElement; -import org.apache.hugegraph.structure.HugeIndex; -import org.apache.hugegraph.structure.HugeProperty; -import org.apache.hugegraph.structure.HugeVertex; -import org.apache.hugegraph.type.HugeType; -import org.apache.hugegraph.type.define.DataType; -import org.apache.hugegraph.type.define.HugeKeys; -import org.apache.hugegraph.util.E; -import org.apache.hugegraph.util.InsertionOrderUtil; -import org.apache.hugegraph.util.JsonUtil; - -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableSet; - -public class CassandraSerializer extends TableSerializer { - - public CassandraSerializer(HugeConfig config) { - super(config); - } - - @Override - public CassandraBackendEntry newBackendEntry(HugeType type, Id id) { - return new CassandraBackendEntry(type, id); - } - - @Override - protected TableBackendEntry newBackendEntry(TableBackendEntry.Row row) { - return new CassandraBackendEntry(row); - } - - @Override - protected TableBackendEntry newBackendEntry(HugeIndex index) { - TableBackendEntry backendEntry = newBackendEntry(index.type(), - index.id()); - if (index.indexLabel().olap()) { - backendEntry.olap(true); - } - return backendEntry; - } - - @Override - protected CassandraBackendEntry convertEntry(BackendEntry backendEntry) { - if (!(backendEntry instanceof CassandraBackendEntry)) { - throw new BackendException("Not supported by CassandraSerializer"); - } - return (CassandraBackendEntry) backendEntry; - } - - @Override - protected Set parseIndexElemIds(TableBackendEntry entry) { - return ImmutableSet.of(entry.column(HugeKeys.ELEMENT_IDS)); - } - - @Override - protected Id toId(Number number) { - return IdGenerator.of(number.longValue()); - } - - @Override - protected Id[] toIdArray(Object object) { - assert object instanceof Collection; - @SuppressWarnings("unchecked") - Collection numbers = (Collection) object; - Id[] ids = new Id[numbers.size()]; - int i = 0; - for (Number number : numbers) { - ids[i++] = toId(number); - } - return ids; - } - - @Override - protected Object toLongSet(Collection ids) { - Set results = InsertionOrderUtil.newSet(); - for (Id id : ids) { - results.add(id.asLong()); - } - return results; - } - - @Override - protected Object toLongList(Collection ids) { - List results = new ArrayList<>(ids.size()); - for (Id id : ids) { - results.add(id.asLong()); - } - return results; - } - - @Override - protected void formatProperties(HugeElement element, - TableBackendEntry.Row row) { - if (!element.hasProperties() && !element.removed()) { - row.column(HugeKeys.PROPERTIES, ImmutableMap.of()); - } else { - // Format properties - for (HugeProperty prop : element.getProperties()) { - this.formatProperty(prop, row); - } - } - } - - @Override - protected void parseProperties(HugeElement element, - TableBackendEntry.Row row) { - Map props = row.column(HugeKeys.PROPERTIES); - for (Map.Entry prop : props.entrySet()) { - Id pkeyId = this.toId(prop.getKey()); - this.parseProperty(pkeyId, prop.getValue(), element); - } - } - - @Override - public BackendEntry writeOlapVertex(HugeVertex vertex) { - CassandraBackendEntry entry = newBackendEntry(HugeType.OLAP, - vertex.id()); - entry.column(HugeKeys.ID, this.writeId(vertex.id())); - - Collection> properties = vertex.getProperties(); - E.checkArgument(properties.size() == 1, - "Expect only 1 property for olap vertex, but got %s", - properties.size()); - HugeProperty property = properties.iterator().next(); - PropertyKey pk = property.propertyKey(); - entry.subId(pk.id()); - entry.column(HugeKeys.PROPERTY_VALUE, - this.writeProperty(pk, property.value())); - entry.olap(true); - return entry; - } - - @Override - protected Object writeProperty(PropertyKey propertyKey, Object value) { - BytesBuffer buffer = BytesBuffer.allocate(BytesBuffer.BUF_PROPERTY); - if (propertyKey == null) { - /* - * Since we can't know the type of the property value in some - * scenarios so need to construct a fake property key to - * serialize to reuse code. - */ - propertyKey = new PropertyKey(null, IdGenerator.of(0L), "fake"); - propertyKey.dataType(DataType.fromClass(value.getClass())); - } - buffer.writeProperty(propertyKey, value); - buffer.forReadWritten(); - return buffer.asByteBuffer(); - } - - @Override - @SuppressWarnings("unchecked") - protected T readProperty(PropertyKey pkey, Object value) { - BytesBuffer buffer = BytesBuffer.wrap((ByteBuffer) value); - return (T) buffer.readProperty(pkey); - } - - @Override - protected Object writeId(Id id) { - return IdUtil.writeBinString(id); - } - - @Override - protected Id readId(Object id) { - return IdUtil.readBinString(id); - } - - @Override - protected void writeUserdata(SchemaElement schema, - TableBackendEntry entry) { - assert entry instanceof CassandraBackendEntry; - for (Map.Entry e : schema.userdata().entrySet()) { - entry.column(HugeKeys.USER_DATA, e.getKey(), - JsonUtil.toJson(e.getValue())); - } - } - - @Override - protected void readUserdata(SchemaElement schema, - TableBackendEntry entry) { - assert entry instanceof CassandraBackendEntry; - // Parse all user data of a schema element - Map userdata = entry.column(HugeKeys.USER_DATA); - for (Map.Entry e : userdata.entrySet()) { - String key = e.getKey(); - Object value = JsonUtil.fromJson(e.getValue(), Object.class); - schema.userdata(key, value); - } - } -} diff --git a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraSessionPool.java b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraSessionPool.java deleted file mode 100644 index a217d53444..0000000000 --- a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraSessionPool.java +++ /dev/null @@ -1,494 +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.hugegraph.backend.store.cassandra; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.concurrent.atomic.AtomicBoolean; - -import org.apache.hugegraph.backend.BackendException; -import org.apache.hugegraph.backend.store.BackendSession.AbstractBackendSession; -import org.apache.hugegraph.backend.store.BackendSessionPool; -import org.apache.hugegraph.config.HugeConfig; -import org.apache.hugegraph.util.E; -import org.apache.hugegraph.util.Log; -import org.slf4j.Logger; - -import com.datastax.driver.core.BatchStatement; -import com.datastax.driver.core.Cluster; -import com.datastax.driver.core.Cluster.Builder; -import com.datastax.driver.core.Metadata; -import com.datastax.driver.core.ProtocolOptions.Compression; -import com.datastax.driver.core.ResultSet; -import com.datastax.driver.core.ResultSetFuture; -import com.datastax.driver.core.SimpleStatement; -import com.datastax.driver.core.SocketOptions; -import com.datastax.driver.core.Statement; -import com.datastax.driver.core.exceptions.DriverException; -import com.datastax.driver.core.exceptions.InvalidQueryException; -import com.datastax.driver.core.exceptions.NoHostAvailableException; -import com.datastax.driver.core.exceptions.OperationTimedOutException; -import com.datastax.driver.core.policies.ExponentialReconnectionPolicy; - -public class CassandraSessionPool extends BackendSessionPool { - - private static final Logger LOG = Log.logger(CassandraSessionPool.class); - - private static final int SECOND = 1000; - private static final String HEALTH_CHECK_CQL = - "SELECT now() FROM system.local"; - - /** - * Guards the one-time JVM-wide warning about {@code commitAsync()} not - * being covered by query-time retries. {@link CassandraSessionPool} is - * instantiated once per backend store per graph, so without this guard - * the warning would fire many times on startup for a structural - * limitation that does not change between instances. - */ - private static final AtomicBoolean ASYNC_RETRY_WARNING_LOGGED = - new AtomicBoolean(false); - - private Cluster cluster; - private final String keyspace; - private final int maxRetries; - private final long retryInterval; - private final long retryBaseDelay; - private final long retryMaxDelay; - - public CassandraSessionPool(HugeConfig config, - String keyspace, String store) { - super(config, keyspace + "/" + store); - this.cluster = null; - this.keyspace = keyspace; - this.maxRetries = config.get( - CassandraOptions.CASSANDRA_QUERY_RETRY_MAX_ATTEMPTS); - this.retryInterval = config.get( - CassandraOptions.CASSANDRA_QUERY_RETRY_INTERVAL); - long reconnectBase = config.get( - CassandraOptions.CASSANDRA_RECONNECT_BASE_DELAY); - long reconnectMax = config.get( - CassandraOptions.CASSANDRA_RECONNECT_MAX_DELAY); - E.checkArgument(reconnectMax >= reconnectBase, - "'%s' (%s) must be >= '%s' (%s)", - CassandraOptions.CASSANDRA_RECONNECT_MAX_DELAY.name(), - reconnectMax, - CassandraOptions.CASSANDRA_RECONNECT_BASE_DELAY.name(), - reconnectBase); - this.retryBaseDelay = reconnectBase; - this.retryMaxDelay = reconnectMax; - - if (this.maxRetries > 0 && - ASYNC_RETRY_WARNING_LOGGED.compareAndSet(false, true)) { - LOG.warn("cassandra.query_retry_max_attempts={} applies to sync commit()" + - " only. commitAsync() has no retry protection.", this.maxRetries); - } - } - - @Override - public synchronized void open() { - if (this.opened()) { - throw new BackendException("Please close the old SessionPool " + - "before opening a new one"); - } - - HugeConfig config = this.config(); - // Contact options - String hosts = config.get(CassandraOptions.CASSANDRA_HOST); - int port = config.get(CassandraOptions.CASSANDRA_PORT); - - assert this.cluster == null || this.cluster.isClosed(); - /* - * We disable cassandra metrics through withoutMetrics(), due to - * metrics versions are incompatible, java11 glassfish use metrics 4, - * but cassandra use metrics 3. - * TODO: fix it after after cassandra upgrade metrics version - */ - Builder builder = Cluster.builder() - .addContactPoints(hosts.split(",")) - .withoutMetrics() - .withPort(port); - - // Timeout options - int connTimeout = config.get(CassandraOptions.CASSANDRA_CONN_TIMEOUT); - int readTimeout = config.get(CassandraOptions.CASSANDRA_READ_TIMEOUT); - - SocketOptions socketOptions = new SocketOptions(); - socketOptions.setConnectTimeoutMillis(connTimeout * SECOND); - socketOptions.setReadTimeoutMillis(readTimeout * SECOND); - - builder.withSocketOptions(socketOptions); - - // Reconnection policy: let driver keep retrying nodes in background - // with exponential backoff after they go down (see issue #2740). - builder.withReconnectionPolicy( - new ExponentialReconnectionPolicy(this.retryBaseDelay, - this.retryMaxDelay)); - - // Credential options - String username = config.get(CassandraOptions.CASSANDRA_USERNAME); - String password = config.get(CassandraOptions.CASSANDRA_PASSWORD); - if (!username.isEmpty()) { - builder.withCredentials(username, password); - } - - // Compression options - String compression = config.get(CassandraOptions.CASSANDRA_COMPRESSION); - builder.withCompression(Compression.valueOf(compression.toUpperCase())); - - this.cluster = builder.build(); - } - - @Override - public final synchronized boolean opened() { - return (this.cluster != null && !this.cluster.isClosed()); - } - - protected final synchronized Cluster cluster() { - E.checkState(this.cluster != null, - "Cassandra cluster has not been initialized"); - return this.cluster; - } - - @Override - public final Session session() { - return (Session) super.getOrNewSession(); - } - - @Override - protected Session newSession() { - E.checkState(this.cluster != null, - "Cassandra cluster has not been initialized"); - return new Session(); - } - - @Override - protected synchronized void doClose() { - if (this.cluster != null && !this.cluster.isClosed()) { - this.cluster.close(); - } - } - - public final boolean clusterConnected() { - E.checkState(this.cluster != null, - "Cassandra cluster has not been initialized"); - return !this.cluster.isClosed(); - } - - /** - * The Session class is a wrapper of driver Session - * Expect every thread hold its own session(wrapper) - */ - public final class Session extends AbstractBackendSession { - - private com.datastax.driver.core.Session session; - private BatchStatement batch; - - public Session() { - this.session = null; - this.batch = new BatchStatement(); // LOGGED - } - - public BatchStatement add(Statement statement) { - return this.batch.add(statement); - } - - @Override - public void rollback() { - this.batch.clear(); - } - - @Override - public ResultSet commit() { - ResultSet rs = this.executeWithRetry(this.batch); - // Clear batch if execute() successfully (retained if failed) - this.batch.clear(); - return rs; - } - - public void commitAsync() { - Collection statements = this.batch.getStatements(); - if (statements.isEmpty()) { - this.batch.clear(); - return; - } - - int count = 0; - int processors = Math.min(statements.size(), 1023); - List results = new ArrayList<>(processors + 1); - com.datastax.driver.core.Session driverSession = - this.sessionForAsyncCommit(); - for (Statement s : statements) { - // TODO: track async retry support in a follow-up issue. - // commitAsync() bypasses executeWithRetry(). - // During a Cassandra restart, async writes may fail with - // NoHostAvailableException even when maxRetries > 0. Callers - // must handle ResultSetFuture failures surfaced by - // getUninterruptibly(). A follow-up issue should wrap each - // future with retry semantics. - ResultSetFuture future = driverSession.executeAsync(s); - results.add(future); - - if (++count > processors) { - results.forEach(ResultSetFuture::getUninterruptibly); - results.clear(); - count = 0; - } - } - for (ResultSetFuture future : results) { - future.getUninterruptibly(); - } - - // Clear batch if execute() successfully (retained if failed) - this.batch.clear(); - } - - public ResultSet query(Statement statement) { - assert !this.hasChanges(); - return this.execute(statement); - } - - public ResultSet execute(Statement statement) { - return this.executeWithRetry(statement); - } - - public ResultSet execute(String statement) { - return this.executeWithRetry(new SimpleStatement(statement)); - } - - public ResultSet execute(String statement, Object... args) { - return this.executeWithRetry(new SimpleStatement(statement, args)); - } - - /** - * Execute a statement, retrying on transient connectivity failures - * (NoHostAvailableException / OperationTimedOutException). The driver - * itself keeps retrying connections in the background via the - * reconnection policy, so once Cassandra comes back online, a - * subsequent attempt here will succeed without restarting the server. - * - *

OperationTimedOutException is only retried for statements marked - * idempotent; otherwise a timed-out mutation might be applied once by - * Cassandra and then duplicated by a client-side retry. - * - *

If the driver session has been discarded (e.g. by - * {@link #reconnectIfNeeded()} after a failed health-check) it is - * lazily reopened at the start of each attempt. - * - *

Blocking note: retries block the calling thread via - * {@link Thread#sleep(long)}. Worst-case a single call blocks for - * {@code maxRetries * retryMaxDelay} ms. Under high-throughput - * workloads concurrent threads may pile up in {@code sleep()} during - * a Cassandra outage. For such deployments lower - * {@code cassandra.query_retry_max_attempts} (default 3) and - * {@code cassandra.reconnect_max_delay} (default 10000ms) so the - * request fails fast and pressure is released back to the caller. - */ - private ResultSet executeWithRetry(Statement statement) { - int retries = CassandraSessionPool.this.maxRetries; - long interval = CassandraSessionPool.this.retryInterval; - long maxDelay = CassandraSessionPool.this.retryMaxDelay; - DriverException lastError = null; - for (int attempt = 0; attempt <= retries; attempt++) { - try { - if (this.session == null || this.session.isClosed()) { - // Lazy reopen: may itself throw NHAE while - // Cassandra is still unreachable; the catch below - // treats that as a transient failure. - this.session = null; - this.open(); - } - return this.session.execute(statement); - } catch (NoHostAvailableException | OperationTimedOutException e) { - lastError = e; - if (e instanceof OperationTimedOutException && - !Boolean.TRUE.equals(statement.isIdempotent())) { - throw new BackendException( - "Cassandra query timed out and won't be " + - "retried because the statement is not " + - "marked idempotent", e); - } - if (attempt >= retries) { - break; - } - long cap = maxDelay > 0 ? maxDelay : interval; - long shift = 1L << Math.min(attempt, 20); - long delay; - try { - // Guard against Long overflow when retryInterval is huge. - delay = Math.min(Math.multiplyExact(interval, shift), cap); - } catch (ArithmeticException overflow) { - delay = cap; - } - LOG.warn("Cassandra temporarily unavailable ({}), " + - "retry {}/{} in {} ms", - e.getClass().getSimpleName(), attempt + 1, - retries, delay); - try { - Thread.sleep(delay); - } catch (InterruptedException ie) { - Thread.currentThread().interrupt(); - throw new BackendException("Interrupted while " + - "waiting to retry " + - "Cassandra query", ie); - } - } - } - // Preserve original exception as cause (stack trace + type) by - // pre-formatting the message and using the (String, Throwable) - // constructor explicitly to avoid ambiguity with varargs overloads. - String msg = String.format( - "Failed to execute Cassandra query after %s retries: %s", - retries, - lastError == null ? "" : lastError.getMessage()); - throw new BackendException(msg, lastError); - } - - private void tryOpen() { - assert this.session == null; - try { - this.open(); - } catch (InvalidQueryException ignored) { - // ignore - } - } - - private com.datastax.driver.core.Session sessionForAsyncCommit() { - if (this.session == null || this.session.isClosed()) { - this.session = null; - try { - this.open(); - } catch (DriverException e) { - throw new BackendException( - "Failed to open Cassandra session for async commit", - e); - } - } - if (this.session == null) { - throw new BackendException( - "Cassandra session is unavailable for async commit"); - } - return this.session; - } - - @Override - public void open() { - this.opened = true; - assert this.session == null; - this.session = cluster().connect(keyspace()); - } - - @Override - public boolean opened() { - if (this.opened && this.session == null) { - this.tryOpen(); - } - return this.opened && this.session != null; - } - - @Override - public boolean closed() { - if (!this.opened || this.session == null) { - return true; - } - return this.session.isClosed(); - } - - @Override - public void close() { - assert this.closeable(); - if (this.session == null) { - return; - } - this.session.close(); - this.session = null; - } - - @Override - public boolean hasChanges() { - return this.batch.size() > 0; - } - - /** - * Periodic liveness probe invoked by {@link BackendSessionPool} to - * recover thread-local sessions after Cassandra has been restarted. - * Reopens the driver session if it was closed and pings the cluster - * with a lightweight query. On failure the session is discarded via - * {@link #reset()} so the next call to - * {@link #executeWithRetry(Statement)} reopens it; any exception - * here is swallowed so the caller can still issue the real query. - */ - @Override - public void reconnectIfNeeded() { - if (!this.opened) { - return; - } - try { - if (this.session == null || this.session.isClosed()) { - this.session = null; - this.tryOpen(); - } - if (this.session != null) { - this.session.execute(new SimpleStatement(HEALTH_CHECK_CQL)); - } - } catch (NoHostAvailableException | OperationTimedOutException e) { - LOG.debug("Cassandra health-check failed, resetting session: {}", - e.getMessage()); - this.reset(); - } - } - - /** - * Force-close the driver session so it is re-opened on the next - * {@link #opened()} call. Used when a failure is observed and we - * want to start fresh on the next attempt. - */ - @Override - public void reset() { - if (this.session == null) { - return; - } - try { - this.session.close(); - } catch (Exception e) { - // Do not swallow Error (OOM / StackOverflow); only log - // ordinary exceptions raised by the driver on close. - LOG.warn("Failed to reset Cassandra session", e); - } finally { - this.session = null; - } - } - - public Collection statements() { - return this.batch.getStatements(); - } - - public String keyspace() { - return CassandraSessionPool.this.keyspace; - } - - public Metadata metadata() { - return CassandraSessionPool.this.cluster.getMetadata(); - } - - public int aggregateTimeout() { - HugeConfig conf = CassandraSessionPool.this.config(); - return conf.get(CassandraOptions.AGGR_TIMEOUT); - } - } -} diff --git a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraShard.java b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraShard.java deleted file mode 100644 index 5f37922985..0000000000 --- a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraShard.java +++ /dev/null @@ -1,319 +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.hugegraph.backend.store.cassandra; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; -import java.util.Set; -import java.util.concurrent.Callable; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Future; -import java.util.concurrent.LinkedBlockingQueue; -import java.util.concurrent.ThreadPoolExecutor; -import java.util.concurrent.TimeUnit; -import java.util.stream.Collectors; - -import org.apache.cassandra.db.SystemKeyspace; -import org.apache.cassandra.dht.ByteOrderedPartitioner; -import org.apache.cassandra.dht.IPartitioner; -import org.apache.cassandra.dht.Murmur3Partitioner; -import org.apache.cassandra.dht.OrderPreservingPartitioner; -import org.apache.cassandra.dht.Range; -import org.apache.cassandra.dht.Token; -import org.apache.cassandra.dht.Token.TokenFactory; -import org.apache.cassandra.schema.SchemaConstants; -import org.apache.hugegraph.backend.BackendException; -import org.apache.hugegraph.backend.store.Shard; -import org.apache.hugegraph.util.Bytes; - -import com.datastax.driver.core.Host; -import com.datastax.driver.core.Metadata; -import com.datastax.driver.core.ResultSet; -import com.datastax.driver.core.Row; -import com.datastax.driver.core.TokenRange; -import com.google.common.collect.ImmutableMap; - -/** - * CassandraShard is used for cassandra scanning operations. - * Each shard represents a range of tokens for a node. - * Reading data from a given shard does not cross multiple nodes. - *

- * Refer to AbstractColumnFamilyInputFormat from: - * ... - */ -public class CassandraShard { - - /** The minimal shard size should >= 1M to prevent too many number of shards */ - private static final int MIN_SHARD_SIZE = (int) Bytes.MB; - - private CassandraSessionPool.Session session; - private String keyspace; - private String table; - - private IPartitioner partitioner; - - public CassandraShard(CassandraSessionPool.Session session, - String keyspace, String table) { - this.session = session; - this.keyspace = keyspace; - this.table = table; - - this.partitioner = new Murmur3Partitioner(); - } - - /** - * Get splits of a table - * - * @param splitPartitions: expected partitions count per split - * @param splitSize: expected size(bytes) per split, - * splitPartitions will be ignored if splitSize is passed - * @return a list of Shard - */ - public List getSplits(long splitPartitions, long splitSize) { - // Canonical ranges, split into pieces, fetch the splits in parallel - ExecutorService executor = new ThreadPoolExecutor(0, 128, 60L, TimeUnit.SECONDS, - new LinkedBlockingQueue<>()); - - List splits = new ArrayList<>(); - try { - List>> futures = new ArrayList<>(); - - // Canonical ranges and nodes holding replicas - Map> masterRangeNodes = getRangeMap(); - - for (TokenRange range : masterRangeNodes.keySet()) { - /* - * For each token range, pick a live owner and ask it to - * compute bite-sized splits. - */ - futures.add(executor.submit(new SplitCallable( - range, splitPartitions, splitSize))); - } - - // Wait until we have all the results back - for (Future> future : futures) { - try { - splits.addAll(future.get()); - } catch (Exception e) { - throw new BackendException("Can't get cassandra shards", e); - } - } - assert splits.size() > masterRangeNodes.size(); - } finally { - executor.shutdownNow(); - } - - Collections.shuffle(splits, new Random(System.nanoTime())); - return splits; - } - - /** - * Get splits of a table in specified range - * NOTE: maybe we don't need this method - * - * @param start: the start of range - * @param end: the end of range - * @param splitPartitions: expected partitions count per split - * @param splitSize: expected size(bytes) per split, - * splitPartitions will be ignored if splitSize is passed - * @return a list of Shard - */ - public List getSplits(String start, String end, - int splitPartitions, int splitSize) { - - ExecutorService executor = new ThreadPoolExecutor(0, 128, 60L, TimeUnit.SECONDS, - new LinkedBlockingQueue<>()); - - List splits = new ArrayList<>(); - try { - List>> futures = new ArrayList<>(); - TokenFactory tokenFactory = this.partitioner.getTokenFactory(); - TokenRange tokenRange = rangeToTokenRange(new Range<>( - tokenFactory.fromString(start), - tokenFactory.fromString(end))); - - // Canonical ranges and nodes holding replicas - Map> masterRangeNodes = getRangeMap(); - - for (TokenRange range : masterRangeNodes.keySet()) { - for (TokenRange r : range.intersectWith(tokenRange)) { - // For each tokenRange, pick a live owner and ask it - // to compute bite-sized splits - futures.add(executor.submit(new SplitCallable( - r, splitPartitions, splitSize))); - } - } - - // Wait until we have all the results back - for (Future> future : futures) { - try { - splits.addAll(future.get()); - } catch (Exception e) { - throw new BackendException("Can't get cassandra shards", e); - } - } - assert splits.size() >= masterRangeNodes.size(); - } finally { - executor.shutdownNow(); - } - - Collections.shuffle(splits, new Random(System.nanoTime())); - return splits; - } - - private boolean isPartitionerOpp() { - return this.partitioner instanceof OrderPreservingPartitioner || - this.partitioner instanceof ByteOrderedPartitioner; - } - - private TokenRange rangeToTokenRange(Range range) { - TokenFactory tokenFactory = this.partitioner.getTokenFactory(); - Metadata metadata = this.session.metadata(); - return metadata.newTokenRange( - metadata.newToken(tokenFactory.toString(range.left)), - metadata.newToken(tokenFactory.toString(range.right))); - } - - private Map getSubSplits(TokenRange tokenRange, - long splitPartitions, - long splitSize) { - try { - return describeSplits(this.session, this.keyspace, this.table, - splitPartitions, splitSize, tokenRange); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - private Map> getRangeMap() { - Metadata metadata = this.session.metadata(); - return metadata.getTokenRanges().stream().collect(Collectors.toMap( - p -> p, - p -> metadata.getReplicas('"' + this.keyspace + '"', p))); - } - - private static Map describeSplits( - CassandraSessionPool.Session session, - String keyspace, - String table, - long splitPartitions, - long splitSize, - TokenRange tokenRange) { - - String query = String.format( - "SELECT mean_partition_size, partitions_count FROM %s.%s " + - "WHERE keyspace_name = ? AND table_name = ? AND " + - "range_start = ? AND range_end = ?", - SchemaConstants.SYSTEM_KEYSPACE_NAME, - SystemKeyspace.LEGACY_SIZE_ESTIMATES); - - ResultSet resultSet = session.execute(query, keyspace, table, - tokenRange.getStart().toString(), - tokenRange.getEnd().toString()); - Row row = resultSet.one(); - - long meanPartitionSize; - long partitionsCount = 0L; - long splitCount = 0L; - - if (row != null) { - meanPartitionSize = row.getLong("mean_partition_size"); - partitionsCount = row.getLong("partitions_count"); - assert splitSize <= 0 || splitSize >= MIN_SHARD_SIZE; - splitCount = splitSize > 0 ? - (meanPartitionSize * partitionsCount / splitSize) : - (partitionsCount / splitPartitions); - } - - /* - * If we have no data on this split or the size estimate is 0, - * return the full split i.e., do not sub-split - * Assume the smallest granularity of partition count available from CASSANDRA-7688. - */ - if (splitCount == 0) { - return ImmutableMap.of(tokenRange, (long) 128); - } - - List ranges = tokenRange.splitEvenly((int) splitCount); - Map rangesWithLength = new HashMap<>(); - for (TokenRange range : ranges) { - // Add a sub-range (with its partitions count per sub-range) - rangesWithLength.put(range, partitionsCount / splitCount); - } - return rangesWithLength; - } - - /** - * Gets a token tokenRange and splits it up according to the suggested size - * into input splits that Hugegraph can use. - */ - class SplitCallable implements Callable> { - - private final TokenRange tokenRange; - private final long splitPartitions; - private final long splitSize; - - public SplitCallable(TokenRange tokenRange, - long splitPartitions, long splitSize) { - if (splitSize <= 0 && splitPartitions <= 0) { - throw new IllegalArgumentException(String.format( - "The split-partitions must be > 0, but got %s", - splitPartitions)); - } - - if (splitSize > 0 && splitSize < MIN_SHARD_SIZE) { - // splitSize should be at least 1M if passed - throw new IllegalArgumentException(String.format( - "The split-size must be >= %s bytes, but got %s", - MIN_SHARD_SIZE, splitSize)); - } - - this.tokenRange = tokenRange; - this.splitPartitions = splitPartitions; - this.splitSize = splitSize; - } - - @Override - public List call() throws Exception { - ArrayList splits = new ArrayList<>(); - - Map subSplits = getSubSplits( - this.tokenRange, - this.splitPartitions, - this.splitSize); - for (Map.Entry entry : subSplits.entrySet()) { - List ranges = entry.getKey().unwrap(); - for (TokenRange subrange : ranges) { - String start = !isPartitionerOpp() ? - subrange.getStart().toString() : - subrange.getStart().toString().substring(2); - String end = !isPartitionerOpp() ? - subrange.getEnd().toString() : - subrange.getEnd().toString().substring(2); - long length = entry.getValue(); - splits.add(new Shard(start, end, length)); - } - } - return splits; - } - } -} diff --git a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraStore.java b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraStore.java deleted file mode 100644 index d302c65d5c..0000000000 --- a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraStore.java +++ /dev/null @@ -1,814 +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.hugegraph.backend.store.cassandra; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; - -import org.apache.hugegraph.HugeException; -import org.apache.hugegraph.backend.BackendException; -import org.apache.hugegraph.backend.id.Id; -import org.apache.hugegraph.backend.query.Query; -import org.apache.hugegraph.backend.serializer.MergeIterator; -import org.apache.hugegraph.backend.store.AbstractBackendStore; -import org.apache.hugegraph.backend.store.BackendAction; -import org.apache.hugegraph.backend.store.BackendEntry; -import org.apache.hugegraph.backend.store.BackendFeatures; -import org.apache.hugegraph.backend.store.BackendMutation; -import org.apache.hugegraph.backend.store.BackendStoreProvider; -import org.apache.hugegraph.config.CoreOptions; -import org.apache.hugegraph.config.HugeConfig; -import org.apache.hugegraph.exception.ConnectionException; -import org.apache.hugegraph.type.HugeType; -import org.apache.hugegraph.util.E; -import org.apache.hugegraph.util.Log; -import org.slf4j.Logger; - -import com.datastax.driver.core.Cluster; -import com.datastax.driver.core.KeyspaceMetadata; -import com.datastax.driver.core.Session; -import com.datastax.driver.core.Statement; -import com.datastax.driver.core.exceptions.DriverException; -import com.datastax.driver.core.exceptions.InvalidQueryException; -import com.datastax.driver.core.schemabuilder.SchemaBuilder; - -public abstract class CassandraStore extends AbstractBackendStore { - - private static final Logger LOG = Log.logger(CassandraStore.class); - - private static final BackendFeatures FEATURES = new CassandraFeatures(); - - private final String store; - private final String keyspace; - - private final BackendStoreProvider provider; - // TODO: move to parent class - private final Map tables; - - private CassandraSessionPool sessions; - private HugeConfig conf; - private boolean isGraphStore; - - public CassandraStore(final BackendStoreProvider provider, - final String keyspace, final String store) { - E.checkNotNull(keyspace, "keyspace"); - E.checkNotNull(store, "store"); - - this.provider = provider; - - this.keyspace = keyspace; - this.store = store; - this.tables = new ConcurrentHashMap<>(); - - this.sessions = null; - this.conf = null; - - this.registerMetaHandlers(); - LOG.debug("Store loaded: {}", store); - } - - private void registerMetaHandlers() { - this.registerMetaHandler("metrics", (session, meta, args) -> { - CassandraMetrics metrics = this.createMetrics(this.conf, - this.sessions, - this.keyspace); - return metrics.metrics(); - }); - - this.registerMetaHandler("compact", (session, meta, args) -> { - CassandraMetrics metrics = this.createMetrics(this.conf, - this.sessions, - this.keyspace); - return metrics.compact(); - }); - } - - protected CassandraMetrics createMetrics(HugeConfig conf, - CassandraSessionPool sessions, - String keyspace) { - return new CassandraMetrics(conf, sessions, keyspace); - } - - protected void registerTableManager(HugeType type, CassandraTable table) { - this.registerTableManager(type.string(), table); - } - - protected void registerTableManager(String name, CassandraTable table) { - this.tables.put(name, table); - } - - protected void unregisterTableManager(String name) { - this.tables.remove(name); - } - - @Override - public String store() { - return this.store; - } - - @Override - public String database() { - return this.keyspace; - } - - @Override - public BackendStoreProvider provider() { - return this.provider; - } - - @Override - public synchronized void open(HugeConfig config) { - LOG.debug("Store open: {}", this.store); - E.checkNotNull(config, "config"); - - if (this.sessions == null) { - this.sessions = new CassandraSessionPool(config, this.keyspace, - this.store); - } - - assert this.sessions != null; - if (!this.sessions.closed()) { - // TODO: maybe we should throw an exception here instead of ignore - LOG.debug("Store {} has been opened before", this.store); - this.sessions.useSession(); - return; - } - this.conf = config; - String graphStore = this.conf.get(CoreOptions.STORE_GRAPH); - this.isGraphStore = this.store.equals(graphStore); - - // Init cluster - this.sessions.open(); - - // Init a session for current thread - try { - LOG.debug("Store connect with keyspace: {}", this.keyspace); - try { - this.sessions.session().open(); - } catch (InvalidQueryException e) { - // TODO: the error message may be changed in different versions - if (!e.getMessage().contains(String.format("Keyspace '%s' does not exist", - this.keyspace))) { - throw e; - } - if (this.isSchemaStore()) { - LOG.info("Failed to connect keyspace: {}, try to init keyspace later", - this.keyspace); - } - } - } catch (Throwable e) { - try { - this.sessions.close(); - } catch (Throwable e2) { - LOG.warn("Failed to close cluster after an error", e2); - } - throw new ConnectionException("Failed to connect to Cassandra", e); - } - - LOG.debug("Store opened: {}", this.store); - } - - @Override - public void close() { - LOG.debug("Store close: {}", this.store); - this.sessions.close(); - } - - @Override - public boolean opened() { - this.checkClusterConnected(); - return this.sessions.session().opened(); - } - - @Override - public void mutate(BackendMutation mutation) { - if (LOG.isDebugEnabled()) { - LOG.debug("Store {} mutation: {}", this.store, mutation); - } - - this.checkOpened(); - CassandraSessionPool.Session session = this.sessions.session(); - - for (Iterator it = mutation.mutation(); it.hasNext(); ) { - this.mutate(session, it.next()); - } - } - - private void mutate(CassandraSessionPool.Session session, BackendAction item) { - CassandraBackendEntry entry = castBackendEntry(item.entry()); - - // Check if the entry has no change - if (!entry.selfChanged() && entry.subRows().isEmpty()) { - LOG.warn("The entry will be ignored due to no change: {}", entry); - } - - CassandraTable table; - if (!entry.olap()) { - // Oltp table - table = this.table(entry.type()); - } else { - if (entry.type().isIndex()) { - // Olap index - table = this.table(this.olapTableName(entry.type())); - } else { - // Olap vertex - table = this.table(this.olapTableName(entry.subId())); - } - } - - switch (item.action()) { - case INSERT: - // Insert entry - if (entry.selfChanged()) { - table.insert(session, entry.row()); - } - // Insert sub rows (edges) - for (CassandraBackendEntry.Row row : entry.subRows()) { - this.table(row.type()).insert(session, row); - } - break; - case DELETE: - // Delete entry - if (entry.selfChanged()) { - table.delete(session, entry.row()); - } - // Delete sub rows (edges) - for (CassandraBackendEntry.Row row : entry.subRows()) { - this.table(row.type()).delete(session, row); - } - break; - case APPEND: - // Append entry - if (entry.selfChanged()) { - table.append(session, entry.row()); - } - // Append sub rows (edges) - for (CassandraBackendEntry.Row row : entry.subRows()) { - this.table(row.type()).append(session, row); - } - break; - case ELIMINATE: - // Eliminate entry - if (entry.selfChanged()) { - table.eliminate(session, entry.row()); - } - // Eliminate sub rows (edges) - for (CassandraBackendEntry.Row row : entry.subRows()) { - this.table(row.type()).eliminate(session, row); - } - break; - case UPDATE_IF_PRESENT: - if (entry.selfChanged()) { - // TODO: forward to master-writer node - table.updateIfPresent(session, entry.row()); - } - assert entry.subRows().isEmpty() : entry.subRows(); - break; - case UPDATE_IF_ABSENT: - if (entry.selfChanged()) { - // TODO: forward to master-writer node - table.updateIfAbsent(session, entry.row()); - } - assert entry.subRows().isEmpty() : entry.subRows(); - break; - default: - throw new AssertionError(String.format( - "Unsupported mutate action: %s", item.action())); - } - } - - @Override - public Iterator query(Query query) { - this.checkOpened(); - HugeType type = CassandraTable.tableType(query); - String tableName = query.olap() ? this.olapTableName(type) : - type.string(); - CassandraTable table = this.table(tableName); - Iterator entries = table.query(this.session(null), query); - // Merge olap results as needed - Set olapPks = query.olapPks(); - if (this.isGraphStore && !olapPks.isEmpty()) { - List> iterators = new ArrayList<>(); - for (Id pk : olapPks) { - Query q = query.copy(); - table = this.table(this.olapTableName(pk)); - iterators.add(table.query(this.session(null), q)); - } - entries = new MergeIterator<>(entries, iterators, - BackendEntry::mergeable); - } - return entries; - } - - @Override - public Number queryNumber(Query query) { - this.checkOpened(); - - CassandraTable table = this.table(CassandraTable.tableType(query)); - return table.queryNumber(this.sessions.session(), query); - } - - @Override - public BackendFeatures features() { - return FEATURES; - } - - @Override - public void init() { - this.checkClusterConnected(); - - // Create keyspace if needed - if (!this.existsKeyspace()) { - this.initKeyspace(); - } - - if (this.sessions.session().opened()) { - // Session has ever been opened. - LOG.warn("Session has ever been opened(exist keyspace '{}' before)", - this.keyspace); - } else { - // Open session explicitly to get the exception when it fails - this.sessions.session().open(); - } - - // Create tables - this.checkOpened(); - this.initTables(); - - LOG.debug("Store initialized: {}", this.store); - } - - @Override - public void clear(boolean clearSpace) { - this.checkClusterConnected(); - - if (this.existsKeyspace()) { - if (!clearSpace) { - this.checkOpened(); - this.clearTables(); - } else { - this.clearKeyspace(); - } - } - - LOG.debug("Store cleared: {}", this.store); - } - - @Override - public boolean initialized() { - this.checkClusterConnected(); - - if (!this.existsKeyspace()) { - return false; - } - for (CassandraTable table : this.tables()) { - if (!this.existsTable(table.table())) { - return false; - } - } - return true; - } - - @Override - public void truncate() { - this.checkOpened(); - - this.truncateTables(); - LOG.debug("Store truncated: {}", this.store); - } - - @Override - public void beginTx() { - this.checkOpened(); - - CassandraSessionPool.Session session = this.sessions.session(); - if (session.txState() != TxState.CLEAN) { - LOG.warn("Store {} expect state CLEAN than {} when begin()", - this.store, session.txState()); - } - session.txState(TxState.BEGIN); - } - - @Override - public void commitTx() { - this.checkOpened(); - - CassandraSessionPool.Session session = this.sessions.session(); - if (session.txState() != TxState.BEGIN) { - LOG.warn("Store {} expect state BEGIN than {} when commit()", - this.store, session.txState()); - } - - if (!session.hasChanges()) { - session.txState(TxState.CLEAN); - LOG.debug("Store {} has nothing to commit", this.store); - return; - } - - if (LOG.isDebugEnabled()) { - LOG.debug("Store {} commit {} statements: {}", this.store, - session.statements().size(), session.statements()); - } - - // TODO how to implement tx perfectly? - - // Do update - session.txState(TxState.COMMITTING); - try { - session.commit(); - session.txState(TxState.CLEAN); - } catch (DriverException e) { - session.txState(TxState.COMMITT_FAIL); - LOG.error("Failed to commit statements due to:", e); - assert !session.statements().isEmpty(); - throw new BackendException( - "Failed to commit %s statements: '%s'...", e, - session.statements().size(), - session.statements().iterator().next()); - } - } - - @Override - public void rollbackTx() { - this.checkOpened(); - - CassandraSessionPool.Session session = this.sessions.session(); - - // TODO how to implement perfectly? - - if (session.txState() != TxState.COMMITT_FAIL && - session.txState() != TxState.CLEAN) { - LOG.warn("Store {} expect state COMMIT_FAIL/COMMITTING/CLEAN " + - "than {} when rollback()", this.store, session.txState()); - } - - session.txState(TxState.ROLLBACKING); - try { - session.rollback(); - } finally { - // Assume batch commit would auto rollback - session.txState(TxState.CLEAN); - } - } - - protected Cluster cluster() { - return this.sessions.cluster(); - } - - protected boolean existsKeyspace() { - return this.cluster().getMetadata().getKeyspace(this.keyspace) != null; - } - - protected boolean existsTable(String table) { - KeyspaceMetadata keyspace = this.cluster().getMetadata().getKeyspace(this.keyspace); - return keyspace != null && keyspace.getTable(table) != null; - } - - protected void initKeyspace() { - Statement stmt = SchemaBuilder.createKeyspace(this.keyspace) - .ifNotExists().with() - .replication(parseReplica(this.conf)); - // Create keyspace with non-keyspace-session - LOG.debug("Create keyspace: {}", stmt); - Session session = this.cluster().connect(); - try { - session.execute(stmt); - } finally { - if (!session.isClosed()) { - session.close(); - } - } - } - - private static Map parseReplica(HugeConfig conf) { - Map replication = new HashMap<>(); - // Replication strategy: SimpleStrategy or NetworkTopologyStrategy - String strategy = conf.get(CassandraOptions.CASSANDRA_STRATEGY); - replication.put("class", strategy); - - switch (strategy) { - case "SimpleStrategy": - List replicas = - conf.get(CassandraOptions.CASSANDRA_REPLICATION); - E.checkArgument(replicas.size() == 1, - "Individual factor value should be provided " + - "with SimpleStrategy for Cassandra"); - int factor = convertFactor(replicas.get(0)); - replication.put("replication_factor", factor); - break; - case "NetworkTopologyStrategy": - // The replicas format is like 'dc1:2,dc2:1' - Map replicaMap = - conf.getMap(CassandraOptions.CASSANDRA_REPLICATION); - for (Map.Entry e : replicaMap.entrySet()) { - E.checkArgument(!e.getKey().isEmpty(), - "The datacenter can't be empty"); - replication.put(e.getKey(), convertFactor(e.getValue())); - } - break; - default: - throw new AssertionError(String.format( - "Illegal replication strategy '%s', valid strategy " + - "is 'SimpleStrategy' or 'NetworkTopologyStrategy'", - strategy)); - } - return replication; - } - - private static int convertFactor(String factor) { - try { - return Integer.parseInt(factor); - } catch (NumberFormatException e) { - throw new BackendException( - "Expect int factor value for SimpleStrategy, " + - "but got '%s'", factor); - } - } - - protected void clearKeyspace() { - // Drop keyspace with non-keyspace-session - Statement stmt = SchemaBuilder.dropKeyspace(this.keyspace).ifExists(); - LOG.debug("Drop keyspace: {}", stmt); - - Session session = this.cluster().connect(); - try { - session.execute(stmt); - } finally { - if (!session.isClosed()) { - session.close(); - } - } - } - - protected void initTables() { - CassandraSessionPool.Session session = this.sessions.session(); - for (CassandraTable table : this.tables()) { - table.init(session); - } - } - - protected void clearTables() { - CassandraSessionPool.Session session = this.sessions.session(); - for (CassandraTable table : this.tables()) { - table.clear(session); - } - } - - protected void truncateTables() { - CassandraSessionPool.Session session = this.sessions.session(); - for (CassandraTable table : this.tables()) { - if (table.isOlap()) { - table.dropTable(session); - } else { - table.truncate(session); - } - } - } - - protected Collection tables() { - return this.tables.values(); - } - - @Override - protected final CassandraTable table(HugeType type) { - return this.table(convertTaskOrServerToVertex(type).string()); - } - - protected final CassandraTable table(String name) { - assert name != null; - CassandraTable table = this.tables.get(name); - if (table == null) { - throw new BackendException("Unsupported table: %s", name); - } - return table; - } - - @Override - protected CassandraSessionPool.Session session(HugeType type) { - this.checkOpened(); - return this.sessions.session(); - } - - protected final void checkClusterConnected() { - E.checkState(this.sessions != null && this.sessions.clusterConnected(), - "Cassandra cluster has not been connected"); - } - - protected static final CassandraBackendEntry castBackendEntry(BackendEntry entry) { - assert entry instanceof CassandraBackendEntry : entry.getClass(); - if (!(entry instanceof CassandraBackendEntry)) { - throw new BackendException("Cassandra store only supports CassandraBackendEntry"); - } - return (CassandraBackendEntry) entry; - } - - /***************************** Store defines *****************************/ - - public static class CassandraSchemaStore extends CassandraStore { - - private final CassandraTables.Counters counters; - - public CassandraSchemaStore(BackendStoreProvider provider, - String keyspace, String store) { - super(provider, keyspace, store); - - this.counters = new CassandraTables.Counters(); - - registerTableManager(HugeType.VERTEX_LABEL, - new CassandraTables.VertexLabel()); - registerTableManager(HugeType.EDGE_LABEL, - new CassandraTables.EdgeLabel()); - registerTableManager(HugeType.PROPERTY_KEY, - new CassandraTables.PropertyKey()); - registerTableManager(HugeType.INDEX_LABEL, - new CassandraTables.IndexLabel()); - } - - @Override - protected Collection tables() { - List tables = new ArrayList<>(super.tables()); - tables.add(this.counters); - return tables; - } - - @Override - public void increaseCounter(HugeType type, long increment) { - this.checkOpened(); - CassandraSessionPool.Session session = super.sessions.session(); - this.counters.increaseCounter(session, type, increment); - } - - @Override - public long getCounter(HugeType type) { - this.checkOpened(); - CassandraSessionPool.Session session = super.sessions.session(); - return this.counters.getCounter(session, type); - } - - @Override - public boolean isSchemaStore() { - return true; - } - } - - public static class CassandraGraphStore extends CassandraStore { - - public CassandraGraphStore(BackendStoreProvider provider, - String keyspace, String store) { - super(provider, keyspace, store); - - registerTableManager(HugeType.VERTEX, - new CassandraTables.Vertex(store)); - - registerTableManager(HugeType.EDGE_OUT, - CassandraTables.Edge.out(store)); - registerTableManager(HugeType.EDGE_IN, - CassandraTables.Edge.in(store)); - - registerTableManager(HugeType.SECONDARY_INDEX, - new CassandraTables.SecondaryIndex(store)); - registerTableManager(HugeType.RANGE_INT_INDEX, - new CassandraTables.RangeIntIndex(store)); - registerTableManager(HugeType.RANGE_FLOAT_INDEX, - new CassandraTables.RangeFloatIndex(store)); - registerTableManager(HugeType.RANGE_LONG_INDEX, - new CassandraTables.RangeLongIndex(store)); - registerTableManager(HugeType.RANGE_DOUBLE_INDEX, - new CassandraTables.RangeDoubleIndex(store)); - registerTableManager(HugeType.SEARCH_INDEX, - new CassandraTables.SearchIndex(store)); - registerTableManager(HugeType.SHARD_INDEX, - new CassandraTables.ShardIndex(store)); - registerTableManager(HugeType.UNIQUE_INDEX, - new CassandraTables.UniqueIndex(store)); - - registerTableManager(this.olapTableName(HugeType.SECONDARY_INDEX), - new CassandraTables.OlapSecondaryIndex(store)); - registerTableManager(this.olapTableName(HugeType.RANGE_INT_INDEX), - new CassandraTables.OlapRangeIntIndex(store)); - registerTableManager(this.olapTableName(HugeType.RANGE_LONG_INDEX), - new CassandraTables.OlapRangeLongIndex(store)); - registerTableManager(this.olapTableName(HugeType.RANGE_FLOAT_INDEX), - new CassandraTables.OlapRangeFloatIndex(store)); - registerTableManager(this.olapTableName(HugeType.RANGE_DOUBLE_INDEX), - new CassandraTables.OlapRangeDoubleIndex(store)); - } - - @Override - public Id nextId(HugeType type) { - throw new UnsupportedOperationException( - "CassandraGraphStore.nextId()"); - } - - @Override - public void increaseCounter(HugeType type, long num) { - throw new UnsupportedOperationException( - "CassandraGraphStore.increaseCounter()"); - } - - @Override - public long getCounter(HugeType type) { - throw new UnsupportedOperationException( - "CassandraGraphStore.getCounter()"); - } - - @Override - public boolean isSchemaStore() { - return false; - } - - /** - * TODO: can we remove this method since createOlapTable would register? - */ - @Override - public void checkAndRegisterOlapTable(Id id) { - CassandraTable table = new CassandraTables.Olap(this.store(), id); - if (!this.existsTable(table.table())) { - throw new HugeException("Not exist table '%s'", table.table()); - } - registerTableManager(this.olapTableName(id), table); - } - - @Override - public void createOlapTable(Id id) { - CassandraTable table = new CassandraTables.Olap(this.store(), id); - table.init(this.session(null)); - registerTableManager(this.olapTableName(id), table); - } - - @Override - public void clearOlapTable(Id id) { - String name = this.olapTableName(id); - CassandraTable table = this.table(name); - if (!this.existsTable(table.table())) { - throw new HugeException("Not exist table '%s'", name); - } - table.truncate(this.session(null)); - } - - @Override - public void removeOlapTable(Id id) { - String name = this.olapTableName(id); - CassandraTable table = this.table(name); - if (!this.existsTable(table.table())) { - throw new HugeException("Not exist table '%s'", name); - } - table.dropTable(this.session(null)); - this.unregisterTableManager(name); - } - } - - public static class CassandraSystemStore extends CassandraGraphStore { - - private final CassandraTables.Meta meta; - - public CassandraSystemStore(BackendStoreProvider provider, String keyspace, String store) { - super(provider, keyspace, store); - - this.meta = new CassandraTables.Meta(); - } - - @Override - public void init() { - super.init(); - this.checkOpened(); - String driverVersion = this.provider().driverVersion(); - this.meta.writeVersion(this.session(null), driverVersion); - LOG.info("Write down the backend version: {}", driverVersion); - } - - @Override - public String storedVersion() { - CassandraSessionPool.Session session = this.session(null); - return this.meta.readVersion(session); - } - - @Override - protected Collection tables() { - List tables = new ArrayList<>(super.tables()); - tables.add(this.meta); - return tables; - } - } -} diff --git a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraStoreProvider.java b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraStoreProvider.java deleted file mode 100644 index adf2d9f3f2..0000000000 --- a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraStoreProvider.java +++ /dev/null @@ -1,75 +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.hugegraph.backend.store.cassandra; - -import org.apache.hugegraph.backend.store.AbstractBackendStoreProvider; -import org.apache.hugegraph.backend.store.BackendStore; -import org.apache.hugegraph.backend.store.cassandra.CassandraStore.CassandraGraphStore; -import org.apache.hugegraph.backend.store.cassandra.CassandraStore.CassandraSchemaStore; -import org.apache.hugegraph.backend.store.cassandra.CassandraStore.CassandraSystemStore; -import org.apache.hugegraph.config.HugeConfig; - -public class CassandraStoreProvider extends AbstractBackendStoreProvider { - - protected String keyspace() { - return this.graph().toLowerCase(); - } - - @Override - protected BackendStore newSchemaStore(HugeConfig config, String store) { - return new CassandraSchemaStore(this, this.keyspace(), store); - } - - @Override - protected BackendStore newGraphStore(HugeConfig config, String store) { - return new CassandraGraphStore(this, this.keyspace(), store); - } - - @Override - protected BackendStore newSystemStore(HugeConfig config, String store) { - return new CassandraSystemStore(this, this.keyspace(), store); - } - - @Override - public String type() { - return "cassandra"; - } - - @Override - public String driverVersion() { - /* - * Versions history: - * [1.0] HugeGraph-1328: supports backend table version checking - * [1.1] HugeGraph-1322: add support for full-text search - * [1.2] #296: support range sortKey feature - * [1.3] #455: fix scylladb backend doesn't support label query in page - * [1.4] #270 & #398: support shard-index and vertex + sortkey prefix, - * also split range table to rangeInt, rangeFloat, - * rangeLong and rangeDouble - * [1.5] #633: support unique index - * [1.6] #661 & #680: support bin serialization for cassandra - * [1.7] #691: support aggregate property - * [1.8] #746: support userdata for indexlabel - * [1.9] #295: support ttl for vertex and edge - * [1.10] #1333: support read frequency for property key - * [1.11] #1506: support olap properties - * [1.11] #1533: add meta table in system store - */ - return "1.11"; - } -} diff --git a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraTable.java b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraTable.java deleted file mode 100644 index 15ad1a7bd3..0000000000 --- a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraTable.java +++ /dev/null @@ -1,679 +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.hugegraph.backend.store.cassandra; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.function.BiFunction; -import java.util.function.Function; - -import org.apache.hugegraph.backend.BackendException; -import org.apache.hugegraph.backend.id.Id; -import org.apache.hugegraph.backend.page.PageState; -import org.apache.hugegraph.backend.query.Aggregate; -import org.apache.hugegraph.backend.query.Condition; -import org.apache.hugegraph.backend.query.Condition.Relation; -import org.apache.hugegraph.backend.query.IdQuery; -import org.apache.hugegraph.backend.query.Query; -import org.apache.hugegraph.backend.query.Query.Order; -import org.apache.hugegraph.backend.store.BackendEntry; -import org.apache.hugegraph.backend.store.BackendTable; -import org.apache.hugegraph.backend.store.Shard; -import org.apache.hugegraph.exception.NotFoundException; -import org.apache.hugegraph.exception.NotSupportException; -import org.apache.hugegraph.iterator.ExtendableIterator; -import org.apache.hugegraph.iterator.WrappedIterator; -import org.apache.hugegraph.type.HugeType; -import org.apache.hugegraph.type.define.HugeKeys; -import org.apache.hugegraph.util.CopyUtil; -import org.apache.hugegraph.util.E; -import org.apache.hugegraph.util.Log; -import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils; -import org.slf4j.Logger; - -import com.datastax.driver.core.ColumnDefinitions.Definition; -import com.datastax.driver.core.DataType; -import com.datastax.driver.core.PagingState; -import com.datastax.driver.core.ResultSet; -import com.datastax.driver.core.Row; -import com.datastax.driver.core.Statement; -import com.datastax.driver.core.exceptions.DriverException; -import com.datastax.driver.core.exceptions.PagingStateException; -import com.datastax.driver.core.querybuilder.Clause; -import com.datastax.driver.core.querybuilder.Clauses; -import com.datastax.driver.core.querybuilder.Delete; -import com.datastax.driver.core.querybuilder.Insert; -import com.datastax.driver.core.querybuilder.QueryBuilder; -import com.datastax.driver.core.querybuilder.Select; -import com.datastax.driver.core.querybuilder.Select.Selection; -import com.datastax.driver.core.querybuilder.Update; -import com.datastax.driver.core.schemabuilder.Create; -import com.datastax.driver.core.schemabuilder.SchemaBuilder; -import com.datastax.driver.core.schemabuilder.SchemaStatement; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; - -public abstract class CassandraTable - extends BackendTable { - - private static final Logger LOG = Log.logger(CassandraTable.class); - private static final int MAX_ELEMENTS_IN_CLAUSE = 65535; - - public CassandraTable(String table) { - super(table); - } - - @Override - protected void registerMetaHandlers() { - this.registerMetaHandler("splits", (session, meta, args) -> { - E.checkArgument(args.length == 1, - "The args count of %s must be 1", meta); - long splitSize = (long) args[0]; - CassandraShard splitter = new CassandraShard(session, - session.keyspace(), - this.table()); - return splitter.getSplits(0, splitSize); - }); - } - - @Override - public boolean queryExist(CassandraSessionPool.Session session, - CassandraBackendEntry.Row entry) { - Query query = new IdQuery.OneIdQuery(HugeType.UNKNOWN, entry.id()); - Iterator iter = this.query(session, query); - try { - return iter.hasNext(); - } finally { - WrappedIterator.close(iter); - } - } - - @Override - public Number queryNumber(CassandraSessionPool.Session session, - Query query) { - Aggregate aggregate = query.aggregateNotNull(); - Iterator results = this.query(query, statement -> { - // Set request timeout to a large value - int timeout = session.aggregateTimeout(); - statement.setReadTimeoutMillis(timeout * 1000); - return session.query(statement); - }, (q, rs) -> { - Row row = rs.one(); - if (row == null) { - return IteratorUtils.of(aggregate.defaultValue()); - } - return IteratorUtils.of(row.getLong(0)); - }); - return aggregate.reduce(results); - } - - @Override - public Iterator query(CassandraSessionPool.Session session, - Query query) { - return this.query(query, session::query, this::results2Entries); - } - - protected Iterator query(Query query, - Function fetcher, - BiFunction> parser) { - ExtendableIterator rs = new ExtendableIterator<>(); - - if (query.limit() == 0L && !query.noLimit()) { - LOG.debug("Return empty result(limit=0) for query {}", query); - return rs; - } - - List query2Select(String table, Query query) { - // Build query - Selection selection = QueryBuilder.select(); - - // Set aggregate - Aggregate aggregate = query.aggregate(); - if (aggregate != null) { - if (aggregate.countAll()) { - selection.countAll(); - } else { - selection.fcall(aggregate.func().string(), aggregate.column()); - } - } - - // Set table - Select select = selection.from(table); - - // NOTE: Cassandra does not support query.offset() - if (query.offset() != 0) { - LOG.debug("Query offset is not supported on Cassandra store " + - "currently, it will be replaced by [0, offset + limit)"); - } - - // Set order-by - for (Map.Entry order : query.orders().entrySet()) { - String name = formatKey(order.getKey()); - if (order.getValue() == Order.ASC) { - select.orderBy(QueryBuilder.asc(name)); - } else { - assert order.getValue() == Order.DESC; - select.orderBy(QueryBuilder.desc(name)); - } - } - - // Is query by id? - List conds = new ArrayList<>(ids.size()); - for (Select id : ids) { - // Query by condition - conds.addAll(this.queryCondition2Select(query, id)); - } - this.setPageState(query, conds); - LOG.debug("Query by conditions: {}", conds); - return conds; - } - } - - protected void setPageState(Query query, List queryId2Select(Query query, Select select) { - // Query by id(s) - if (query.idsSize() == 0) { - return ImmutableList.of(select); - } - - List nameParts = this.idColumnName(); - - List> ids = new ArrayList<>(query.idsSize()); - for (Id id : query.ids()) { - List idParts = this.idColumnValue(id); - if (nameParts.size() != idParts.size()) { - throw new NotFoundException( - "Unsupported ID format: '%s' (should contain %s)", - id, nameParts); - } - ids.add(idParts); - } - - // Query only by partition-key - if (nameParts.size() == 1) { - List idList = new ArrayList<>(ids.size()); - for (List id : ids) { - assert id.size() == 1; - idList.add(id.get(0)); - } - return this.ids2IdSelects(select, nameParts.get(0), idList); - } - - /* - * Query by partition-key + clustering-key - * NOTE: Error if multi-column IN clause include partition key: - * error: multi-column relations can only be applied to clustering - * columns when using: select.where(QueryBuilder.in(names, idList)); - * So we use multi-query instead of IN - */ - List queryCondition2Select(Query query, - Select select) { - // Query by conditions - Collection conditions = query.conditions(); - for (Condition condition : conditions) { - Clause clause = condition2Cql(condition); - select.where(clause); - if (Clauses.needAllowFiltering(clause)) { - select.allowFiltering(); - } - } - return ImmutableList.of(select); - } - - protected Clause condition2Cql(Condition condition) { - switch (condition.type()) { - case AND: - Condition.And and = (Condition.And) condition; - Clause left = condition2Cql(and.left()); - Clause right = condition2Cql(and.right()); - return Clauses.and(left, right); - case OR: - throw new BackendException("Not support OR currently"); - case RELATION: - Condition.Relation r = (Condition.Relation) condition; - return relation2Cql(r); - default: - final String msg = "Unsupported condition: " + condition; - throw new AssertionError(msg); - } - } - - protected Clause relation2Cql(Relation relation) { - String key = relation.serialKey().toString(); - Object value = relation.serialValue(); - - switch (relation.relation()) { - case EQ: - return QueryBuilder.eq(key, value); - case GT: - return QueryBuilder.gt(key, value); - case GTE: - return QueryBuilder.gte(key, value); - case LT: - return QueryBuilder.lt(key, value); - case LTE: - return QueryBuilder.lte(key, value); - case IN: - return Clauses.in(key, (List) value); - case CONTAINS_VALUE: - return QueryBuilder.contains(key, value); - case CONTAINS_KEY: - return QueryBuilder.containsKey(key, value); - case SCAN: - String[] col = pkColumnName().stream() - .map(CassandraTable::formatKey) - .toArray(String[]::new); - Shard shard = (Shard) value; - Object start = QueryBuilder.raw(shard.start()); - Object end = QueryBuilder.raw(shard.end()); - return Clauses.and( - QueryBuilder.gte(QueryBuilder.token(col), start), - QueryBuilder.lt(QueryBuilder.token(col), end)); - /* - * Currently we can't support LIKE due to error: - * "cassandra no viable alternative at input 'like'..." - */ - // case LIKE: - // return QueryBuilder.like(key, value); - case NEQ: - default: - throw new NotSupportException("relation '%s'", relation); - } - } - - private List selects = new ArrayList<>(); - for (int i = 0, j; i < size; i = j) { - j = Math.min(i + MAX_ELEMENTS_IN_CLAUSE, size); - Select idSelect = cloneSelect(select, this.table()); - idSelect.where(QueryBuilder.in(formatKey(key), ids.subList(i, j))); - selects.add(idSelect); - } - return selects; - } - - protected static Select cloneSelect(Select select, String table) { - // NOTE: there is no Select.clone(), just use copy instead - return CopyUtil.copy(select, QueryBuilder.select().from(table)); - } - - protected Iterator results2Entries(Query q, ResultSet r) { - return new CassandraEntryIterator(r, q, (e1, row) -> { - CassandraBackendEntry e2 = row2Entry(q.resultType(), row); - return this.mergeEntries(e1, e2); - }); - } - - protected static CassandraBackendEntry row2Entry(HugeType type, Row row) { - CassandraBackendEntry entry = new CassandraBackendEntry(type); - - List cols = row.getColumnDefinitions().asList(); - for (Definition col : cols) { - String name = col.getName(); - HugeKeys key = CassandraTable.parseKey(name); - Object value = row.getObject(name); - if (value == null) { - assert key == HugeKeys.EXPIRED_TIME; - continue; - } - entry.column(key, value); - } - - return entry; - } - - protected List pkColumnName() { - return idColumnName(); - } - - protected List idColumnName() { - return ImmutableList.of(HugeKeys.ID); - } - - protected List idColumnValue(Id id) { - return ImmutableList.of(id.asObject()); - } - - protected List idColumnValue(CassandraBackendEntry.Row entry) { - return ImmutableList.of(entry.id().asLong()); - } - - protected List modifiableColumnName() { - return ImmutableList.of(HugeKeys.PROPERTIES); - } - - protected BackendEntry mergeEntries(BackendEntry e1, BackendEntry e2) { - // Return the next entry (not merged) - return e2; - } - - public static final String formatKey(HugeKeys key) { - return key.name(); - } - - public static final HugeKeys parseKey(String name) { - return HugeKeys.valueOf(name.toUpperCase()); - } - - public static final Clause formatEQ(HugeKeys key, Object value) { - return QueryBuilder.eq(formatKey(key), value); - } - - /** - * Insert an entire row - */ - @Override - public void insert(CassandraSessionPool.Session session, - CassandraBackendEntry.Row entry) { - session.add(this.buildInsert(entry)); - } - - /** - * Append several elements to the collection column of a row - */ - @Override - public void append(CassandraSessionPool.Session session, - CassandraBackendEntry.Row entry) { - session.add(this.buildAppend(entry)); - } - - /** - * Eliminate several elements from the collection column of a row - */ - @Override - public void eliminate(CassandraSessionPool.Session session, - CassandraBackendEntry.Row entry) { - session.add(this.buildEliminate(entry)); - } - - /** - * Delete an entire row - */ - @Override - public void delete(CassandraSessionPool.Session session, - CassandraBackendEntry.Row entry) { - session.add(this.buildDelete(entry)); - } - - protected Insert buildInsert(CassandraBackendEntry.Row entry) { - assert !entry.columns().isEmpty(); - Insert insert = QueryBuilder.insertInto(this.table()); - - for (Map.Entry c : entry.columns().entrySet()) { - insert.value(formatKey(c.getKey()), c.getValue()); - } - return insert; - } - - protected Update buildAppend(CassandraBackendEntry.Row entry) { - List idNames = this.idColumnName(); - List colNames = this.modifiableColumnName(); - - Map columns = entry.columns(); - - Update update = QueryBuilder.update(table()); - - for (HugeKeys key : colNames) { - if (!columns.containsKey(key)) { - continue; - } - - String name = formatKey(key); - Object value = columns.get(key); - - if (value instanceof Map) { - update.with(QueryBuilder.putAll(name, (Map) value)); - } else if (value instanceof List) { - update.with(QueryBuilder.appendAll(name, (List) value)); - } else { - update.with(QueryBuilder.append(name, value)); - } - } - - for (HugeKeys idName : idNames) { - assert columns.containsKey(idName); - update.where(formatEQ(idName, columns.get(idName))); - } - return update; - } - - protected Update buildEliminate(CassandraBackendEntry.Row entry) { - List idNames = this.idColumnName(); - List colNames = this.modifiableColumnName(); - - Map columns = entry.columns(); - - // Update by id - Update update = QueryBuilder.update(table()); - - for (HugeKeys key : colNames) { - /* - * NOTE: eliminate from map should just pass key, - * if we use the following statement: - * UPDATE vertices SET PROPERTIES=PROPERTIES-{'city':'"Wuhan"'} - * WHERE LABEL='person' AND PRIMARY_VALUES='josh'; - * it will throw a cassandra exception: - * Invalid map literal for properties of type-frozen> - */ - if (!columns.containsKey(key)) { - continue; - } - - String name = formatKey(key); - Object value = columns.get(key); - if (value instanceof Map) { - @SuppressWarnings("rawtypes") - Set keySet = ((Map) value).keySet(); - update.with(QueryBuilder.removeAll(name, keySet)); - } else if (value instanceof Set) { - update.with(QueryBuilder.removeAll(name, (Set) value)); - } else if (value instanceof List) { - Set keySet = new HashSet<>((List) value); - update.with(QueryBuilder.removeAll(name, keySet)); - } else { - update.with(QueryBuilder.remove(name, value)); - } - } - - for (HugeKeys idName : idNames) { - assert columns.containsKey(idName); - update.where(formatEQ(idName, columns.get(idName))); - } - return update; - } - - protected Delete buildDelete(CassandraBackendEntry.Row entry) { - List idNames = this.idColumnName(); - Delete delete = QueryBuilder.delete().from(this.table()); - - if (entry.columns().isEmpty()) { - // Delete just by id - List idValues = this.idColumnValue(entry); - assert idNames.size() == idValues.size(); - - for (int i = 0, n = idNames.size(); i < n; i++) { - delete.where(formatEQ(idNames.get(i), idValues.get(i))); - } - } else { - // Delete just by column keys(must be id columns) - for (HugeKeys idName : idNames) { - // TODO: should support other filters (like containsKey) - delete.where(formatEQ(idName, entry.column(idName))); - } - /* - * TODO: delete by id + keys(like index element-ids -- it seems - * has been replaced by eliminate() method) - */ - } - return delete; - } - - protected void createTable(CassandraSessionPool.Session session, - ImmutableMap partitionKeys, - ImmutableMap clusteringKeys, - ImmutableMap columns) { - - Create table = SchemaBuilder.createTable(this.table()).ifNotExists(); - - for (Map.Entry entry : partitionKeys.entrySet()) { - table.addPartitionKey(formatKey(entry.getKey()), entry.getValue()); - } - for (Map.Entry entry : clusteringKeys.entrySet()) { - table.addClusteringColumn(formatKey(entry.getKey()), - entry.getValue()); - } - for (Map.Entry entry : columns.entrySet()) { - table.addColumn(formatKey(entry.getKey()), entry.getValue()); - } - - LOG.debug("Create table: {}", table); - session.execute(table); - } - - protected void dropTable(CassandraSessionPool.Session session) { - LOG.debug("Drop table: {}", this.table()); - session.execute(SchemaBuilder.dropTable(this.table()).ifExists()); - } - - protected void truncateTable(CassandraSessionPool.Session session) { - LOG.debug("Truncate table: {}", this.table()); - session.execute(QueryBuilder.truncate(this.table())); - } - - protected void createIndex(CassandraSessionPool.Session session, - String indexLabel, HugeKeys column) { - String indexName = joinTableName(this.table(), indexLabel); - SchemaStatement index = SchemaBuilder.createIndex(indexName) - .ifNotExists() - .onTable(this.table()) - .andColumn(formatKey(column)); - LOG.debug("Create index: {}", index); - session.execute(index); - } - - @Override - public void clear(CassandraSessionPool.Session session) { - this.dropTable(session); - } - - public void truncate(CassandraSessionPool.Session session) { - this.truncateTable(session); - } - - public boolean isOlap() { - return false; - } -} diff --git a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraTables.java b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraTables.java deleted file mode 100644 index ece8f2ae8e..0000000000 --- a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraTables.java +++ /dev/null @@ -1,995 +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.hugegraph.backend.store.cassandra; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Iterator; -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; - -import org.apache.hugegraph.backend.BackendException; -import org.apache.hugegraph.backend.id.EdgeId; -import org.apache.hugegraph.backend.id.Id; -import org.apache.hugegraph.backend.id.IdGenerator; -import org.apache.hugegraph.backend.id.IdUtil; -import org.apache.hugegraph.backend.query.Query; -import org.apache.hugegraph.backend.store.BackendEntry; -import org.apache.hugegraph.backend.store.BackendEntryIterator; -import org.apache.hugegraph.type.HugeType; -import org.apache.hugegraph.type.define.Directions; -import org.apache.hugegraph.type.define.HugeKeys; -import org.apache.hugegraph.util.E; - -import com.datastax.driver.core.DataType; -import com.datastax.driver.core.ResultSet; -import com.datastax.driver.core.Row; -import com.datastax.driver.core.Statement; -import com.datastax.driver.core.exceptions.DriverException; -import com.datastax.driver.core.querybuilder.BuiltStatement; -import com.datastax.driver.core.querybuilder.Clause; -import com.datastax.driver.core.querybuilder.Delete; -import com.datastax.driver.core.querybuilder.Insert; -import com.datastax.driver.core.querybuilder.QueryBuilder; -import com.datastax.driver.core.querybuilder.Select; -import com.datastax.driver.core.querybuilder.Update; -import com.datastax.driver.core.querybuilder.Using; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; - -import org.apache.hugegraph.util.HashUtil; - -public class CassandraTables { - - public static final String LABEL_INDEX = "label_index"; - public static final String NAME_INDEX = "name_index"; - - private static final DataType TYPE_PK = DataType.cint(); - private static final DataType TYPE_SL = DataType.cint(); // VL/EL - private static final DataType TYPE_IL = DataType.cint(); - - private static final DataType TYPE_UD = DataType.map(DataType.text(), - DataType.text()); - - private static final DataType TYPE_ID = DataType.blob(); - private static final DataType TYPE_PROP = DataType.blob(); - - private static final DataType TYPE_TTL = DataType.bigint(); - private static final DataType TYPE_EXPIRED_TIME = DataType.bigint(); - - private static final long COMMIT_DELETE_BATCH = Query.COMMIT_BATCH; - - public static class Meta extends CassandraTable { - - public static final String TABLE = HugeType.META.string(); - - public Meta() { - super(TABLE); - } - - @Override - public void init(CassandraSessionPool.Session session) { - ImmutableMap pkeys = ImmutableMap.of( - HugeKeys.NAME, DataType.text() - ); - ImmutableMap ckeys = ImmutableMap.of(); - ImmutableMap columns = ImmutableMap.of( - HugeKeys.VALUE, DataType.text() - ); - - this.createTable(session, pkeys, ckeys, columns); - } - - public void writeVersion(CassandraSessionPool.Session session, - String version) { - Insert insert = QueryBuilder.insertInto(TABLE); - insert.value(formatKey(HugeKeys.NAME), formatKey(HugeKeys.VERSION)); - insert.value(formatKey(HugeKeys.VALUE), version); - session.execute(insert); - } - - public String readVersion(CassandraSessionPool.Session session) { - Clause where = formatEQ(HugeKeys.NAME, formatKey(HugeKeys.VERSION)); - Select select = QueryBuilder.select(formatKey(HugeKeys.VALUE)) - .from(TABLE); - select.where(where); - Row row = session.execute(select).one(); - if (row == null) { - return null; - } - return row.getString(formatKey(HugeKeys.VALUE)); - } - } - - public static class Counters extends CassandraTable { - - public static final String TABLE = HugeType.COUNTER.string(); - - public Counters() { - super(TABLE); - } - - @Override - public void init(CassandraSessionPool.Session session) { - ImmutableMap pkeys = ImmutableMap.of( - HugeKeys.SCHEMA_TYPE, DataType.text() - ); - ImmutableMap ckeys = ImmutableMap.of(); - ImmutableMap columns = ImmutableMap.of( - HugeKeys.ID, DataType.counter() - ); - - this.createTable(session, pkeys, ckeys, columns); - } - - public long getCounter(CassandraSessionPool.Session session, - HugeType type) { - Clause where = formatEQ(HugeKeys.SCHEMA_TYPE, type.name()); - Select select = QueryBuilder.select(formatKey(HugeKeys.ID)) - .from(TABLE); - select.where(where); - Row row = session.execute(select).one(); - if (row == null) { - return 0L; - } else { - return row.getLong(formatKey(HugeKeys.ID)); - } - } - - public void increaseCounter(CassandraSessionPool.Session session, - HugeType type, long increment) { - Update update = QueryBuilder.update(TABLE); - update.with(QueryBuilder.incr(formatKey(HugeKeys.ID), increment)); - update.where(formatEQ(HugeKeys.SCHEMA_TYPE, type.name())); - session.execute(update); - } - } - - public static class VertexLabel extends CassandraTable { - - public static final String TABLE = HugeType.VERTEX_LABEL.string(); - - public VertexLabel() { - super(TABLE); - } - - @Override - public void init(CassandraSessionPool.Session session) { - ImmutableMap pkeys = ImmutableMap.of( - HugeKeys.ID, TYPE_SL - ); - ImmutableMap ckeys = ImmutableMap.of(); - ImmutableMap columns = ImmutableMap - .builder() - .put(HugeKeys.NAME, DataType.text()) - .put(HugeKeys.ID_STRATEGY, DataType.tinyint()) - .put(HugeKeys.PRIMARY_KEYS, DataType.list(TYPE_PK)) - .put(HugeKeys.NULLABLE_KEYS, DataType.set(TYPE_PK)) - .put(HugeKeys.INDEX_LABELS, DataType.set(TYPE_IL)) - .put(HugeKeys.PROPERTIES, DataType.set(TYPE_PK)) - .put(HugeKeys.ENABLE_LABEL_INDEX, DataType.cboolean()) - .put(HugeKeys.USER_DATA, TYPE_UD) - .put(HugeKeys.STATUS, DataType.tinyint()) - .put(HugeKeys.TTL, TYPE_TTL) - .put(HugeKeys.TTL_START_TIME, TYPE_PK) - .build(); - - this.createTable(session, pkeys, ckeys, columns); - this.createIndex(session, NAME_INDEX, HugeKeys.NAME); - } - } - - public static class EdgeLabel extends CassandraTable { - - public static final String TABLE = HugeType.EDGE_LABEL.string(); - - public EdgeLabel() { - super(TABLE); - } - - @Override - public void init(CassandraSessionPool.Session session) { - ImmutableMap pkeys = ImmutableMap.of( - HugeKeys.ID, TYPE_SL - ); - ImmutableMap ckeys = ImmutableMap.of(); - ImmutableMap columns = ImmutableMap - .builder() - .put(HugeKeys.NAME, DataType.text()) - .put(HugeKeys.FREQUENCY, DataType.tinyint()) - .put(HugeKeys.SOURCE_LABEL, TYPE_SL) - .put(HugeKeys.TARGET_LABEL, TYPE_SL) - .put(HugeKeys.SORT_KEYS, DataType.list(TYPE_PK)) - .put(HugeKeys.NULLABLE_KEYS, DataType.set(TYPE_PK)) - .put(HugeKeys.INDEX_LABELS, DataType.set(TYPE_IL)) - .put(HugeKeys.PROPERTIES, DataType.set(TYPE_PK)) - .put(HugeKeys.ENABLE_LABEL_INDEX, DataType.cboolean()) - .put(HugeKeys.USER_DATA, TYPE_UD) - .put(HugeKeys.STATUS, DataType.tinyint()) - .put(HugeKeys.TTL, TYPE_TTL) - .put(HugeKeys.TTL_START_TIME, TYPE_PK) - .build(); - - this.createTable(session, pkeys, ckeys, columns); - this.createIndex(session, NAME_INDEX, HugeKeys.NAME); - } - } - - public static class PropertyKey extends CassandraTable { - - public static final String TABLE = HugeType.PROPERTY_KEY.string(); - - public PropertyKey() { - super(TABLE); - } - - @Override - public void init(CassandraSessionPool.Session session) { - ImmutableMap pkeys = ImmutableMap.of( - HugeKeys.ID, DataType.cint() - ); - ImmutableMap ckeys = ImmutableMap.of(); - ImmutableMap columns = ImmutableMap - .builder() - .put(HugeKeys.NAME, DataType.text()) - .put(HugeKeys.DATA_TYPE, DataType.tinyint()) - .put(HugeKeys.CARDINALITY, DataType.tinyint()) - .put(HugeKeys.AGGREGATE_TYPE, DataType.tinyint()) - .put(HugeKeys.WRITE_TYPE, DataType.tinyint()) - .put(HugeKeys.PROPERTIES, DataType.set(TYPE_PK)) - .put(HugeKeys.USER_DATA, TYPE_UD) - .put(HugeKeys.STATUS, DataType.tinyint()) - .build(); - - this.createTable(session, pkeys, ckeys, columns); - this.createIndex(session, NAME_INDEX, HugeKeys.NAME); - } - } - - public static class IndexLabel extends CassandraTable { - - public static final String TABLE = HugeType.INDEX_LABEL.string(); - - public IndexLabel() { - super(TABLE); - } - - @Override - public void init(CassandraSessionPool.Session session) { - ImmutableMap pkeys = ImmutableMap.of( - HugeKeys.ID, TYPE_IL - ); - ImmutableMap ckeys = ImmutableMap.of(); - ImmutableMap columns = ImmutableMap - .builder() - .put(HugeKeys.NAME, DataType.text()) - .put(HugeKeys.BASE_TYPE, DataType.tinyint()) - .put(HugeKeys.BASE_VALUE, TYPE_SL) - .put(HugeKeys.INDEX_TYPE, DataType.tinyint()) - .put(HugeKeys.FIELDS, DataType.list(TYPE_PK)) - .put(HugeKeys.USER_DATA, TYPE_UD) - .put(HugeKeys.STATUS, DataType.tinyint()) - .build(); - - this.createTable(session, pkeys, ckeys, columns); - this.createIndex(session, NAME_INDEX, HugeKeys.NAME); - } - } - - public static class Vertex extends CassandraTable { - - public static final String TABLE = HugeType.VERTEX.string(); - - public Vertex(String store) { - super(joinTableName(store, TABLE)); - } - - @Override - public void init(CassandraSessionPool.Session session) { - ImmutableMap pkeys = ImmutableMap.of( - HugeKeys.ID, TYPE_ID - ); - ImmutableMap ckeys = ImmutableMap.of(); - ImmutableMap columns = ImmutableMap.of( - HugeKeys.LABEL, TYPE_SL, - HugeKeys.PROPERTIES, DataType.map(TYPE_PK, TYPE_PROP), - HugeKeys.EXPIRED_TIME, TYPE_EXPIRED_TIME - ); - - this.createTable(session, pkeys, ckeys, columns); - this.createIndex(session, LABEL_INDEX, HugeKeys.LABEL); - } - - @Override - public void insert(CassandraSessionPool.Session session, - CassandraBackendEntry.Row entry) { - Insert insert = this.buildInsert(entry); - session.add(setTtl(insert, entry)); - } - - @Override - public void append(CassandraSessionPool.Session session, - CassandraBackendEntry.Row entry) { - Update append = this.buildAppend(entry); - session.add(setTtl(append, entry)); - } - } - - public static class Edge extends CassandraTable { - - public static final String TABLE_SUFFIX = HugeType.EDGE.string(); - - private final String store; - private final Directions direction; - - protected Edge(String store, Directions direction) { - super(joinTableName(store, table(direction))); - this.store = store; - this.direction = direction; - } - - protected String edgesTable(Directions direction) { - return joinTableName(this.store, table(direction)); - } - - protected Directions direction() { - return this.direction; - } - - protected String labelIndexTable() { - return this.table(); - } - - @Override - public void init(CassandraSessionPool.Session session) { - ImmutableMap pkeys = ImmutableMap.of( - HugeKeys.OWNER_VERTEX, TYPE_ID - ); - ImmutableMap ckeys = ImmutableMap.of( - HugeKeys.DIRECTION, DataType.tinyint(), - HugeKeys.LABEL, TYPE_SL, - HugeKeys.SORT_VALUES, DataType.text(), - HugeKeys.OTHER_VERTEX, TYPE_ID - ); - ImmutableMap columns = ImmutableMap.of( - HugeKeys.PROPERTIES, DataType.map(TYPE_PK, TYPE_PROP), - HugeKeys.EXPIRED_TIME, TYPE_EXPIRED_TIME - ); - - this.createTable(session, pkeys, ckeys, columns); - - /* - * Only out-edges table needs label index because we query edges - * by label from out-edges table - */ - if (this.direction == Directions.OUT) { - this.createIndex(session, LABEL_INDEX, HugeKeys.LABEL); - } - } - - @Override - public void insert(CassandraSessionPool.Session session, - CassandraBackendEntry.Row entry) { - Insert insert = this.buildInsert(entry); - session.add(setTtl(insert, entry)); - } - - @Override - public void append(CassandraSessionPool.Session session, - CassandraBackendEntry.Row entry) { - Update update = this.buildAppend(entry); - session.add(setTtl(update, entry)); - } - - @Override - protected List pkColumnName() { - return ImmutableList.of(HugeKeys.OWNER_VERTEX); - } - - @Override - protected List idColumnName() { - return Arrays.stream(EdgeId.KEYS) - .filter(key -> !Objects.equals(key, HugeKeys.SUB_LABEL)) - .collect(Collectors.toList()); - } - - @Override - protected List idColumnValue(Id id) { - EdgeId edgeId; - if (id instanceof EdgeId) { - edgeId = (EdgeId) id; - } else { - String[] idParts = EdgeId.split(id); - if (idParts.length == 1) { - // Delete edge by label - return Arrays.asList(idParts); - } - id = IdUtil.readString(id.asString()); - edgeId = EdgeId.parse(id.asString()); - } - - E.checkState(edgeId.direction() == this.direction, - "Can't query %s edges from %s edges table", - edgeId.direction(), this.direction); - - return idColumnValue(edgeId); - } - - protected final List idColumnValue(EdgeId edgeId) { - // TODO: move to Serializer - List list = new ArrayList<>(5); - list.add(IdUtil.writeBinString(edgeId.ownerVertexId())); - list.add(edgeId.directionCode()); - list.add(edgeId.edgeLabelId().asLong()); - list.add(edgeId.sortValues()); - list.add(IdUtil.writeBinString(edgeId.otherVertexId())); - return list; - } - - @Override - public void delete(CassandraSessionPool.Session session, - CassandraBackendEntry.Row entry) { - /* - * TODO: Delete edge by label - * Need to implement the framework that can delete with query - * which contains id or condition. - */ - - // Let super class do delete if not deleting edge by label - List idParts = this.idColumnValue(entry.id()); - if (idParts.size() > 1 || !entry.columns().isEmpty()) { - super.delete(session, entry); - return; - } - - // The only element is labeled - this.deleteEdgesByLabel(session, entry.id()); - } - - protected void deleteEdgesByLabel(CassandraSessionPool.Session session, - Id label) { - // Edges in edges_in table will be deleted when direction is OUT - if (this.direction == Directions.IN) { - return; - } - - final String OWNER_VERTEX = formatKey(HugeKeys.OWNER_VERTEX); - final String SORT_VALUES = formatKey(HugeKeys.SORT_VALUES); - final String OTHER_VERTEX = formatKey(HugeKeys.OTHER_VERTEX); - - // Query edges by label index - Select select = QueryBuilder.select().from(this.labelIndexTable()); - select.where(formatEQ(HugeKeys.LABEL, label.asLong())); - - ResultSet rs; - try { - rs = session.execute(select); - } catch (DriverException e) { - throw new BackendException("Failed to query edges " + - "with label '%s' for deleting", e, label); - } - - // Delete edges - long count = 0L; - for (Row row : rs) { - Object ownerVertex = row.getObject(OWNER_VERTEX); - Object sortValues = row.getObject(SORT_VALUES); - Object otherVertex = row.getObject(OTHER_VERTEX); - - // Delete OUT edges from edges_out table - session.add(buildDelete(label, ownerVertex, Directions.OUT, - sortValues, otherVertex)); - // Delete IN edges from edges_in table - session.add(buildDelete(label, otherVertex, Directions.IN, - sortValues, ownerVertex)); - - count += 2L; - if (count >= COMMIT_DELETE_BATCH) { - session.commit(); - count = 0; - } - } - if (count > 0L) { - session.commit(); - } - } - - private Delete buildDelete(Id label, Object ownerVertex, - Directions direction, Object sortValues, - Object otherVertex) { - Delete delete = QueryBuilder.delete().from(edgesTable(direction)); - delete.where(formatEQ(HugeKeys.OWNER_VERTEX, ownerVertex)); - delete.where(formatEQ(HugeKeys.DIRECTION, - EdgeId.directionToCode(direction))); - delete.where(formatEQ(HugeKeys.LABEL, label.asLong())); - delete.where(formatEQ(HugeKeys.SORT_VALUES, sortValues)); - delete.where(formatEQ(HugeKeys.OTHER_VERTEX, otherVertex)); - return delete; - } - - @Override - protected BackendEntry mergeEntries(BackendEntry e1, BackendEntry e2) { - // Merge edges into vertex - // TODO: merge rows before calling row2Entry() - - CassandraBackendEntry current = (CassandraBackendEntry) e1; - CassandraBackendEntry next = (CassandraBackendEntry) e2; - - E.checkState(current == null || current.type().isVertex(), - "The current entry must be null or VERTEX"); - E.checkState(next != null && next.type().isEdge(), - "The next entry must be EDGE"); - - long maxSize = BackendEntryIterator.INLINE_BATCH_SIZE; - if (current != null && current.subRows().size() < maxSize) { - Object nextVertexId = next.column(HugeKeys.OWNER_VERTEX); - if (current.id().equals(IdGenerator.of(nextVertexId))) { - current.subRow(next.row()); - return current; - } - } - - return this.wrapByVertex(next); - } - - private CassandraBackendEntry wrapByVertex(CassandraBackendEntry edge) { - assert edge.type().isEdge(); - Object ownerVertex = edge.column(HugeKeys.OWNER_VERTEX); - E.checkState(ownerVertex != null, "Invalid backend entry"); - Id vertexId = IdGenerator.of(ownerVertex); - CassandraBackendEntry vertex = new CassandraBackendEntry( - HugeType.VERTEX, vertexId); - - vertex.column(HugeKeys.ID, ownerVertex); - vertex.column(HugeKeys.PROPERTIES, ImmutableMap.of()); - - vertex.subRow(edge.row()); - return vertex; - } - - private static String table(Directions direction) { - assert direction == Directions.OUT || direction == Directions.IN; - return direction.type().string() + TABLE_SUFFIX; - } - - public static CassandraTable out(String store) { - return new Edge(store, Directions.OUT); - } - - public static CassandraTable in(String store) { - return new Edge(store, Directions.IN); - } - } - - public static class SecondaryIndex extends CassandraTable { - - public static final String TABLE = HugeType.SECONDARY_INDEX.string(); - - public SecondaryIndex(String store) { - this(store, TABLE); - } - - protected SecondaryIndex(String store, String table) { - super(joinTableName(store, table)); - } - - @Override - public void init(CassandraSessionPool.Session session) { - ImmutableMap pkeys = ImmutableMap.of( - HugeKeys.FIELD_VALUES, DataType.text() - ); - ImmutableMap ckeys = ImmutableMap.of( - HugeKeys.INDEX_LABEL_ID, TYPE_IL, - HugeKeys.ELEMENT_IDS, TYPE_ID - ); - ImmutableMap columns = ImmutableMap.of( - HugeKeys.EXPIRED_TIME, TYPE_EXPIRED_TIME - ); - - this.createTable(session, pkeys, ckeys, columns); - } - - @Override - protected List idColumnName() { - return ImmutableList.of(HugeKeys.FIELD_VALUES, - HugeKeys.INDEX_LABEL_ID, - HugeKeys.ELEMENT_IDS); - } - - @Override - protected List modifiableColumnName() { - return ImmutableList.of(); - } - - @Override - public void delete(CassandraSessionPool.Session session, - CassandraBackendEntry.Row entry) { - String fieldValues = entry.column(HugeKeys.FIELD_VALUES); - if (fieldValues != null) { - super.delete(session, entry); - return; - } - - Long indexLabel = entry.column(HugeKeys.INDEX_LABEL_ID); - if (indexLabel == null) { - throw new BackendException("SecondaryIndex deletion needs " + - "INDEX_LABEL_ID, but not provided."); - } - - Select select = QueryBuilder.select().from(this.table()); - select.where(formatEQ(HugeKeys.INDEX_LABEL_ID, indexLabel)); - select.allowFiltering(); - - ResultSet rs; - try { - rs = session.execute(select); - } catch (DriverException e) { - throw new BackendException("Failed to query secondary " + - "indexes with index label id '%s' for deleting", - indexLabel, e); - } - - final String FIELD_VALUES = formatKey(HugeKeys.FIELD_VALUES); - long count = 0L; - for (Row r : rs) { - fieldValues = r.get(FIELD_VALUES, String.class); - Delete delete = QueryBuilder.delete().from(this.table()); - delete.where(formatEQ(HugeKeys.INDEX_LABEL_ID, indexLabel)); - delete.where(formatEQ(HugeKeys.FIELD_VALUES, fieldValues)); - session.add(delete); - - if (++count >= COMMIT_DELETE_BATCH) { - session.commit(); - count = 0L; - } - } - } - - @Override - public void insert(CassandraSessionPool.Session session, - CassandraBackendEntry.Row entry) { - throw new BackendException("SecondaryIndex insertion is not supported."); - } - - @Override - public void append(CassandraSessionPool.Session session, - CassandraBackendEntry.Row entry) { - assert entry.columns().size() == 3 || entry.columns().size() == 4; - Insert insert = this.buildInsert(entry); - session.add(setTtl(insert, entry)); - } - - @Override - public void eliminate(CassandraSessionPool.Session session, - CassandraBackendEntry.Row entry) { - assert entry.columns().size() == 3 || entry.columns().size() == 4; - this.delete(session, entry); - } - } - - public static class SearchIndex extends SecondaryIndex { - - public static final String TABLE = HugeType.SEARCH_INDEX.string(); - - public SearchIndex(String store) { - super(store, TABLE); - } - - @Override - public void insert(CassandraSessionPool.Session session, - CassandraBackendEntry.Row entry) { - throw new BackendException("SearchIndex insertion is not supported."); - } - } - - /** - * TODO: set field value as key and set element id as value - */ - public static class UniqueIndex extends SecondaryIndex { - - public static final String TABLE = HugeType.UNIQUE_INDEX.string(); - - public UniqueIndex(String store) { - super(store, TABLE); - } - - @Override - public void insert(CassandraSessionPool.Session session, - CassandraBackendEntry.Row entry) { - throw new BackendException("UniqueIndex insertion is not supported."); - } - } - - public abstract static class RangeIndex extends CassandraTable { - - protected RangeIndex(String store, String table) { - super(joinTableName(store, table)); - } - - @Override - public void init(CassandraSessionPool.Session session) { - ImmutableMap pkeys = ImmutableMap.of( - HugeKeys.INDEX_LABEL_ID, TYPE_IL - ); - ImmutableMap ckeys = ImmutableMap.of( - HugeKeys.FIELD_VALUES, this.fieldValuesType(), - HugeKeys.ELEMENT_IDS, TYPE_ID - ); - ImmutableMap columns = ImmutableMap.of( - HugeKeys.EXPIRED_TIME, TYPE_EXPIRED_TIME - ); - - this.createTable(session, pkeys, ckeys, columns); - } - - protected DataType fieldValuesType() { - return DataType.decimal(); - } - - @Override - protected List idColumnName() { - return ImmutableList.of(HugeKeys.INDEX_LABEL_ID, - HugeKeys.FIELD_VALUES, - HugeKeys.ELEMENT_IDS); - } - - @Override - protected List modifiableColumnName() { - return ImmutableList.of(); - } - - @Override - public void delete(CassandraSessionPool.Session session, - CassandraBackendEntry.Row entry) { - Object fieldValues = entry.column(HugeKeys.FIELD_VALUES); - if (fieldValues != null) { - super.delete(session, entry); - return; - } - - Long indexLabel = entry.column(HugeKeys.INDEX_LABEL_ID); - if (indexLabel == null) { - throw new BackendException("Range index deletion needs INDEX_LABEL_ID, " + - "but not provided."); - } - - Delete delete = QueryBuilder.delete().from(this.table()); - delete.where(formatEQ(HugeKeys.INDEX_LABEL_ID, indexLabel)); - session.add(delete); - } - - @Override - public void insert(CassandraSessionPool.Session session, - CassandraBackendEntry.Row entry) { - throw new BackendException("RangeIndex insertion is not supported."); - } - - @Override - public void append(CassandraSessionPool.Session session, - CassandraBackendEntry.Row entry) { - assert entry.columns().size() == 3 || entry.columns().size() == 4; - Insert insert = this.buildInsert(entry); - session.add(setTtl(insert, entry)); - } - - @Override - public void eliminate(CassandraSessionPool.Session session, - CassandraBackendEntry.Row entry) { - assert entry.columns().size() == 3 || entry.columns().size() == 4; - this.delete(session, entry); - } - } - - public static class RangeIntIndex extends RangeIndex { - - public static final String TABLE = HugeType.RANGE_INT_INDEX.string(); - - public RangeIntIndex(String store) { - super(store, TABLE); - } - - @Override - protected DataType fieldValuesType() { - return DataType.cint(); - } - } - - public static class RangeFloatIndex extends RangeIndex { - - public static final String TABLE = HugeType.RANGE_FLOAT_INDEX.string(); - - public RangeFloatIndex(String store) { - super(store, TABLE); - } - - @Override - protected DataType fieldValuesType() { - return DataType.cfloat(); - } - } - - public static class RangeLongIndex extends RangeIndex { - - public static final String TABLE = HugeType.RANGE_LONG_INDEX.string(); - - public RangeLongIndex(String store) { - super(store, TABLE); - } - - @Override - protected DataType fieldValuesType() { - // TODO: DataType.varint() - return DataType.bigint(); - } - } - - public static class RangeDoubleIndex extends RangeIndex { - - public static final String TABLE = HugeType.RANGE_DOUBLE_INDEX.string(); - - public RangeDoubleIndex(String store) { - super(store, TABLE); - } - - @Override - protected DataType fieldValuesType() { - return DataType.cdouble(); - } - } - - public static class ShardIndex extends RangeIndex { - - public static final String TABLE = HugeType.SHARD_INDEX.string(); - - public ShardIndex(String store) { - super(store, TABLE); - } - - @Override - protected DataType fieldValuesType() { - return DataType.text(); - } - - @Override - public void insert(CassandraSessionPool.Session session, - CassandraBackendEntry.Row entry) { - throw new BackendException("ShardIndex insertion is not supported."); - } - } - - public static class Olap extends CassandraTable { - - public static final String TABLE = HugeType.OLAP.string(); - - private Id pkId; - - public Olap(String store, Id id) { - super(joinTableName(store, joinTableName(TABLE, id.asString()))); - this.pkId = id; - } - - @Override - public void init(CassandraSessionPool.Session session) { - ImmutableMap pkeys = ImmutableMap.of( - HugeKeys.ID, TYPE_ID - ); - ImmutableMap ckeys = ImmutableMap.of(); - ImmutableMap columns = ImmutableMap.of( - HugeKeys.PROPERTY_VALUE, TYPE_PROP - ); - - this.createTable(session, pkeys, ckeys, columns); - } - - @Override - protected Iterator results2Entries(Query q, ResultSet r) { - return new CassandraEntryIterator(r, q, (e1, row) -> { - CassandraBackendEntry e2 = row2Entry(q.resultType(), row); - e2.subId(this.pkId); - return this.mergeEntries(e1, e2); - }); - } - - @Override - public boolean isOlap() { - return true; - } - } - - public static class OlapSecondaryIndex extends SecondaryIndex { - - public static final String TABLE = HugeType.OLAP.string(); - - public OlapSecondaryIndex(String store) { - this(store, TABLE); - } - - protected OlapSecondaryIndex(String store, String table) { - super(joinTableName(store, table)); - } - } - - public static class OlapRangeIntIndex extends RangeIntIndex { - - public static final String TABLE = HugeType.OLAP.string(); - - public OlapRangeIntIndex(String store) { - this(store, TABLE); - } - - protected OlapRangeIntIndex(String store, String table) { - super(joinTableName(store, table)); - } - } - - public static class OlapRangeLongIndex extends RangeLongIndex { - - public static final String TABLE = HugeType.OLAP.string(); - - public OlapRangeLongIndex(String store) { - this(store, TABLE); - } - - protected OlapRangeLongIndex(String store, String table) { - super(joinTableName(store, table)); - } - } - - public static class OlapRangeFloatIndex extends RangeFloatIndex { - - public static final String TABLE = HugeType.OLAP.string(); - - public OlapRangeFloatIndex(String store) { - this(store, TABLE); - } - - protected OlapRangeFloatIndex(String store, String table) { - super(joinTableName(store, table)); - } - } - - public static class OlapRangeDoubleIndex extends RangeDoubleIndex { - - public static final String TABLE = HugeType.OLAP.string(); - - public OlapRangeDoubleIndex(String store) { - this(store, TABLE); - } - - protected OlapRangeDoubleIndex(String store, String table) { - super(joinTableName(store, table)); - } - } - - private static Statement setTtl(BuiltStatement statement, - CassandraBackendEntry.Row entry) { - long ttl = entry.ttl(); - if (ttl != 0L) { - int calcTtl = (int) Math.ceil(ttl / 1000D); - Using usingTtl = QueryBuilder.ttl(calcTtl); - if (statement instanceof Insert) { - ((Insert) statement).using(usingTtl); - } else { - assert statement instanceof Update; - ((Update) statement).using(usingTtl); - } - } - return statement; - } -} diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/Condition.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/Condition.java index 8d9ecd4332..e77f2f0b1e 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/Condition.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/Condition.java @@ -131,8 +131,8 @@ public enum RelationType implements BiPredicate { SCAN("scan", (v1, v2) -> { assert v2 != null; /* - * TODO: we still have no way to determine accurately, since - * some backends may scan with token(column) like cassandra. + * TODO: we still have no way to determine accurately for all + * backend scan implementations. */ return true; }); diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/Shard.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/Shard.java index 57918cb667..3f1d2bf9e8 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/Shard.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/Shard.java @@ -18,7 +18,7 @@ package org.apache.hugegraph.backend.store; /** - * Shard is used for backend storage (like cassandra, hbase) scanning + * Shard is used for distributed backend storage scanning. * operations. Each shard represents a range of tokens for a node. * Reading data from a given shard does not cross multiple nodes. */ diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/GraphTransaction.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/GraphTransaction.java index a0792ee99e..0c962b11a2 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/GraphTransaction.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/GraphTransaction.java @@ -2275,8 +2275,7 @@ private void traverseByLabel(SchemaLabel label, while (iter.hasNext()) { consumer.accept(iter.next()); /* - * Commit per batch to avoid too much data in a single commit, - * especially for Cassandra backend + * Commit per batch to avoid too much data in a single commit. */ this.commitIfGtSize(GraphTransaction.COMMIT_BATCH); } @@ -2301,7 +2300,7 @@ private void traverseByLabel(SchemaLabel label, consumer.accept(e); /* * Commit per batch to avoid too much data in a single - * commit, especially for Cassandra backend + * commit. */ this.commitIfGtSize(GraphTransaction.COMMIT_BATCH); } diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/config/CoreOptions.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/config/CoreOptions.java index 9aa60e398a..c10de4bf43 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/config/CoreOptions.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/config/CoreOptions.java @@ -62,7 +62,7 @@ public class CoreOptions extends OptionHolder { public static final ConfigOption STORE = new ConfigOption<>( "store", - "The database name like Cassandra Keyspace.", + "The backend database namespace.", disallowEmpty(), "hugegraph" ); @@ -76,7 +76,7 @@ public class CoreOptions extends OptionHolder { public static final ConfigOption SERIALIZER = new ConfigOption<>( "serializer", - "The serializer for backend store, like: text/binary/cassandra.", + "The serializer for backend store, like: text/binary.", disallowEmpty(), "text" ); diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/security/HugeSecurityManager.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/security/HugeSecurityManager.java index 13ca801220..25fb7f88b1 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/security/HugeSecurityManager.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/security/HugeSecurityManager.java @@ -64,9 +64,7 @@ public class HugeSecurityManager extends SecurityManager { "file.separator", // Sofa "java.specification.version", - // MySQL "socksProxyHost", - // PostgreSQL "file.encoding" ); @@ -79,21 +77,6 @@ public class HugeSecurityManager extends SecurityManager { ImmutableSet.of("asyncRemoveIndexLeft") ); - private static final Map> BACKEND_SOCKET = ImmutableMap.of( - // Fixed #758 - "org.apache.hugegraph.backend.store.mysql.MysqlStore", - ImmutableSet.of("open", "init", "clear", "opened", "initialized") - ); - - private static final Map> BACKEND_THREAD = ImmutableMap.of( - // Fixed #758 - "org.apache.hugegraph.backend.store.cassandra.CassandraStore", - ImmutableSet.of("open", "opened", "init"), - // Fixed https://github.com/apache/hugegraph/pull/892#issuecomment-598545072 - "com.datastax.driver.core.AbstractSession", - ImmutableSet.of("execute") - ); - private static final Map> BACKEND_SNAPSHOT = ImmutableMap.of( "org.apache.hugegraph.backend.store.AbstractBackendStoreProvider", ImmutableSet.of("createSnapshot", "resumeSnapshot"), @@ -171,7 +154,7 @@ public void checkLink(String lib) { public void checkAccess(Thread thread) { if (callFromGremlin() && !callFromCaffeine() && !callFromAsyncTasks() && !callFromEventHubNotify() && - !callFromBackendThread() && !callFromBackendHbase() && + !callFromBackendHbase() && !callFromRaft() && !callFromSofaRpc() && !callFromIgnoreCheckedClass()) { throw newSecurityException("Not allowed to access thread via Gremlin"); } @@ -182,7 +165,7 @@ public void checkAccess(Thread thread) { public void checkAccess(ThreadGroup threadGroup) { if (callFromGremlin() && !callFromCaffeine() && !callFromAsyncTasks() && !callFromEventHubNotify() && - !callFromBackendThread() && !callFromBackendHbase() && + !callFromBackendHbase() && !callFromRaft() && !callFromSofaRpc() && !callFromIgnoreCheckedClass()) { throw newSecurityException("Not allowed to access thread group via Gremlin"); @@ -208,8 +191,7 @@ public void checkExec(String cmd) { @Override public void checkRead(FileDescriptor fd) { - if (callFromGremlin() && !callFromBackendSocket() && !callFromRaft() && - !callFromSofaRpc()) { + if (callFromGremlin() && !callFromRaft() && !callFromSofaRpc()) { throw newSecurityException("Not allowed to read fd via Gremlin"); } super.checkRead(fd); @@ -235,8 +217,7 @@ public void checkRead(String file, Object context) { @Override public void checkWrite(FileDescriptor fd) { - if (callFromGremlin() && !callFromBackendSocket() && !callFromRaft() && - !callFromSofaRpc()) { + if (callFromGremlin() && !callFromRaft() && !callFromSofaRpc()) { throw newSecurityException("Not allowed to write fd via Gremlin"); } super.checkWrite(fd); @@ -276,8 +257,8 @@ public void checkAccept(String host, int port) { @Override public void checkConnect(String host, int port) { - if (callFromGremlin() && !callFromBackendSocket() && - !callFromBackendHbase() && !callFromRaft() && !callFromSofaRpc()) { + if (callFromGremlin() && !callFromBackendHbase() && + !callFromRaft() && !callFromSofaRpc()) { throw newSecurityException("Not allowed to connect socket via Gremlin"); } super.checkConnect(host, port); @@ -399,16 +380,6 @@ private static boolean callFromCaffeine() { return callFromWorkerWithClass(CAFFEINE_CLASSES); } - private static boolean callFromBackendSocket() { - // Fixed issue #758 - return callFromMethods(BACKEND_SOCKET); - } - - private static boolean callFromBackendThread() { - // Fixed issue #758 - return callFromMethods(BACKEND_THREAD); - } - private static boolean callFromEventHubNotify() { // Fixed issue #758 // notify() will create thread when submit a task to executor diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/TaskCallable.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/TaskCallable.java index ec066fbc04..4e0550f5c9 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/TaskCallable.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/TaskCallable.java @@ -42,15 +42,7 @@ public abstract class TaskCallable implements Callable { * task input size exceeds TASK_INPUT_SIZE_LIMIT or task result size * exceeds TASK_RESULT_SIZE_LIMIT */ - "The max length of bytes is", - /* - * "Batch too large" exception message occurs when using - * cassandra store and task input size is in - * [batch_size_fail_threshold_in_kb, TASK_INPUT_SIZE_LIMIT) or - * task result size is in - * [batch_size_fail_threshold_in_kb, TASK_RESULT_SIZE_LIMIT) - */ - "Batch too large" + "The max length of bytes is" ); private HugeTask task = null; diff --git a/hugegraph-server/hugegraph-dist/docker/example/docker-compose-cassandra.yml b/hugegraph-server/hugegraph-dist/docker/example/docker-compose-cassandra.yml deleted file mode 100644 index 82b56fd288..0000000000 --- a/hugegraph-server/hugegraph-dist/docker/example/docker-compose-cassandra.yml +++ /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. -# - -version: "3" - -services: - graph: - image: hugegraph/hugegraph - container_name: cas-graph - ports: - - 8080:8080 - environment: - hugegraph.backend: cassandra - hugegraph.serializer: cassandra - hugegraph.cassandra.host: cas-cassandra - hugegraph.cassandra.port: 9042 - networks: - - ca-network - depends_on: - - cassandra - healthcheck: - test: ["CMD", "bin/gremlin-console.sh", "--" ,"-e", "scripts/remote-connect.groovy"] - interval: 10s - timeout: 30s - retries: 3 - - cassandra: - image: cassandra:4 - container_name: cas-cassandra - ports: - - 7000:7000 - - 9042:9042 - security_opt: - - seccomp:unconfined - networks: - - ca-network - healthcheck: - test: ["CMD", "cqlsh", "--execute", "describe keyspaces;"] - interval: 10s - timeout: 30s - retries: 5 - -networks: - ca-network: - -volumes: - hugegraph-data: diff --git a/hugegraph-server/hugegraph-dist/pom.xml b/hugegraph-server/hugegraph-dist/pom.xml index 5914b038be..f9a93a7442 100644 --- a/hugegraph-server/hugegraph-dist/pom.xml +++ b/hugegraph-server/hugegraph-dist/pom.xml @@ -59,47 +59,16 @@ - - org.apache.hugegraph - hugegraph-cassandra - ${revision} - - - metrics-core - io.dropwizard.metrics - - - - - org.apache.hugegraph - hugegraph-scylladb - ${revision} - org.apache.hugegraph hugegraph-rocksdb ${revision} - - org.apache.hugegraph - hugegraph-mysql - ${revision} - - - org.apache.hugegraph - hugegraph-palo - ${revision} - org.apache.hugegraph hugegraph-hbase ${revision} - - org.apache.hugegraph - hugegraph-postgresql - ${revision} - org.apache.hugegraph hugegraph-hstore diff --git a/hugegraph-server/hugegraph-dist/src/assembly/static/conf/log4j2.xml b/hugegraph-server/hugegraph-dist/src/assembly/static/conf/log4j2.xml index cd2d9da569..6286314d7b 100644 --- a/hugegraph-server/hugegraph-dist/src/assembly/static/conf/log4j2.xml +++ b/hugegraph-server/hugegraph-dist/src/assembly/static/conf/log4j2.xml @@ -107,18 +107,12 @@ - - - - - - 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 917fc742f1..ba1edb3234 100755 --- a/hugegraph-server/hugegraph-dist/src/assembly/travis/install-backend.sh +++ b/hugegraph-server/hugegraph-dist/src/assembly/travis/install-backend.sh @@ -30,27 +30,10 @@ if [ ! -d "$HOME"/downloads ]; then fi case $BACKEND in - cassandra) - # TODO: replace it with docker - echo "cassandra is not supported since 1.7.0" - exit 1 - ;; - scylladb) - echo "scylladb is not supported since 1.7.0" - exit 1 - ;; hbase) # TODO: replace it with hbase2.3+ to avoid java8 env "$TRAVIS_DIR"/install-hbase.sh ;; - mysql) - echo "mysql is not supported since 1.7.0" - exit 1 - ;; - postgresql) - echo "postgresql is not supported since 1.7.0" - exit 1 - ;; hstore) "$TRAVIS_DIR"/install-hstore.sh ;; diff --git a/hugegraph-server/hugegraph-dist/src/assembly/travis/install-cassandra.sh b/hugegraph-server/hugegraph-dist/src/assembly/travis/install-cassandra.sh deleted file mode 100755 index 86b22f2e0d..0000000000 --- a/hugegraph-server/hugegraph-dist/src/assembly/travis/install-cassandra.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/bash -# -# 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. -# -set -ev - -CASS_DOWNLOAD_ADDRESS="https://archive.apache.org/dist/cassandra" -CASS_VERSION="4.0.10" -CASS_PACKAGE="apache-cassandra-${CASS_VERSION}" -CASS_TAR="${CASS_PACKAGE}-bin.tar.gz" -CASS_CONF="${CASS_PACKAGE}/conf/cassandra.yaml" - -# download cassandra -if [ ! -f $HOME/downloads/${CASS_TAR} ]; then - wget -q -O $HOME/downloads/${CASS_TAR} ${CASS_DOWNLOAD_ADDRESS}/${CASS_VERSION}/${CASS_TAR} -fi - -# decompress cassandra -cp $HOME/downloads/${CASS_TAR} ${CASS_TAR} && tar -xzf ${CASS_TAR} - -# using tmpfs for the Cassandra data directory reduces travis test runtime -sudo mkdir /mnt/ramdisk -sudo mount -t tmpfs -o size=1024m tmpfs /mnt/ramdisk -sudo ln -s /mnt/ramdisk $CASS_PACKAGE/data - -# config cassandra -sed -i "s/batch_size_warn_threshold_in_kb:.*/batch_size_warn_threshold_in_kb: 10240/g" $CASS_CONF -sed -i "s/batch_size_fail_threshold_in_kb:.*/batch_size_fail_threshold_in_kb: 10240/g" $CASS_CONF - -# start cassandra service -sh ${CASS_PACKAGE}/bin/cassandra diff --git a/hugegraph-server/hugegraph-dist/src/assembly/travis/install-mysql-via-docker.sh b/hugegraph-server/hugegraph-dist/src/assembly/travis/install-mysql-via-docker.sh deleted file mode 100755 index 12431e69c4..0000000000 --- a/hugegraph-server/hugegraph-dist/src/assembly/travis/install-mysql-via-docker.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash -# -# 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. -# -set -ev - -TRAVIS_DIR=$(dirname "$0") - -# Need speed up it -CONF=hugegraph-server/hugegraph-test/src/main/resources/hugegraph.properties -MYSQL_USERNAME=root - -# Set MySQL configurations -sed -i "s/jdbc.username=.*/jdbc.username=$MYSQL_USERNAME/" $CONF -sed -i "s/jdbc.reconnect_max_times=.*/jdbc.reconnect_max_times=10/" $CONF -sed -i "s/jdbc.reconnect_interval=.*/jdbc.reconnect_interval=5/" $CONF - - -# Keep for upgrade in future -docker pull mysql:5.7 -docker run -p 3306:3306 --name mysql -e MYSQL_ROOT_PASSWORD="******" -d mysql:5.7 diff --git a/hugegraph-server/hugegraph-dist/src/assembly/travis/install-mysql.sh b/hugegraph-server/hugegraph-dist/src/assembly/travis/install-mysql.sh deleted file mode 100755 index c732896df1..0000000000 --- a/hugegraph-server/hugegraph-dist/src/assembly/travis/install-mysql.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash -# -# 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. -# -set -ev - -TRAVIS_DIR=$(dirname "$0") -#MYSQL_DOWNLOAD_ADDRESS="http://dev.MySQL.com/get/Downloads" -#MYSQL_VERSION="MySQL-5.7" -#MYSQL_PACKAGE="mysql-5.7.11-Linux-glibc2.5-x86_64" -#MYSQL_TAR="${MYSQL_PACKAGE}.tar.gz" - -if [ -d /var/lib/mysql ]; then - # Reference from https://github.com/mozilla/treeherder/blob/master/bin/travis-setup.sh - # Using tmpfs for the MySQL data directory reduces travis test runtime by 6x - sudo mkdir /mnt/ramdisk - sudo mount -t tmpfs -o size=1024m tmpfs /mnt/ramdisk - sudo mv /var/lib/mysql /mnt/ramdisk - sudo ln -s /mnt/ramdisk/mysql /var/lib/mysql - sudo cp "$TRAVIS_DIR"/mysql.cnf /etc/mysql/conf.d/mysql.cnf - sudo service mysql restart -else - echo "Please install mysql firstly." - exit 1 -fi diff --git a/hugegraph-server/hugegraph-dist/src/assembly/travis/install-postgresql-via-docker.sh b/hugegraph-server/hugegraph-dist/src/assembly/travis/install-postgresql-via-docker.sh deleted file mode 100755 index 3b3cd4ec29..0000000000 --- a/hugegraph-server/hugegraph-dist/src/assembly/travis/install-postgresql-via-docker.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash -# -# 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. -# -set -ev - -TRAVIS_DIR=$(dirname "$0") -CONF=hugegraph-server/hugegraph-test/src/main/resources/hugegraph.properties - -POSTGRESQL_DRIVER=org.postgresql.Driver -POSTGRESQL_URL=jdbc:postgresql://localhost:5432/ -POSTGRESQL_USERNAME=postgres - -# Set PostgreSQL configurations -sed -i "s/jdbc.driver=.*/jdbc.driver=$POSTGRESQL_DRIVER/" $CONF -sed -i "s?jdbc.url=.*?jdbc.url=$POSTGRESQL_URL?" $CONF -sed -i "s/jdbc.username=.*/jdbc.username=$POSTGRESQL_USERNAME/" $CONF - -sudo service postgresql stop 9.2 - -docker pull postgres:9.6 -docker volume create pgdata -docker run --rm -v pgdata:/var/lib/postgresql/data -p 5432:5432 -e POSTGRES_PASSWORD="******" -d postgres:9.6 diff --git a/hugegraph-server/hugegraph-dist/src/assembly/travis/install-postgresql.sh b/hugegraph-server/hugegraph-dist/src/assembly/travis/install-postgresql.sh deleted file mode 100755 index 95ec03ca57..0000000000 --- a/hugegraph-server/hugegraph-dist/src/assembly/travis/install-postgresql.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash -# -# 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. -# -set -ev - -TRAVIS_DIR=$(dirname "$0") -CONF=hugegraph-server/hugegraph-test/src/main/resources/hugegraph.properties - -POSTGRESQL_DRIVER=org.postgresql.Driver -POSTGRESQL_URL=jdbc:postgresql://localhost:5432/ -POSTGRESQL_USERNAME=postgres - -# Set PostgreSQL configurations -sed -i "s/jdbc.driver=.*/jdbc.driver=$POSTGRESQL_DRIVER/" $CONF -sed -i "s?jdbc.url=.*?jdbc.url=$POSTGRESQL_URL?" $CONF -sed -i "s/jdbc.username=.*/jdbc.username=$POSTGRESQL_USERNAME/" $CONF - -sudo service postgresql stop 9.2 -sudo service postgresql start 9.5 diff --git a/hugegraph-server/hugegraph-dist/src/assembly/travis/install-scylladb.sh b/hugegraph-server/hugegraph-dist/src/assembly/travis/install-scylladb.sh deleted file mode 100755 index 9b281b59f8..0000000000 --- a/hugegraph-server/hugegraph-dist/src/assembly/travis/install-scylladb.sh +++ /dev/null @@ -1,65 +0,0 @@ -#!/bin/bash -# -# 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. -# -set -ev - -TRAVIS_DIR=`dirname $0` -# reference: -# https://www.scylladb.com/download/?platform=ubuntu-16.04&version=scylla-4.4#open-source -# https://github.com/scylladb/gocqlx/commit/c7f0483dd30b1c7ad1972ea135528dc95cc4ce32 -DOWNLOAD_ADDRESS="http://downloads.scylladb.com/deb/ubuntu/scylla-4.4-$(lsb_release -s -c).list" -SCYLLA_PORT=9042 -SCYLLA_CONF="/etc/scylla/scylla.yaml" -SCYLLA_OPTS="--network-stack posix --enable-in-memory-data-store 1 --developer-mode 1" -SCYLLA_OPTS_LOG="--log-to-stdout 1 --default-log-level info" - -# download and install scylladb -sudo apt-get install apt-transport-https -sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 5e08fbd8b5d6ec9c -sudo curl -L --output /etc/apt/sources.list.d/scylla.list $DOWNLOAD_ADDRESS - -sudo apt-get update -sudo apt-get install scylla - -# config scylladb -sudo sed -i "s/batch_size_warn_threshold_in_kb:.*/batch_size_warn_threshold_in_kb: 10240/g" $SCYLLA_CONF -sudo sed -i "s/batch_size_fail_threshold_in_kb:.*/batch_size_fail_threshold_in_kb: 10240/g" $SCYLLA_CONF -cat $SCYLLA_CONF - -sudo scylla_dev_mode_setup --developer-mode 1 -cat /etc/scylla.d/dev-mode.conf - -# setup scylladb with scylla_setup by expect -sudo apt-get install expect -sudo expect < - - - - @@ -119,10 +115,6 @@ - - - - diff --git a/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/Example1.java b/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/Example1.java index b9ca383bd3..a6cda3932f 100644 --- a/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/Example1.java +++ b/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/Example1.java @@ -357,7 +357,7 @@ public static void testQuery(final HugeGraph graph) { LOG.info(">>>> queryEdges(id-condition): {}", edges2.next()); } - // NOTE: query edge by has-key just supported by Cassandra + // Query edge by property key when the backend supports it if (graph.backendStoreFeatures().supportsQueryWithContainsKey()) { PropertyKey contribution = graph.propertyKey("contribution"); q.key(HugeKeys.PROPERTIES, contribution.id()); diff --git a/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/PerfExample1.java b/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/PerfExample1.java index 7cf3edd769..d0c7f434eb 100644 --- a/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/PerfExample1.java +++ b/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/PerfExample1.java @@ -22,15 +22,12 @@ import java.util.Random; import org.apache.hugegraph.HugeFactory; -import org.apache.hugegraph.backend.BackendException; import org.apache.hugegraph.schema.SchemaManager; import org.apache.hugegraph.util.Log; import org.apache.tinkerpop.gremlin.structure.T; import org.apache.tinkerpop.gremlin.structure.Vertex; import org.slf4j.Logger; -import com.datastax.driver.core.exceptions.NoHostAvailableException; - /** * Perf test for: vertex with properties */ @@ -125,15 +122,7 @@ protected void testInsert(GraphManager graph, int times, int multiple) { graph.getVertex(p3).addEdge("created", graph.getVertex(s1)); } - try { - graph.tx().commit(); - } catch (BackendException e) { - if (e.getCause() instanceof NoHostAvailableException) { - LOG.warn("Failed to commit tx: {}", e.getMessage()); - } else { - throw e; - } - } + graph.tx().commit(); this.vertices.addAll(personIds); this.vertices.addAll(softwareIds); diff --git a/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/PerfExample2.java b/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/PerfExample2.java index c984ad3141..a502f7aa7e 100644 --- a/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/PerfExample2.java +++ b/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/PerfExample2.java @@ -22,15 +22,12 @@ import java.util.Random; import org.apache.hugegraph.HugeFactory; -import org.apache.hugegraph.backend.BackendException; import org.apache.hugegraph.schema.SchemaManager; import org.apache.hugegraph.util.Log; import org.apache.tinkerpop.gremlin.structure.T; import org.apache.tinkerpop.gremlin.structure.Vertex; import org.slf4j.Logger; -import com.datastax.driver.core.exceptions.NoHostAvailableException; - /** * Perf test for: vertex without properties */ @@ -108,15 +105,7 @@ protected void testInsert(GraphManager graph, int times, int multiple) { graph.getVertex(p3).addEdge("created", graph.getVertex(s1)); } - try { - graph.tx().commit(); - } catch (BackendException e) { - if (e.getCause() instanceof NoHostAvailableException) { - LOG.warn("Failed to commit tx: {}", e.getMessage()); - } else { - throw e; - } - } + graph.tx().commit(); this.vertices.addAll(personIds); this.vertices.addAll(softwareIds); diff --git a/hugegraph-server/hugegraph-example/src/main/resources/log4j2.xml b/hugegraph-server/hugegraph-example/src/main/resources/log4j2.xml index ba2761f6c8..4e1f1ade10 100644 --- a/hugegraph-server/hugegraph-example/src/main/resources/log4j2.xml +++ b/hugegraph-server/hugegraph-example/src/main/resources/log4j2.xml @@ -83,10 +83,6 @@ - - - - @@ -95,10 +91,6 @@ - - - - diff --git a/hugegraph-server/hugegraph-mysql/pom.xml b/hugegraph-server/hugegraph-mysql/pom.xml deleted file mode 100644 index 8753f5fd5f..0000000000 --- a/hugegraph-server/hugegraph-mysql/pom.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - hugegraph-server - org.apache.hugegraph - ${revision} - ../pom.xml - - 4.0.0 - - hugegraph-mysql - - - - org.apache.hugegraph - hugegraph-core - ${revision} - - - mysql - mysql-connector-java - 8.0.28 - test - - - org.apache.httpcomponents - httpclient - - - - diff --git a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlBackendEntry.java b/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlBackendEntry.java deleted file mode 100644 index b86de0ed75..0000000000 --- a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlBackendEntry.java +++ /dev/null @@ -1,41 +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.hugegraph.backend.store.mysql; - -import org.apache.hugegraph.backend.id.Id; -import org.apache.hugegraph.backend.serializer.TableBackendEntry; -import org.apache.hugegraph.type.HugeType; - -public class MysqlBackendEntry extends TableBackendEntry { - - public MysqlBackendEntry(Id id) { - super(id); - } - - public MysqlBackendEntry(HugeType type) { - this(type, null); - } - - public MysqlBackendEntry(HugeType type, Id id) { - this(new Row(type, id)); - } - - public MysqlBackendEntry(TableBackendEntry.Row row) { - super(row); - } -} diff --git a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlEntryIterator.java b/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlEntryIterator.java deleted file mode 100644 index f4857165c1..0000000000 --- a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlEntryIterator.java +++ /dev/null @@ -1,197 +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.hugegraph.backend.store.mysql; - -import java.sql.ResultSet; -import java.sql.ResultSetMetaData; -import java.sql.SQLException; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.function.BiFunction; - -import org.apache.hugegraph.backend.BackendException; -import org.apache.hugegraph.backend.page.PageState; -import org.apache.hugegraph.backend.query.Query; -import org.apache.hugegraph.backend.store.BackendEntry; -import org.apache.hugegraph.backend.store.BackendEntryIterator; -import org.apache.hugegraph.type.HugeType; -import org.apache.hugegraph.type.define.HugeKeys; -import org.apache.hugegraph.util.E; -import org.apache.hugegraph.util.JsonUtil; -import org.apache.hugegraph.util.StringEncoding; - -public class MysqlEntryIterator extends BackendEntryIterator { - - private final ResultSetWrapper results; - private final BiFunction merger; - - private BackendEntry next; - private BackendEntry lastest; - private boolean exceedLimit; - - public MysqlEntryIterator(ResultSetWrapper rs, Query query, - BiFunction merger) { - super(query); - this.results = rs; - this.merger = merger; - this.next = null; - this.lastest = null; - this.exceedLimit = false; - } - - @Override - protected final boolean fetch() { - assert this.current == null; - if (this.next != null) { - this.current = this.next; - this.next = null; - } - - try { - while (this.results.next()) { - MysqlBackendEntry entry = this.row2Entry(this.results.resultSet()); - this.lastest = entry; - BackendEntry merged = this.merger.apply(this.current, entry); - if (this.current == null) { - // The first time to read - this.current = merged; - } else if (merged == this.current) { - // Does the next entry belongs to the current entry - assert merged != null; - } else { - // New entry - assert this.next == null; - this.next = merged; - break; - } - - // When limit exceed, stop fetching - if (this.reachLimit(this.fetched() - 1)) { - this.exceedLimit = true; - // Need remove last one because fetched limit + 1 records - this.removeLastRecord(); - this.results.close(); - break; - } - } - } catch (SQLException e) { - throw new BackendException("Fetch next error", e); - } - return this.current != null; - } - - @Override - protected PageState pageState() { - byte[] position; - // There is no latest or no next page - if (this.lastest == null || !this.exceedLimit && - this.fetched() <= this.query.limit() && this.next == null) { - position = PageState.EMPTY_BYTES; - } else { - MysqlBackendEntry entry = (MysqlBackendEntry) this.lastest; - position = new PagePosition(entry.columnsMap()).toBytes(); - } - return new PageState(position, 0, (int) this.count()); - } - - @Override - protected void skipOffset() { - // pass - } - - @Override - protected final long sizeOf(BackendEntry entry) { - MysqlBackendEntry e = (MysqlBackendEntry) entry; - int subRowsSize = e.subRows().size(); - return subRowsSize > 0 ? subRowsSize : 1L; - } - - @Override - protected final long skip(BackendEntry entry, long skip) { - MysqlBackendEntry e = (MysqlBackendEntry) entry; - E.checkState(e.subRows().size() > skip, "Invalid entry to skip"); - for (long i = 0; i < skip; i++) { - e.subRows().remove(0); - } - return e.subRows().size(); - } - - @Override - public void close() throws Exception { - this.results.close(); - } - - private MysqlBackendEntry row2Entry(ResultSet result) throws SQLException { - HugeType type = this.query.resultType(); - MysqlBackendEntry entry = new MysqlBackendEntry(type); - ResultSetMetaData metaData = result.getMetaData(); - for (int i = 1; i <= metaData.getColumnCount(); i++) { - String name = metaData.getColumnLabel(i); - HugeKeys key = MysqlTable.parseKey(name); - Object value = result.getObject(i); - if (value == null) { - assert key == HugeKeys.EXPIRED_TIME; - continue; - } - entry.column(key, value); - } - return entry; - } - - private void removeLastRecord() { - MysqlBackendEntry entry = (MysqlBackendEntry) this.current; - int lastOne = entry.subRows().size() - 1; - assert lastOne >= 0; - entry.subRows().remove(lastOne); - } - - public static class PagePosition { - - private final Map columns; - - public PagePosition(Map columns) { - this.columns = columns; - } - - public Map columns() { - return this.columns; - } - - @Override - public String toString() { - return JsonUtil.toJson(this.columns); - } - - public byte[] toBytes() { - String json = JsonUtil.toJson(this.columns); - return StringEncoding.encode(json); - } - - public static PagePosition fromBytes(byte[] bytes) { - String json = StringEncoding.decode(bytes); - @SuppressWarnings("unchecked") - Map columns = JsonUtil.fromJson(json, Map.class); - Map keyColumns = new LinkedHashMap<>(); - for (Map.Entry entry : columns.entrySet()) { - HugeKeys key = MysqlTable.parseKey(entry.getKey()); - keyColumns.put(key, entry.getValue()); - } - return new PagePosition(keyColumns); - } - } -} diff --git a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlFeatures.java b/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlFeatures.java deleted file mode 100644 index 55a1cfd968..0000000000 --- a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlFeatures.java +++ /dev/null @@ -1,131 +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.hugegraph.backend.store.mysql; - -import org.apache.hugegraph.backend.store.BackendFeatures; - -public class MysqlFeatures implements BackendFeatures { - - @Override - public boolean supportsScanToken() { - return true; - } - - @Override - public boolean supportsScanKeyPrefix() { - return false; - } - - @Override - public boolean supportsScanKeyRange() { - return true; - } - - @Override - public boolean supportsQuerySchemaByName() { - // MySQL support secondary index - return true; - } - - @Override - public boolean supportsQueryByLabel() { - // MySQL support secondary index - return true; - } - - @Override - public boolean supportsQueryWithInCondition() { - return true; - } - - @Override - public boolean supportsQueryWithRangeCondition() { - return true; - } - - @Override - public boolean supportsQueryWithOrderBy() { - return true; - } - - @Override - public boolean supportsQueryWithContains() { - return false; - } - - @Override - public boolean supportsQueryWithContainsKey() { - return false; - } - - @Override - public boolean supportsQueryByPage() { - return true; - } - - @Override - public boolean supportsQuerySortByInputIds() { - return false; - } - - @Override - public boolean supportsDeleteEdgeByLabel() { - return true; - } - - @Override - public boolean supportsUpdateVertexProperty() { - return false; - } - - @Override - public boolean supportsMergeVertexProperty() { - return false; - } - - @Override - public boolean supportsUpdateEdgeProperty() { - return false; - } - - @Override - public boolean supportsTransaction() { - // MySQL support tx - return true; - } - - @Override - public boolean supportsNumberType() { - return true; - } - - @Override - public boolean supportsAggregateProperty() { - return false; - } - - @Override - public boolean supportsTtl() { - return false; - } - - @Override - public boolean supportsOlapProperties() { - return false; - } -} diff --git a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlMetrics.java b/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlMetrics.java deleted file mode 100644 index 4d4019d9a7..0000000000 --- a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlMetrics.java +++ /dev/null @@ -1,32 +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.hugegraph.backend.store.mysql; - -import java.util.Map; - -import org.apache.hugegraph.backend.store.BackendMetrics; - -import com.google.common.collect.ImmutableMap; - -public class MysqlMetrics implements BackendMetrics { - - @Override - public Map metrics() { - return ImmutableMap.of(NODES, 1); - } -} diff --git a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlOptions.java b/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlOptions.java deleted file mode 100644 index dd46fdb5df..0000000000 --- a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlOptions.java +++ /dev/null @@ -1,117 +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.hugegraph.backend.store.mysql; - -import static org.apache.hugegraph.config.OptionChecker.disallowEmpty; -import static org.apache.hugegraph.config.OptionChecker.rangeInt; - -import org.apache.hugegraph.config.ConfigOption; -import org.apache.hugegraph.config.OptionHolder; - -public class MysqlOptions extends OptionHolder { - - protected MysqlOptions() { - super(); - } - - private static volatile MysqlOptions instance; - - public static synchronized MysqlOptions instance() { - if (instance == null) { - instance = new MysqlOptions(); - instance.registerOptions(); - } - return instance; - } - - public static final ConfigOption JDBC_DRIVER = - new ConfigOption<>( - "jdbc.driver", - "The JDBC driver class to connect database.", - disallowEmpty(), - "com.mysql.jdbc.Driver" - ); - - public static final ConfigOption JDBC_URL = - new ConfigOption<>( - "jdbc.url", - "The url of database in JDBC format.", - disallowEmpty(), - "jdbc:mysql://127.0.0.1:3306" - ); - - public static final ConfigOption JDBC_USERNAME = - new ConfigOption<>( - "jdbc.username", - "The username to login database.", - disallowEmpty(), - "root" - ); - - public static final ConfigOption JDBC_PASSWORD = - new ConfigOption<>( - "jdbc.password", - "The password corresponding to jdbc.username.", - null, - "******" - ); - - public static final ConfigOption JDBC_FORCED_AUTO_RECONNECT = - new ConfigOption<>( - "jdbc.forced_auto_reconnect", - "Whether to forced auto reconnect to the database even " + - "if the connection fails at the first time. Note that " + - "forced_auto_reconnect=true will disable fail-fast.", - disallowEmpty(), - false - ); - - public static final ConfigOption JDBC_RECONNECT_MAX_TIMES = - new ConfigOption<>( - "jdbc.reconnect_max_times", - "The reconnect times when the database connection fails.", - rangeInt(1, 10), - 3 - ); - - public static final ConfigOption JDBC_RECONNECT_INTERVAL = - new ConfigOption<>( - "jdbc.reconnect_interval", - "The interval(seconds) between reconnections when the " + - "database connection fails.", - rangeInt(1, 10), - 3 - ); - - public static final ConfigOption JDBC_SSL_MODE = - new ConfigOption<>( - "jdbc.ssl_mode", - "The SSL mode of connections with database.", - disallowEmpty(), - "false" - ); - - public static final ConfigOption JDBC_STORAGE_ENGINE = - new ConfigOption<>( - "jdbc.storage_engine", - "The storage engine of backend store database, " + - "like InnoDB/MyISAM/RocksDB for MySQL.", - disallowEmpty(), - "InnoDB" - ); -} diff --git a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlSerializer.java b/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlSerializer.java deleted file mode 100644 index 595ab609bd..0000000000 --- a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlSerializer.java +++ /dev/null @@ -1,175 +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.hugegraph.backend.store.mysql; - -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; - -import org.apache.commons.lang.NotImplementedException; -import org.apache.hugegraph.backend.BackendException; -import org.apache.hugegraph.backend.id.Id; -import org.apache.hugegraph.backend.id.IdGenerator; -import org.apache.hugegraph.backend.serializer.TableBackendEntry; -import org.apache.hugegraph.backend.serializer.TableSerializerV2; -import org.apache.hugegraph.backend.store.BackendEntry; -import org.apache.hugegraph.config.HugeConfig; -import org.apache.hugegraph.schema.SchemaElement; -import org.apache.hugegraph.structure.HugeElement; -import org.apache.hugegraph.structure.HugeProperty; -import org.apache.hugegraph.structure.HugeVertex; -import org.apache.hugegraph.type.HugeType; -import org.apache.hugegraph.type.define.HugeKeys; -import org.apache.hugegraph.util.InsertionOrderUtil; -import org.apache.hugegraph.util.JsonUtil; - -public class MysqlSerializer extends TableSerializerV2 { - - public MysqlSerializer(HugeConfig config) { - super(config); - } - - @Override - public MysqlBackendEntry newBackendEntry(HugeType type, Id id) { - return new MysqlBackendEntry(type, id); - } - - @Override - protected TableBackendEntry newBackendEntry(TableBackendEntry.Row row) { - return new MysqlBackendEntry(row); - } - - @Override - protected MysqlBackendEntry convertEntry(BackendEntry backendEntry) { - if (!(backendEntry instanceof MysqlBackendEntry)) { - throw new BackendException("Not supported by MysqlSerializer"); - } - return (MysqlBackendEntry) backendEntry; - } - - @Override - protected Set parseIndexElemIds(TableBackendEntry entry) { - Set elemIds = InsertionOrderUtil.newSet(); - elemIds.add(entry.column(HugeKeys.ELEMENT_IDS)); - for (TableBackendEntry.Row row : entry.subRows()) { - elemIds.add(row.column(HugeKeys.ELEMENT_IDS)); - } - return elemIds; - } - - @Override - protected Id toId(Number number) { - return IdGenerator.of(number.longValue()); - } - - @Override - protected Id[] toIdArray(Object object) { - assert object instanceof String; - String value = (String) object; - Number[] values = JsonUtil.fromJson(value, Number[].class); - Id[] ids = new Id[values.length]; - int i = 0; - for (Number number : values) { - ids[i++] = IdGenerator.of(number.longValue()); - } - return ids; - } - - @Override - protected Object toLongSet(Collection ids) { - return this.toLongList(ids); - } - - @Override - protected Object toLongList(Collection ids) { - long[] values = new long[ids.size()]; - int i = 0; - for (Id id : ids) { - values[i++] = id.asLong(); - } - return JsonUtil.toJson(values); - } - - @Override - protected void formatProperty(HugeProperty prop, - TableBackendEntry.Row row) { - throw new BackendException("Not support updating single property " + - "by MySQL"); - } - - @Override - protected void formatProperties(HugeElement element, - TableBackendEntry.Row row) { - Map properties = new HashMap<>(); - // Add all properties of a Vertex - for (HugeProperty prop : element.getProperties()) { - Number key = prop.propertyKey().id().asLong(); - Object val = prop.value(); - properties.put(key, val); - } - row.column(HugeKeys.PROPERTIES, JsonUtil.toJson(properties)); - } - - @Override - protected void parseProperties(HugeElement element, - TableBackendEntry.Row row) { - String properties = row.column(HugeKeys.PROPERTIES); - // Query edge will wrapped by a vertex, whose properties is empty - if (properties.isEmpty()) { - return; - } - - @SuppressWarnings("unchecked") - Map props = JsonUtil.fromJson(properties, Map.class); - for (Map.Entry prop : props.entrySet()) { - /* - * The key is string instead of int, because the key in json - * must be string - */ - Id pkeyId = this.toId(Long.valueOf(prop.getKey())); - String colJson = JsonUtil.toJson(prop.getValue()); - this.parseProperty(pkeyId, colJson, element); - } - } - - @Override - protected void writeUserdata(SchemaElement schema, - TableBackendEntry entry) { - assert entry instanceof MysqlBackendEntry; - entry.column(HugeKeys.USER_DATA, JsonUtil.toJson(schema.userdata())); - } - - @Override - protected void readUserdata(SchemaElement schema, - TableBackendEntry entry) { - assert entry instanceof MysqlBackendEntry; - // Parse all user data of a schema element - String json = entry.column(HugeKeys.USER_DATA); - @SuppressWarnings("unchecked") - Map userdata = JsonUtil.fromJson(json, Map.class); - for (Map.Entry e : userdata.entrySet()) { - schema.userdata(e.getKey(), e.getValue()); - } - } - - @Override - public BackendEntry writeOlapVertex(HugeVertex vertex) { - throw new NotImplementedException("Unsupported writeOlapVertex()"); - } -} diff --git a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlSessions.java b/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlSessions.java deleted file mode 100644 index 9124c3a4b9..0000000000 --- a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlSessions.java +++ /dev/null @@ -1,546 +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.hugegraph.backend.store.mysql; - -import java.net.SocketTimeoutException; -import java.net.URISyntaxException; -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.HashMap; -import java.util.Map; -import java.util.stream.IntStream; - -import org.apache.http.client.utils.URIBuilder; -import org.apache.hugegraph.backend.BackendException; -import org.apache.hugegraph.backend.store.BackendSession.AbstractBackendSession; -import org.apache.hugegraph.backend.store.BackendSessionPool; -import org.apache.hugegraph.config.HugeConfig; -import org.apache.hugegraph.util.E; -import org.apache.hugegraph.util.Log; -import org.apache.logging.log4j.util.Strings; -import org.slf4j.Logger; - -public class MysqlSessions extends BackendSessionPool { - - private static final Logger LOG = Log.logger(MysqlSessions.class); - - private static final String JDBC_PREFIX = "jdbc:"; - - private static final int DROP_DB_TIMEOUT = 10000; - - private HugeConfig config; - private String database; - private volatile boolean opened; - - public MysqlSessions(HugeConfig config, String database, String store) { - super(config, database + "/" + store); - this.config = config; - this.database = database; - this.opened = false; - } - - @Override - public HugeConfig config() { - return this.config; - } - - public String database() { - return this.database; - } - - public String escapedDatabase() { - return MysqlUtil.escapeString(this.database()); - } - - /** - * Try connect with specified database, will not reconnect if failed - * - * @throws SQLException if a database access error occurs - */ - @Override - public synchronized void open() throws Exception { - try (Connection conn = this.open(false)) { - this.opened = true; - } - } - - @Override - protected boolean opened() { - return this.opened; - } - - @Override - protected void doClose() { - // pass - } - - @Override - public Session session() { - return (Session) super.getOrNewSession(); - } - - @Override - protected Session newSession() { - return new Session(); - } - - public void createDatabase() { - // Create database with non-database-session - LOG.debug("Create database: {}", this.database()); - - String sql = this.buildCreateDatabase(this.database()); - try (Connection conn = this.openWithoutDB(0)) { - conn.createStatement().execute(sql); - } catch (SQLException e) { - if (!e.getMessage().endsWith("already exists")) { - throw new BackendException("Failed to create database '%s'", e, - this.database()); - } - // Ignore exception if database already exists - } - } - - public void dropDatabase() { - LOG.debug("Drop database: {}", this.database()); - - String sql = this.buildDropDatabase(this.database()); - try (Connection conn = this.openWithoutDB(DROP_DB_TIMEOUT)) { - conn.createStatement().execute(sql); - } catch (SQLException e) { - if (e.getCause() instanceof SocketTimeoutException) { - LOG.warn("Drop database '{}' timeout", this.database()); - } else { - throw new BackendException("Failed to drop database '%s'", e, - this.database()); - } - } - } - - public boolean existsDatabase() { - try (Connection conn = this.openWithoutDB(0); - ResultSet result = conn.getMetaData().getCatalogs()) { - while (result.next()) { - String dbName = result.getString(1); - if (dbName.equals(this.database())) { - return true; - } - } - } catch (Exception e) { - throw new BackendException("Failed to obtain database info", e); - } - return false; - } - - public boolean existsTable(String table) { - String sql = this.buildExistsTable(table); - try (Connection conn = this.openWithDB(0); - ResultSet result = conn.createStatement().executeQuery(sql)) { - return result.next(); - } catch (Exception e) { - throw new BackendException("Failed to obtain table info", e); - } - } - - public void resetConnections() { - // Close the under layer connections owned by each thread - this.forceResetSessions(); - } - - protected String buildCreateDatabase(String database) { - return String.format("CREATE DATABASE IF NOT EXISTS %s " + - "DEFAULT CHARSET utf8 COLLATE utf8_bin;", - database); - } - - protected String buildDropDatabase(String database) { - return String.format("DROP DATABASE IF EXISTS %s;", database); - } - - protected String buildExistsTable(String table) { - return String.format("SELECT * FROM information_schema.tables " + - "WHERE table_schema = '%s' " + - "AND table_name = '%s' LIMIT 1;", - this.escapedDatabase(), - MysqlUtil.escapeString(table)); - } - - /** - * Connect DB without specified database - */ - protected Connection openWithoutDB(int timeout) { - String url = this.buildUri(false, false, false, timeout); - try { - return this.connect(url); - } catch (SQLException e) { - throw new BackendException("Failed to access %s", e, url); - } - } - - /** - * Connect DB with specified database, but won't auto reconnect - */ - protected Connection openWithDB(int timeout) { - String url = this.buildUri(false, true, false, timeout); - try { - return this.connect(url); - } catch (SQLException e) { - throw new BackendException("Failed to access %s", e, url); - } - } - - /** - * Connect DB with specified database - */ - private Connection open(boolean autoReconnect) throws SQLException { - String url = this.buildUri(true, true, autoReconnect, null); - return this.connect(url); - } - - protected String buildUri(boolean withConnParams, boolean withDB, - boolean autoReconnect, Integer timeout) { - String url = this.buildUrlPrefix(withDB); - - boolean forcedAutoReconnect = this.config.get( - MysqlOptions.JDBC_FORCED_AUTO_RECONNECT); - int maxTimes = this.config.get(MysqlOptions.JDBC_RECONNECT_MAX_TIMES); - int interval = this.config.get(MysqlOptions.JDBC_RECONNECT_INTERVAL); - String sslMode = this.config.get(MysqlOptions.JDBC_SSL_MODE); - - E.checkArgument(url.startsWith(JDBC_PREFIX), - "The url must start with '%s': '%s'", - JDBC_PREFIX, url); - String urlWithoutJdbc = url.substring(JDBC_PREFIX.length()); - URIBuilder builder; - try { - builder = this.newConnectionURIBuilder(urlWithoutJdbc); - } catch (URISyntaxException e) { - throw new BackendException("Invalid url '%s'", e, url); - } - - if (forcedAutoReconnect) { - autoReconnect = true; - } - if (withConnParams || forcedAutoReconnect) { - builder.setParameter("characterEncoding", "utf-8") - .setParameter("rewriteBatchedStatements", "true") - .setParameter("useServerPrepStmts", "false") - .setParameter("autoReconnect", String.valueOf(autoReconnect)) - .setParameter("maxReconnects", String.valueOf(maxTimes)) - .setParameter("initialTimeout", String.valueOf(interval)); - } - if (timeout != null) { - builder.setParameter("socketTimeout", String.valueOf(timeout)); - } - - builder.setParameter("useSSL", sslMode); - - return JDBC_PREFIX + builder; - } - - protected String buildUrlPrefix(boolean withDB) { - String url = this.config.get(MysqlOptions.JDBC_URL); - if (!url.endsWith("/")) { - url = String.format("%s/", url); - } - String database = withDB ? this.database() : this.connectDatabase(); - return String.format("%s%s", url, database); - } - - protected String connectDatabase() { - return Strings.EMPTY; - } - - protected URIBuilder newConnectionURIBuilder(String url) - throws URISyntaxException { - return new URIBuilder(url); - } - - private Connection connect(String url) throws SQLException { - LOG.info("Connect to the jdbc url: '{}'", url); - String driverName = this.config.get(MysqlOptions.JDBC_DRIVER); - String username = this.config.get(MysqlOptions.JDBC_USERNAME); - String password = this.config.get(MysqlOptions.JDBC_PASSWORD); - try { - // Register JDBC driver - Class.forName(driverName); - } catch (ClassNotFoundException e) { - throw new BackendException( - "Failed to register JDBC driver. Class '%s' not found. Please check if the " + - "MySQL driver package is available.", - driverName); - } - return DriverManager.getConnection(url, username, password); - } - - public class Session extends AbstractBackendSession { - - private Connection conn; - private Map statements; - private int count; - - public Session() { - this.conn = null; - this.statements = new HashMap<>(); - this.count = 0; - } - - public HugeConfig config() { - return MysqlSessions.this.config(); - } - - @Override - public void open() { - try { - this.doOpen(); - } catch (SQLException e) { - throw new BackendException("Failed to open connection", e); - } - } - - private void tryOpen() { - try { - this.doOpen(); - } catch (SQLException ignored) { - // Ignore - } - } - - private void doOpen() throws SQLException { - this.opened = true; - if (this.conn != null && !this.conn.isClosed()) { - return; - } - this.conn = MysqlSessions.this.open(true); - } - - @Override - public void close() { - assert this.closeable(); - if (this.conn == null) { - return; - } - - this.opened = false; - this.doClose(); - } - - private void doClose() { - SQLException exception = null; - for (PreparedStatement statement : this.statements.values()) { - try { - statement.close(); - } catch (SQLException e) { - exception = e; - } - } - this.statements.clear(); - - try { - this.conn.close(); - } catch (SQLException e) { - exception = e; - } finally { - this.conn = null; - } - - if (exception != null) { - throw new BackendException("Failed to close connection", - exception); - } - } - - @Override - public boolean opened() { - if (this.opened && this.conn == null) { - // Reconnect if the connection is reset - tryOpen(); - } - return this.opened && this.conn != null; - } - - @Override - public boolean closed() { - if (!this.opened || this.conn == null) { - return true; - } - try { - return this.conn.isClosed(); - } catch (SQLException ignored) { - // Assume closed here - return true; - } - } - - public void clear() { - this.count = 0; - SQLException exception = null; - for (PreparedStatement statement : this.statements.values()) { - try { - statement.clearBatch(); - } catch (SQLException e) { - exception = e; - } - } - if (exception != null) { - /* - * Will throw exception when the database connection error, - * we clear statements because clearBatch() failed - */ - this.statements = new HashMap<>(); - } - } - - public void begin() throws SQLException { - this.conn.setAutoCommit(false); - } - - public void end() throws SQLException { - this.conn.setAutoCommit(true); - } - - public void endAndLog() { - try { - this.conn.setAutoCommit(true); - } catch (SQLException e) { - LOG.warn("Failed to set connection to auto-commit status", e); - } - } - - @Override - public Integer commit() { - int updated = 0; - try { - for (PreparedStatement statement : this.statements.values()) { - updated += IntStream.of(statement.executeBatch()).sum(); - } - this.conn.commit(); - this.clear(); - } catch (SQLException e) { - throw new BackendException("Failed to commit", e); - } - /* - * Can't call endAndLog() in `finally` block here. - * Because If commit already failed with an exception, - * then rollback() should be called. Besides rollback() can only - * be called when autocommit=false and rollback() will always set - * autocommit=true. Therefore only commit successfully should set - * autocommit=true here - */ - this.endAndLog(); - return updated; - } - - @Override - public void rollback() { - this.clear(); - try { - this.conn.rollback(); - } catch (SQLException e) { - throw new BackendException("Failed to rollback", e); - } finally { - this.endAndLog(); - } - } - - @Override - public boolean hasChanges() { - return this.count > 0; - } - - @Override - public void reconnectIfNeeded() { - if (!this.opened) { - return; - } - - if (this.conn == null) { - tryOpen(); - } - - try { - this.execute("SELECT 1;"); - } catch (SQLException ignored) { - // pass - } - } - - @Override - public void reset() { - // NOTE: this method may be called by other threads - if (this.conn == null) { - return; - } - try { - this.doClose(); - } catch (Throwable e) { - LOG.warn("Failed to reset connection", e); - } - } - - public ResultSetWrapper select(String sql) throws SQLException { - assert this.conn.getAutoCommit(); - Statement statement = this.conn.createStatement(); - try { - ResultSet rs = statement.executeQuery(sql); - return new ResultSetWrapper(rs, statement); - } catch (SQLException e) { - statement.close(); - throw e; - } - } - - public boolean execute(String sql) throws SQLException { - /* - * commit() or rollback() failed to set connection to auto-commit - * status in prior transaction. Manually set to auto-commit here. - */ - if (!this.conn.getAutoCommit()) { - this.end(); - } - - try (Statement statement = this.conn.createStatement()) { - return statement.execute(sql); - } - } - - public void add(PreparedStatement statement) { - try { - // Add a row to statement - statement.addBatch(); - this.count++; - } catch (SQLException e) { - throw new BackendException("Failed to add statement '%s' " + - "to batch", e, statement); - } - } - - public PreparedStatement prepareStatement(String sqlTemplate) - throws SQLException { - PreparedStatement statement = this.statements.get(sqlTemplate); - if (statement == null) { - statement = this.conn.prepareStatement(sqlTemplate); - this.statements.putIfAbsent(sqlTemplate, statement); - } - return statement; - } - } -} diff --git a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlStore.java b/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlStore.java deleted file mode 100644 index c5d983feff..0000000000 --- a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlStore.java +++ /dev/null @@ -1,513 +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.hugegraph.backend.store.mysql; - -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - -import org.apache.hugegraph.backend.BackendException; -import org.apache.hugegraph.backend.id.Id; -import org.apache.hugegraph.backend.query.Query; -import org.apache.hugegraph.backend.store.AbstractBackendStore; -import org.apache.hugegraph.backend.store.BackendAction; -import org.apache.hugegraph.backend.store.BackendEntry; -import org.apache.hugegraph.backend.store.BackendFeatures; -import org.apache.hugegraph.backend.store.BackendMutation; -import org.apache.hugegraph.backend.store.BackendStoreProvider; -import org.apache.hugegraph.backend.store.mysql.MysqlSessions.Session; -import org.apache.hugegraph.config.HugeConfig; -import org.apache.hugegraph.exception.ConnectionException; -import org.apache.hugegraph.type.HugeType; -import org.apache.hugegraph.util.E; -import org.apache.hugegraph.util.Log; -import org.slf4j.Logger; - -public abstract class MysqlStore extends AbstractBackendStore { - - private static final Logger LOG = Log.logger(MysqlStore.class); - - private static final BackendFeatures FEATURES = new MysqlFeatures(); - - private final String store; - private final String database; - - private final BackendStoreProvider provider; - - private final Map tables; - - private MysqlSessions sessions; - - public MysqlStore(final BackendStoreProvider provider, - final String database, final String store) { - E.checkNotNull(database, "database"); - E.checkNotNull(store, "store"); - this.provider = provider; - this.database = database; - this.store = store; - - this.sessions = null; - this.tables = new ConcurrentHashMap<>(); - - this.registerMetaHandlers(); - LOG.debug("Store loaded: {}", store); - } - - private void registerMetaHandlers() { - this.registerMetaHandler("metrics", (session, meta, args) -> { - MysqlMetrics metrics = new MysqlMetrics(); - return metrics.metrics(); - }); - } - - protected void registerTableManager(HugeType type, MysqlTable table) { - this.tables.put(type, table); - } - - protected MysqlSessions openSessionPool(HugeConfig config) { - return new MysqlSessions(config, this.database, this.store); - } - - @Override - public String store() { - return this.store; - } - - @Override - public String database() { - return this.database; - } - - @Override - public BackendStoreProvider provider() { - return this.provider; - } - - @Override - public synchronized void open(HugeConfig config) { - LOG.debug("Store open: {}", this.store); - - E.checkNotNull(config, "config"); - - if (this.sessions != null && !this.sessions.closed()) { - LOG.debug("Store {} has been opened before", this.store); - this.sessions.useSession(); - return; - } - - this.sessions = this.openSessionPool(config); - - if (this.sessions.existsDatabase()) { - LOG.debug("Store connect with database: {}", this.database); - try { - this.sessions.open(); - } catch (Throwable e) { - throw new ConnectionException("Failed to connect to MySQL", e); - } - - try { - this.sessions.session().open(); - } catch (Throwable e) { - try { - this.sessions.close(); - } catch (Throwable e2) { - LOG.warn("Failed to close connection after an error", e2); - } - throw new BackendException("Failed to open database", e); - } - } else { - if (this.isSchemaStore()) { - LOG.info("Failed to open database '{}', " + - "try to init database later", this.database); - } - this.sessions.session(); - } - - LOG.debug("Store opened: {}", this.store); - } - - @Override - public void close() { - LOG.debug("Store close: {}", this.store); - this.checkClusterConnected(); - this.sessions.close(); - } - - @Override - public boolean opened() { - this.checkClusterConnected(); - return this.sessions.session().opened(); - } - - @Override - public void init() { - this.checkClusterConnected(); - this.sessions.createDatabase(); - try { - // Open a new session connected with specified database - this.sessions.session().open(); - } catch (Exception e) { - throw new BackendException("Failed to connect database '%s'", - this.database); - } - this.checkOpened(); - this.initTables(); - - LOG.debug("Store initialized: {}", this.store); - } - - @Override - public void clear(boolean clearSpace) { - // Check connected - this.checkClusterConnected(); - - if (this.sessions.existsDatabase()) { - if (!clearSpace) { - this.checkOpened(); - this.clearTables(); - /* - * Disconnect connections for following database drop. - * Connections will be auto reconnected if not drop database - * in next step, but never do this operation because database - * might be blocked in mysql or throw 'terminating' exception. - * we can't resetConnections() when dropDatabase(), because - * there are 3 stores(schema,system,graph), which are shared - * one database, other stores may keep connected with the - * database when one store doing clear(clearSpace=false). - */ - this.sessions.resetConnections(); - } else { - this.sessions.dropDatabase(); - } - } - - LOG.debug("Store cleared: {}", this.store); - } - - @Override - public boolean initialized() { - this.checkClusterConnected(); - - if (!this.sessions.existsDatabase()) { - return false; - } - for (MysqlTable table : this.tables()) { - if (!this.sessions.existsTable(table.table())) { - return false; - } - } - return true; - } - - @Override - public void truncate() { - this.checkOpened(); - - this.truncateTables(); - LOG.debug("Store truncated: {}", this.store); - } - - @Override - public void mutate(BackendMutation mutation) { - if (LOG.isDebugEnabled()) { - LOG.debug("Store {} mutation: {}", this.store, mutation); - } - - this.checkOpened(); - Session session = this.sessions.session(); - - for (Iterator it = mutation.mutation(); it.hasNext(); ) { - this.mutate(session, it.next()); - } - } - - private void mutate(Session session, BackendAction item) { - MysqlBackendEntry entry = castBackendEntry(item.entry()); - MysqlTable table = this.table(entry.type()); - - switch (item.action()) { - case INSERT: - table.insert(session, entry.row()); - break; - case DELETE: - table.delete(session, entry.row()); - break; - case APPEND: - table.append(session, entry.row()); - break; - case ELIMINATE: - table.eliminate(session, entry.row()); - break; - case UPDATE_IF_PRESENT: - table.updateIfPresent(session, entry.row()); - break; - case UPDATE_IF_ABSENT: - table.updateIfAbsent(session, entry.row()); - break; - default: - throw new AssertionError(String.format( - "Unsupported mutate action: %s", item.action())); - } - } - - @Override - public Iterator query(Query query) { - this.checkOpened(); - - MysqlTable table = this.table(MysqlTable.tableType(query)); - return table.query(this.sessions.session(), query); - } - - @Override - public Number queryNumber(Query query) { - this.checkOpened(); - - MysqlTable table = this.table(MysqlTable.tableType(query)); - return table.queryNumber(this.sessions.session(), query); - } - - @Override - public void beginTx() { - this.checkOpened(); - - Session session = this.sessions.session(); - try { - session.begin(); - } catch (SQLException e) { - throw new BackendException("Failed to open transaction", e); - } - } - - @Override - public void commitTx() { - this.checkOpened(); - - Session session = this.sessions.session(); - int count = session.commit(); - if (LOG.isDebugEnabled()) { - LOG.debug("Store {} committed {} items", this.store, count); - } - } - - @Override - public void rollbackTx() { - this.checkOpened(); - Session session = this.sessions.session(); - session.rollback(); - } - - @Override - public BackendFeatures features() { - return FEATURES; - } - - protected void initTables() { - Session session = this.sessions.session(); - for (MysqlTable table : this.tables()) { - table.init(session); - } - } - - protected void clearTables() { - Session session = this.sessions.session(); - for (MysqlTable table : this.tables()) { - table.clear(session); - } - } - - protected void truncateTables() { - Session session = this.sessions.session(); - for (MysqlTable table : this.tables()) { - table.truncate(session); - } - } - - protected Collection tables() { - return this.tables.values(); - } - - @Override - protected final MysqlTable table(HugeType type) { - assert type != null; - MysqlTable table = this.tables.get(convertTaskOrServerToVertex(type)); - if (table == null) { - throw new BackendException("Unsupported table type: %s", type); - } - return table; - } - - @Override - protected Session session(HugeType type) { - this.checkOpened(); - return this.sessions.session(); - } - - protected final void checkClusterConnected() { - E.checkState(this.sessions != null, - "MySQL store has not been initialized"); - } - - protected static MysqlBackendEntry castBackendEntry(BackendEntry entry) { - if (!(entry instanceof MysqlBackendEntry)) { - throw new BackendException( - "MySQL store only supports MysqlBackendEntry"); - } - return (MysqlBackendEntry) entry; - } - - public static class MysqlSchemaStore extends MysqlStore { - - private final MysqlTables.Counters counters; - - public MysqlSchemaStore(BackendStoreProvider provider, - String database, String store) { - super(provider, database, store); - - this.counters = new MysqlTables.Counters(); - - registerTableManager(HugeType.VERTEX_LABEL, - new MysqlTables.VertexLabel()); - registerTableManager(HugeType.EDGE_LABEL, - new MysqlTables.EdgeLabel()); - registerTableManager(HugeType.PROPERTY_KEY, - new MysqlTables.PropertyKey()); - registerTableManager(HugeType.INDEX_LABEL, - new MysqlTables.IndexLabel()); - } - - @Override - protected Collection tables() { - List tables = new ArrayList<>(super.tables()); - tables.add(this.counters); - return tables; - } - - @Override - public void increaseCounter(HugeType type, long increment) { - this.checkOpened(); - Session session = super.sessions.session(); - this.counters.increaseCounter(session, type, increment); - } - - @Override - public long getCounter(HugeType type) { - this.checkOpened(); - Session session = super.sessions.session(); - return this.counters.getCounter(session, type); - } - - @Override - public boolean isSchemaStore() { - return true; - } - } - - public static class MysqlGraphStore extends MysqlStore { - - public MysqlGraphStore(BackendStoreProvider provider, - String database, String store) { - super(provider, database, store); - - registerTableManager(HugeType.VERTEX, - new MysqlTables.Vertex(store)); - - registerTableManager(HugeType.EDGE_OUT, - MysqlTables.Edge.out(store)); - registerTableManager(HugeType.EDGE_IN, - MysqlTables.Edge.in(store)); - - registerTableManager(HugeType.SECONDARY_INDEX, - new MysqlTables.SecondaryIndex(store)); - registerTableManager(HugeType.RANGE_INT_INDEX, - new MysqlTables.RangeIntIndex(store)); - registerTableManager(HugeType.RANGE_FLOAT_INDEX, - new MysqlTables.RangeFloatIndex(store)); - registerTableManager(HugeType.RANGE_LONG_INDEX, - new MysqlTables.RangeLongIndex(store)); - registerTableManager(HugeType.RANGE_DOUBLE_INDEX, - new MysqlTables.RangeDoubleIndex(store)); - registerTableManager(HugeType.SEARCH_INDEX, - new MysqlTables.SearchIndex(store)); - registerTableManager(HugeType.SHARD_INDEX, - new MysqlTables.ShardIndex(store)); - registerTableManager(HugeType.UNIQUE_INDEX, - new MysqlTables.UniqueIndex(store)); - } - - @Override - public boolean isSchemaStore() { - return false; - } - - @Override - public Id nextId(HugeType type) { - throw new UnsupportedOperationException("MysqlGraphStore.nextId()"); - } - - @Override - public void increaseCounter(HugeType type, long num) { - throw new UnsupportedOperationException( - "MysqlGraphStore.increaseCounter()"); - } - - @Override - public long getCounter(HugeType type) { - throw new UnsupportedOperationException( - "MysqlGraphStore.getCounter()"); - } - } - - public static class MysqlSystemStore extends MysqlGraphStore { - - private final MysqlTables.Meta meta; - - public MysqlSystemStore(BackendStoreProvider provider, - String database, String store) { - super(provider, database, store); - - this.meta = new MysqlTables.Meta(); - } - - @Override - public void init() { - super.init(); - Session session = super.session(null); - String driverVersion = this.provider().driverVersion(); - this.meta.writeVersion(session, driverVersion); - LOG.info("Write down the backend version: {}", driverVersion); - } - - @Override - public String storedVersion() { - super.init(); - Session session = super.session(null); - return this.meta.readVersion(session); - } - - @Override - protected Collection tables() { - List tables = new ArrayList<>(super.tables()); - tables.add(this.meta); - return tables; - } - } -} diff --git a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlStoreProvider.java b/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlStoreProvider.java deleted file mode 100644 index ead148158c..0000000000 --- a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlStoreProvider.java +++ /dev/null @@ -1,76 +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.hugegraph.backend.store.mysql; - -import org.apache.hugegraph.backend.store.AbstractBackendStoreProvider; -import org.apache.hugegraph.backend.store.BackendStore; -import org.apache.hugegraph.backend.store.mysql.MysqlStore.MysqlGraphStore; -import org.apache.hugegraph.backend.store.mysql.MysqlStore.MysqlSchemaStore; -import org.apache.hugegraph.backend.store.mysql.MysqlStore.MysqlSystemStore; -import org.apache.hugegraph.config.HugeConfig; - -public class MysqlStoreProvider extends AbstractBackendStoreProvider { - - protected String database() { - return this.graph().toLowerCase(); - } - - @Override - protected BackendStore newSchemaStore(HugeConfig config, String store) { - return new MysqlSchemaStore(this, this.database(), store); - } - - @Override - protected BackendStore newGraphStore(HugeConfig config, String store) { - return new MysqlGraphStore(this, this.database(), store); - } - - @Override - protected BackendStore newSystemStore(HugeConfig config, String store) { - return new MysqlSystemStore(this, this.database(), store); - } - - @Override - public String type() { - return "mysql"; - } - - @Override - public String driverVersion() { - /* - * Versions history: - * [1.0] HugeGraph-1328: supports backend table version checking - * [1.1] HugeGraph-1322: add support for full-text search - * [1.2] #296: support range sortKey feature - * [1.3] #270 & #398: support shard-index and vertex + sortkey prefix, - * also split range table to rangeInt, rangeFloat, - * rangeLong and rangeDouble - * [1.4] #633: support unique index - * [1.5] #661: reduce the storage of vertex/edge id - * [1.6] #691: support aggregate property - * [1.7] #746: support userdata for indexlabel - * [1.8] #894: asStoredString() encoding is changed to signed B64 - * instead of sortable B64 - * [1.9] #295: support ttl for vertex and edge - * [1.10] #1333: support read frequency for property key - * [1.11] #1506: rename read frequency to write type - * [1.11] #1533: add meta table in system store - */ - return "1.11"; - } -} diff --git a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlTable.java b/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlTable.java deleted file mode 100644 index c000033611..0000000000 --- a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlTable.java +++ /dev/null @@ -1,847 +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.hugegraph.backend.store.mysql; - -import java.math.BigDecimal; -import java.sql.PreparedStatement; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.function.BiFunction; - -import org.apache.hugegraph.backend.BackendException; -import org.apache.hugegraph.backend.id.Id; -import org.apache.hugegraph.backend.page.PageState; -import org.apache.hugegraph.backend.query.Aggregate; -import org.apache.hugegraph.backend.query.Condition; -import org.apache.hugegraph.backend.query.ConditionQuery; -import org.apache.hugegraph.backend.query.IdQuery; -import org.apache.hugegraph.backend.query.Query; -import org.apache.hugegraph.backend.store.BackendEntry; -import org.apache.hugegraph.backend.store.BackendTable; -import org.apache.hugegraph.backend.store.Shard; -import org.apache.hugegraph.backend.store.TableDefine; -import org.apache.hugegraph.exception.NotFoundException; -import org.apache.hugegraph.iterator.ExtendableIterator; -import org.apache.hugegraph.iterator.WrappedIterator; -import org.apache.hugegraph.type.HugeType; -import org.apache.hugegraph.type.define.HugeKeys; -import org.apache.hugegraph.util.E; -import org.apache.hugegraph.util.Log; -import org.apache.logging.log4j.util.Strings; -import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils; -import org.slf4j.Logger; - -import com.google.common.collect.ImmutableList; - -public abstract class MysqlTable - extends BackendTable { - - private static final Logger LOG = Log.logger(MysqlTable.class); - - private static final String DECIMAL = "DECIMAL"; - - // The template cache for insert and delete statements - private String insertTemplate; - private String insertTemplateTtl; - private String deleteTemplate; - private String updateIfPresentTemplate; - private String updateIfAbsentTemplate; - - private final MysqlShardSplitter shardSplitter; - - public MysqlTable(String table) { - super(table); - this.insertTemplate = null; - this.insertTemplateTtl = null; - this.deleteTemplate = null; - this.updateIfPresentTemplate = null; - this.updateIfAbsentTemplate = null; - - this.shardSplitter = new MysqlShardSplitter(this.table()); - } - - @Override - protected void registerMetaHandlers() { - this.registerMetaHandler("splits", (session, meta, args) -> { - E.checkArgument(args.length == 1, - "The args count of %s must be 1", meta); - long splitSize = (long) args[0]; - return this.shardSplitter.getSplits(session, splitSize); - }); - } - - public abstract TableDefine tableDefine(); - - @Override - public void init(MysqlSessions.Session session) { - this.createTable(session, this.tableDefine()); - } - - @Override - public void clear(MysqlSessions.Session session) { - this.dropTable(session); - } - - public void truncate(MysqlSessions.Session session) { - this.truncateTable(session); - } - - protected void createTable(MysqlSessions.Session session, TableDefine tableDefine) { - StringBuilder sql = new StringBuilder(); - sql.append("CREATE TABLE IF NOT EXISTS "); - sql.append(this.table()).append(" ("); - // Add columns - for (Map.Entry entry : - tableDefine.columns().entrySet()) { - sql.append(formatKey(entry.getKey())); - sql.append(" "); - sql.append(entry.getValue()); - sql.append(", "); - } - // Specified primary keys - sql.append(" PRIMARY KEY ("); - int i = 0; - int size = tableDefine.keys().size(); - for (HugeKeys key : tableDefine.keys()) { - sql.append(formatKey(key)); - if (++i != size) { - sql.append(", "); - } - } - sql.append("))"); - sql.append(this.engine(session)); - sql.append(";"); - - LOG.debug("Create table: {}", sql); - try { - session.execute(sql.toString()); - } catch (SQLException e) { - throw new BackendException("Failed to create table with '%s'", - e, sql); - } - } - - protected String engine(MysqlSessions.Session session) { - String engine = session.config().get(MysqlOptions.JDBC_STORAGE_ENGINE); - return " ENGINE=" + engine; - } - - protected void dropTable(MysqlSessions.Session session) { - LOG.debug("Drop table: {}", this.table()); - String sql = this.buildDropTemplate(); - try { - session.execute(sql); - } catch (SQLException e) { - throw new BackendException("Failed to drop table with '%s'", - e, sql); - } - } - - protected void truncateTable(MysqlSessions.Session session) { - LOG.debug("Truncate table: {}", this.table()); - String sql = this.buildTruncateTemplate(); - try { - session.execute(sql); - } catch (SQLException e) { - throw new BackendException("Failed to truncate table with '%s'", - e, sql); - } - } - - protected List idColumnName() { - return this.tableDefine().keys(); - } - - protected List idColumnValue(MysqlBackendEntry.Row entry) { - return ImmutableList.of(entry.id().asLong()); - } - - protected List idColumnValue(Id id) { - return ImmutableList.of(id.asObject()); - } - - protected void insertOrUpdate(MysqlSessions.Session session, String template, - List params) { - PreparedStatement insertStmt; - try { - // Create or get insert prepare statement - insertStmt = session.prepareStatement(template); - int i = 1; - for (Object param : params) { - insertStmt.setObject(i++, param); - } - } catch (SQLException e) { - throw new BackendException("Failed to prepare statement '%s' " + - "with params: %s", template, params); - } - session.add(insertStmt); - } - - protected final String buildUpdateTemplate(MysqlBackendEntry.Row entry) { - if (entry.ttl() != 0L) { - if (this.insertTemplateTtl != null) { - return this.insertTemplateTtl; - } - - this.insertTemplateTtl = this.buildUpdateForcedTemplate(entry); - return this.insertTemplateTtl; - } else { - if (this.insertTemplate != null) { - return this.insertTemplate; - } - - this.insertTemplate = this.buildUpdateForcedTemplate(entry); - return this.insertTemplate; - } - } - - protected String buildUpdateForcedTemplate(MysqlBackendEntry.Row entry) { - StringBuilder insert = new StringBuilder(); - insert.append("REPLACE INTO ").append(this.table()); - return this.buildInsertKeys(insert, entry); - } - - protected String buildUpdateIfAbsentTemplate(MysqlBackendEntry.Row entry) { - StringBuilder insert = new StringBuilder(); - insert.append("INSERT IGNORE INTO ").append(this.table()); - return this.buildInsertKeys(insert, entry); - } - - protected String buildInsertKeys(StringBuilder insert, - MysqlBackendEntry.Row entry) { - insert.append(" ("); - - int i = 0; - int size = entry.columns().size(); - for (HugeKeys key : entry.columns().keySet()) { - insert.append(formatKey(key)); - if (++i != size) { - insert.append(", "); - } - } - insert.append(") VALUES ("); - // Fill with '?' as a placeholder - for (i = 0; i < size; i++) { - insert.append("?"); - if (i != size - 1) { - insert.append(", "); - } - } - insert.append(")"); - - return insert.toString(); - } - - protected List buildUpdateForcedParams(MysqlBackendEntry.Row entry) { - return this.buildColumnsParams(entry); - } - - protected List buildUpdateIfAbsentParams(MysqlBackendEntry.Row entry) { - return this.buildColumnsParams(entry); - } - - protected List buildColumnsParams(MysqlBackendEntry.Row entry) { - return this.buildColumnsParams(entry, null); - } - - protected List buildColumnsParams(MysqlBackendEntry.Row entry, - List skipKeys) { - List objects = new ArrayList<>(); - for (Map.Entry e : entry.columns().entrySet()) { - HugeKeys key = e.getKey(); - Object value = e.getValue(); - if (skipKeys != null && skipKeys.contains(key)) { - continue; - } - String type = this.tableDefine().columns().get(key); - if (type.startsWith(DECIMAL)) { - value = new BigDecimal(value.toString()); - } - objects.add(value); - } - return objects; - } - - protected String buildUpdateIfPresentTemplate(MysqlBackendEntry.Row entry) { - StringBuilder update = new StringBuilder(); - update.append("UPDATE ").append(this.table()); - update.append(" SET "); - - List idNames = this.idColumnName(); - - int i = 0; - for (HugeKeys key : entry.columns().keySet()) { - if (idNames.contains(key)) { - continue; - } - if (i++ > 0) { - update.append(", "); - } - update.append(formatKey(key)); - update.append("=?"); - } - - WhereBuilder where = this.newWhereBuilder(); - where.and(formatKeys(idNames), "="); - update.append(where.build()); - - return update.toString(); - } - - protected List buildUpdateIfPresentParams(MysqlBackendEntry.Row entry) { - List idNames = this.idColumnName(); - List params = this.buildColumnsParams(entry, idNames); - - List idValues = this.idColumnValue(entry); - params.addAll(idValues); - - return params; - } - - protected String buildDeleteTemplate(List idNames) { - StringBuilder delete = new StringBuilder(); - delete.append("DELETE FROM ").append(this.table()); - this.appendPartition(delete); - - WhereBuilder where = this.newWhereBuilder(); - where.and(formatKeys(idNames), "="); - delete.append(where.build()); - - return delete.toString(); - } - - protected String buildDropTemplate() { - return String.format("DROP TABLE IF EXISTS %s;", this.table()); - } - - protected String buildTruncateTemplate() { - return String.format("TRUNCATE TABLE %s;", this.table()); - } - - protected void appendPartition(StringBuilder sb) { - // pass - } - - /** - * Insert an entire row - */ - @Override - public void insert(MysqlSessions.Session session, MysqlBackendEntry.Row entry) { - String template = this.buildUpdateTemplate(entry); - List params = this.buildUpdateForcedParams(entry); - this.insertOrUpdate(session, template, params); - } - - @Override - public void delete(MysqlSessions.Session session, MysqlBackendEntry.Row entry) { - List idNames = this.idColumnName(); - - String template = this.deleteTemplate; - if (template == null) { - template = this.buildDeleteTemplate(idNames); - this.deleteTemplate = template; - } - - PreparedStatement deleteStmt; - try { - deleteStmt = session.prepareStatement(template); - if (entry.columns().isEmpty()) { - // Delete just by id - List idValues = this.idColumnValue(entry); - assert idNames.size() == idValues.size(); - - for (int i = 0, n = idNames.size(); i < n; i++) { - deleteStmt.setObject(i + 1, idValues.get(i)); - } - } else { - // Delete just by column keys(must be id columns) - for (int i = 0, n = idNames.size(); i < n; i++) { - HugeKeys key = idNames.get(i); - Object value = entry.column(key); - - deleteStmt.setObject(i + 1, value); - } - } - } catch (SQLException e) { - throw new BackendException("Failed to prepare statement '%s'" + - "with entry columns %s", - template, entry.columns().values()); - } - session.add(deleteStmt); - } - - @Override - public void append(MysqlSessions.Session session, MysqlBackendEntry.Row entry) { - this.insert(session, entry); - } - - @Override - public void eliminate(MysqlSessions.Session session, MysqlBackendEntry.Row entry) { - this.delete(session, entry); - } - - @Override - public void updateIfPresent(MysqlSessions.Session session, MysqlBackendEntry.Row entry) { - String template = this.updateIfPresentTemplate; - if (template == null) { - template = this.buildUpdateIfPresentTemplate(entry); - this.updateIfPresentTemplate = template; - } - List params = this.buildUpdateIfPresentParams(entry); - this.insertOrUpdate(session, template, params); - } - - @Override - public void updateIfAbsent(MysqlSessions.Session session, MysqlBackendEntry.Row entry) { - String template = this.updateIfAbsentTemplate; - if (template == null) { - template = this.buildUpdateIfAbsentTemplate(entry); - this.updateIfAbsentTemplate = template; - } - List params = this.buildUpdateIfAbsentParams(entry); - this.insertOrUpdate(session, template, params); - } - - @Override - public boolean queryExist(MysqlSessions.Session session, MysqlBackendEntry.Row entry) { - Query query = new IdQuery.OneIdQuery(HugeType.UNKNOWN, entry.id()); - Iterator iter = this.query(session, query); - try { - return iter.hasNext(); - } finally { - WrappedIterator.close(iter); - } - } - - @Override - public Number queryNumber(MysqlSessions.Session session, Query query) { - Aggregate aggregate = query.aggregateNotNull(); - - Iterator results = this.query(session, query, (q, rs) -> { - try { - if (!rs.resultSet().next()) { - return IteratorUtils.of(aggregate.defaultValue()); - } - return IteratorUtils.of(rs.resultSet().getLong(1)); - } catch (SQLException e) { - throw new BackendException(e); - } finally { - rs.close(); - } - }); - return aggregate.reduce(results); - } - - @Override - public Iterator query(MysqlSessions.Session session, Query query) { - return this.query(session, query, this::results2Entries); - } - - protected Iterator query(MysqlSessions.Session session, Query query, - BiFunction> parser) { - ExtendableIterator rs = new ExtendableIterator<>(); - - if (query.limit() == 0L && !query.noLimit()) { - LOG.debug("Return empty result(limit=0) for query {}", query); - return rs; - } - - List selections = this.query2Select(this.table(), query); - try { - for (StringBuilder selection : selections) { - ResultSetWrapper results = session.select(selection.toString()); - rs.extend(parser.apply(query, results)); - } - } catch (SQLException e) { - // Closing the iterator - try { - rs.close(); - } catch (Exception e2) { - LOG.error("Got error {} when closing iterator for query {}", e2, query); - } - throw new BackendException("Failed to query [%s]", e, query); - } - - LOG.debug("Return {} for query {}", rs, query); - return rs; - } - - protected List query2Select(String table, Query query) { - // Build query - StringBuilder select = new StringBuilder(64); - select.append("SELECT "); - - // Set aggregate - Aggregate aggregate = query.aggregate(); - if (aggregate != null) { - select.append(aggregate); - } else { - select.append("*"); - } - - // Set table - select.append(" FROM ").append(table); - - // Is query by id? - List ids = this.queryId2Select(query, select); - - List selections; - - if (query.conditionsSize() == 0) { - // Query only by id - LOG.debug("Query only by id(s): {}", ids); - selections = ids; - } else { - ConditionQuery condQuery = (ConditionQuery) query; - if (condQuery.containsScanRelation()) { - assert ids.size() == 1; - return ImmutableList.of(queryByRange(condQuery, ids.get(0))); - } - - selections = new ArrayList<>(ids.size()); - for (StringBuilder selection : ids) { - // Query by condition - selections.addAll(this.queryCondition2Select(query, selection)); - } - LOG.debug("Query by conditions: {}", selections); - } - // Set page, order-by and limit - for (StringBuilder selection : selections) { - boolean hasOrder = !query.orders().isEmpty(); - if (hasOrder) { - this.wrapOrderBy(selection, query); - } - if (query.paging()) { - this.wrapPage(selection, query, false); - wrapLimit(selection, query); - } else { - if (aggregate == null && !hasOrder) { - select.append(this.orderByKeys()); - } - if (!query.noLimit() || query.offset() > 0L) { - this.wrapOffset(selection, query); - } - } - } - - return selections; - } - - protected StringBuilder queryByRange(ConditionQuery query, - StringBuilder select) { - E.checkArgument(query.relations().size() == 1, - "Invalid scan with multi conditions: %s", query); - Condition.Relation scan = query.relations().iterator().next(); - Shard shard = (Shard) scan.value(); - - String page = query.page(); - if (MysqlShardSplitter.START.equals(shard.start()) && - MysqlShardSplitter.END.equals(shard.end()) && - (page == null || page.isEmpty())) { - this.wrapLimit(select, query); - return select; - } - - HugeKeys partitionKey = this.idColumnName().get(0); - - if (page != null && !page.isEmpty()) { - // >= page - this.wrapPage(select, query, true); - // < end - WhereBuilder where = this.newWhereBuilder(false); - if (!MysqlShardSplitter.END.equals(shard.end())) { - where.and(); - where.lt(formatKey(partitionKey), shard.end()); - } - select.append(where.build()); - } else { - // >= start - WhereBuilder where = this.newWhereBuilder(); - boolean hasStart = false; - if (!MysqlShardSplitter.START.equals(shard.start())) { - where.gte(formatKey(partitionKey), shard.start()); - hasStart = true; - } - // < end - if (!MysqlShardSplitter.END.equals(shard.end())) { - if (hasStart) { - where.and(); - } - where.lt(formatKey(partitionKey), shard.end()); - } - select.append(where.build()); - } - this.wrapLimit(select, query); - - return select; - } - - protected List queryId2Select(Query query, - StringBuilder select) { - // Query by id(s) - if (query.idsSize() == 0) { - return ImmutableList.of(select); - } - - List nameParts = this.idColumnName(); - - List> ids = new ArrayList<>(query.idsSize()); - for (Id id : query.ids()) { - List idParts = this.idColumnValue(id); - if (nameParts.size() != idParts.size()) { - throw new NotFoundException( - "Unsupported ID format: '%s' (should contain %s)", - id, nameParts); - } - ids.add(idParts); - } - - // Query only by partition-key - if (nameParts.size() == 1) { - List values = new ArrayList<>(ids.size()); - for (List objects : ids) { - assert objects.size() == 1; - values.add(objects.get(0)); - } - - WhereBuilder where = this.newWhereBuilder(); - where.in(formatKey(nameParts.get(0)), values); - select.append(where.build()); - return ImmutableList.of(select); - } - - /* - * Query by partition-key + clustering-key - * NOTE: Error if multi-column IN clause include partition key: - * error: multi-column relations can only be applied to clustering - * columns when using: select.where(QueryBuilder.in(names, idList)); - * So we use multi-query instead of IN - */ - List selections = new ArrayList<>(ids.size()); - for (List objects : ids) { - assert nameParts.size() == objects.size(); - StringBuilder idSelection = new StringBuilder(select); - /* - * NOTE: concat with AND relation, like: - * "pk = id and ck1 = v1 and ck2 = v2" - */ - WhereBuilder where = this.newWhereBuilder(); - where.and(formatKeys(nameParts), objects); - - idSelection.append(where.build()); - selections.add(idSelection); - } - return selections; - } - - protected List queryCondition2Select(Query query, - StringBuilder select) { - // Query by conditions - Collection conditions = query.conditions(); - List clauses = new ArrayList<>(conditions.size()); - for (Condition condition : conditions) { - clauses.add(this.condition2Sql(condition)); - } - WhereBuilder where = this.newWhereBuilder(); - where.and(clauses); - select.append(where.build()); - return ImmutableList.of(select); - } - - protected StringBuilder condition2Sql(Condition condition) { - switch (condition.type()) { - case AND: - Condition.And and = (Condition.And) condition; - StringBuilder left = this.condition2Sql(and.left()); - StringBuilder right = this.condition2Sql(and.right()); - int size = left.length() + right.length() + " AND ".length(); - StringBuilder sql = new StringBuilder(size); - sql.append(left).append(" AND ").append(right); - return sql; - case OR: - throw new BackendException("Not support OR currently"); - case RELATION: - Condition.Relation r = (Condition.Relation) condition; - return this.relation2Sql(r); - default: - final String msg = "Unsupported condition: " + condition; - throw new AssertionError(msg); - } - } - - protected StringBuilder relation2Sql(Condition.Relation relation) { - String key = relation.serialKey().toString(); - Object value = relation.serialValue(); - - WhereBuilder sql = this.newWhereBuilder(false); - sql.relation(key, relation.relation(), value); - return sql.build(); - } - - protected WhereBuilder newWhereBuilder() { - return this.newWhereBuilder(true); - } - - protected WhereBuilder newWhereBuilder(boolean startWithWhere) { - return new WhereBuilder(startWithWhere); - } - - protected void wrapOrderBy(StringBuilder select, Query query) { - int size = query.orders().size(); - assert size > 0; - - int i = 0; - // Set order-by - select.append(" ORDER BY "); - for (Map.Entry order : - query.orders().entrySet()) { - String key = formatKey(order.getKey()); - Query.Order value = order.getValue(); - select.append(key).append(" "); - if (value == Query.Order.ASC) { - select.append("ASC"); - } else { - assert value == Query.Order.DESC; - select.append("DESC"); - } - if (++i != size) { - select.append(", "); - } - } - } - - protected void wrapPage(StringBuilder select, Query query, boolean scan) { - String page = query.page(); - // It's the first time if page is empty - if (!page.isEmpty()) { - byte[] position = PageState.fromString(page).position(); - Map columns = MysqlEntryIterator.PagePosition.fromBytes(position) - .columns(); - - List idColumnNames = this.idColumnName(); - List values = new ArrayList<>(idColumnNames.size()); - for (HugeKeys key : idColumnNames) { - values.add(columns.get(key)); - } - - // Need add `where` to `select` when query is IdQuery - boolean expectWhere = scan || query.conditionsSize() == 0; - WhereBuilder where = this.newWhereBuilder(expectWhere); - if (!expectWhere) { - where.and(); - } - where.gte(formatKeys(idColumnNames), values); - select.append(where.build()); - } - } - - private void wrapLimit(StringBuilder select, Query query) { - select.append(this.orderByKeys()); - if (!query.noLimit()) { - // Fetch `limit + 1` rows for judging whether reached the last page - select.append(" limit "); - select.append(query.limit() + 1); - } - select.append(";"); - } - - protected String orderByKeys() { - return Strings.EMPTY; - } - - protected void wrapOffset(StringBuilder select, Query query) { - assert query.limit() >= 0; - assert query.offset() >= 0; - // Set limit and offset - select.append(" limit "); - select.append(query.limit()); - select.append(" offset "); - select.append(query.offset()); - select.append(";"); - - query.goOffset(query.offset()); - } - - protected Iterator results2Entries(Query query, - ResultSetWrapper results) { - return new MysqlEntryIterator(results, query, this::mergeEntries); - } - - protected BackendEntry mergeEntries(BackendEntry e1, BackendEntry e2) { - // Return the next entry (not merged) - return e2; - } - - public static String formatKey(HugeKeys key) { - return key.name(); - } - - public static HugeKeys parseKey(String name) { - return HugeKeys.valueOf(name.toUpperCase()); - } - - public static List formatKeys(List keys) { - List names = new ArrayList<>(keys.size()); - for (HugeKeys key : keys) { - names.add(formatKey(key)); - } - return names; - } - - private static class MysqlShardSplitter extends ShardSplitter { - - private static final String BASE64 = - "0123456789=?ABCDEFGHIJKLMNOPQRSTUVWXYZ" + - "abcdefghijklmnopqrstuvwxyz"; - private static final int COUNT = 64; - - public MysqlShardSplitter(String table) { - super(table); - } - - @Override - public List getSplits(MysqlSessions.Session session, long splitSize) { - E.checkArgument(splitSize >= MIN_SHARD_SIZE, - "The split-size must be >= %s bytes, but got %s", - MIN_SHARD_SIZE, splitSize); - List splits = new ArrayList<>(COUNT); - splits.add(new Shard(START, BASE64.substring(0, 1), 0)); - for (int i = 0; i < COUNT - 1; i++) { - splits.add(new Shard(BASE64.substring(i, i + 1), - BASE64.substring(i + 1, i + 2), 0)); - } - splits.add(new Shard(BASE64.substring(COUNT - 1, COUNT), END, 0)); - return splits; - } - - @Override - protected long estimateDataSize(MysqlSessions.Session session) { - return 0L; - } - - @Override - protected long estimateNumKeys(MysqlSessions.Session session) { - return 0L; - } - } -} diff --git a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlTables.java b/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlTables.java deleted file mode 100644 index 981369f56d..0000000000 --- a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlTables.java +++ /dev/null @@ -1,667 +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.hugegraph.backend.store.mysql; - -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; - -import org.apache.hugegraph.backend.BackendException; -import org.apache.hugegraph.backend.id.EdgeId; -import org.apache.hugegraph.backend.id.Id; -import org.apache.hugegraph.backend.id.IdGenerator; -import org.apache.hugegraph.backend.id.IdUtil; -import org.apache.hugegraph.backend.id.SplicingIdGenerator; -import org.apache.hugegraph.backend.store.BackendEntry; -import org.apache.hugegraph.backend.store.BackendEntryIterator; -import org.apache.hugegraph.backend.store.TableDefine; -import org.apache.hugegraph.type.HugeType; -import org.apache.hugegraph.type.define.Directions; -import org.apache.hugegraph.type.define.HugeKeys; -import org.apache.hugegraph.util.E; - -import com.google.common.collect.ImmutableMap; - -public class MysqlTables { - - public static final String BOOLEAN = "BOOLEAN"; - public static final String TINYINT = "TINYINT"; - public static final String INT = "INT"; - public static final String BIGINT = "BIGINT"; - public static final String NUMERIC = "DOUBLE"; - public static final String SMALL_TEXT = "SMALL_TEXT"; - public static final String MID_TEXT = "MID_TEXT"; - public static final String LARGE_TEXT = "LARGE_TEXT"; - // Just used for task input and result - public static final String HUGE_TEXT = "HUGE_TEXT"; - - private static final String DATATYPE_PK = INT; - private static final String DATATYPE_SL = INT; // VL/EL - private static final String DATATYPE_IL = INT; - - private static final String SMALL_JSON = MID_TEXT; - private static final String LARGE_JSON = LARGE_TEXT; - - private static final Map TYPES_MAPPING = ImmutableMap.of( - SMALL_TEXT, "VARCHAR(255)", - MID_TEXT, "VARCHAR(1024)", - LARGE_TEXT, "TEXT", - HUGE_TEXT, "MEDIUMTEXT" - ); - - public static class MysqlTableTemplate extends MysqlTable { - - protected TableDefine define; - - public MysqlTableTemplate(String table) { - super(table); - } - - @Override - public TableDefine tableDefine() { - return this.define; - } - } - - public static class Meta extends MysqlTableTemplate { - - public static final String TABLE = HugeType.META.string(); - - public Meta() { - this(TYPES_MAPPING); - } - - public Meta(Map typesMapping) { - super(TABLE); - - this.define = new TableDefine(typesMapping); - this.define.column(HugeKeys.NAME, SMALL_TEXT); - this.define.column(HugeKeys.VALUE, MID_TEXT); - this.define.keys(HugeKeys.NAME); - } - - public void writeVersion(MysqlSessions.Session session, String driverVersion) { - String versionColumn = formatKey(HugeKeys.VERSION); - String insert = String.format("INSERT IGNORE INTO %s VALUES " + - "('%s', '%s')", this.table(), - versionColumn, driverVersion); - try { - session.execute(insert); - } catch (SQLException e) { - throw new BackendException("Failed to insert driver version " + - "with '%s'", e, insert); - } - } - - public String readVersion(MysqlSessions.Session session) { - String select = String.format("SELECT %s FROM %s WHERE %s = '%s'", - formatKey(HugeKeys.VALUE), - this.table(), formatKey(HugeKeys.NAME), - formatKey(HugeKeys.VERSION)); - try (ResultSetWrapper results = session.select(select)) { - ResultSet rs = results.resultSet(); - if (!rs.next()) { - return null; - } - return rs.getString(formatKey(HugeKeys.VALUE)); - } catch (SQLException e) { - throw new BackendException( - "Failed to get stored version with '%s'", e, select); - } - } - } - - public static class Counters extends MysqlTableTemplate { - - public static final String TABLE = HugeType.COUNTER.string(); - - public Counters() { - this(TYPES_MAPPING); - } - - public Counters(Map typesMapping) { - super(TABLE); - - this.define = new TableDefine(typesMapping); - this.define.column(HugeKeys.SCHEMA_TYPE, SMALL_TEXT); - this.define.column(HugeKeys.ID, INT); - this.define.keys(HugeKeys.SCHEMA_TYPE); - } - - public long getCounter(MysqlSessions.Session session, HugeType type) { - String schemaCol = formatKey(HugeKeys.SCHEMA_TYPE); - String idCol = formatKey(HugeKeys.ID); - - String select = String.format("SELECT ID FROM %s WHERE %s = '%s';", - this.table(), schemaCol, type.name()); - try (ResultSetWrapper results = session.select(select)) { - ResultSet rs = results.resultSet(); - if (rs.next()) { - return rs.getLong(idCol); - } else { - return 0L; - } - } catch (SQLException e) { - throw new BackendException( - "Failed to get id from counters with type '%s'", - e, type); - } - } - - public void increaseCounter(MysqlSessions.Session session, - HugeType type, long increment) { - String update = String.format( - "INSERT INTO %s VALUES ('%s', %s) " + - "ON DUPLICATE KEY UPDATE ID = ID + %s;", - this.table(), type.name(), increment, increment); - try { - session.execute(update); - } catch (SQLException e) { - throw new BackendException("Failed to update counters " + - "with '%s'", e, update); - } - } - } - - public static class VertexLabel extends MysqlTableTemplate { - - public static final String TABLE = HugeType.VERTEX_LABEL.string(); - - public VertexLabel() { - this(TYPES_MAPPING); - } - - public VertexLabel(Map typesMapping) { - super(TABLE); - - this.define = new TableDefine(typesMapping); - this.define.column(HugeKeys.ID, DATATYPE_SL); - this.define.column(HugeKeys.NAME, SMALL_TEXT); - this.define.column(HugeKeys.ID_STRATEGY, TINYINT); - this.define.column(HugeKeys.PRIMARY_KEYS, SMALL_JSON); - this.define.column(HugeKeys.PROPERTIES, SMALL_JSON); - this.define.column(HugeKeys.NULLABLE_KEYS, SMALL_JSON); - this.define.column(HugeKeys.INDEX_LABELS, SMALL_JSON); - this.define.column(HugeKeys.ENABLE_LABEL_INDEX, BOOLEAN); - this.define.column(HugeKeys.USER_DATA, LARGE_JSON); - this.define.column(HugeKeys.STATUS, TINYINT); - this.define.column(HugeKeys.TTL, INT); - this.define.column(HugeKeys.TTL_START_TIME, DATATYPE_PK); - this.define.keys(HugeKeys.ID); - } - } - - public static class EdgeLabel extends MysqlTableTemplate { - - public static final String TABLE = HugeType.EDGE_LABEL.string(); - - public EdgeLabel() { - this(TYPES_MAPPING); - } - - public EdgeLabel(Map typesMapping) { - super(TABLE); - - this.define = new TableDefine(typesMapping); - this.define.column(HugeKeys.ID, DATATYPE_SL); - this.define.column(HugeKeys.NAME, SMALL_TEXT); - this.define.column(HugeKeys.FREQUENCY, TINYINT); - this.define.column(HugeKeys.SOURCE_LABEL, DATATYPE_SL); - this.define.column(HugeKeys.TARGET_LABEL, DATATYPE_SL); - this.define.column(HugeKeys.SORT_KEYS, SMALL_JSON); - this.define.column(HugeKeys.PROPERTIES, SMALL_JSON); - this.define.column(HugeKeys.NULLABLE_KEYS, SMALL_JSON); - this.define.column(HugeKeys.INDEX_LABELS, SMALL_JSON); - this.define.column(HugeKeys.ENABLE_LABEL_INDEX, BOOLEAN); - this.define.column(HugeKeys.USER_DATA, LARGE_JSON); - this.define.column(HugeKeys.STATUS, TINYINT); - this.define.column(HugeKeys.TTL, INT); - this.define.column(HugeKeys.TTL_START_TIME, DATATYPE_PK); - this.define.keys(HugeKeys.ID); - } - } - - public static class PropertyKey extends MysqlTableTemplate { - - public static final String TABLE = HugeType.PROPERTY_KEY.string(); - - public PropertyKey() { - this(TYPES_MAPPING); - } - - public PropertyKey(Map typesMapping) { - super(TABLE); - - this.define = new TableDefine(typesMapping); - this.define.column(HugeKeys.ID, DATATYPE_PK); - this.define.column(HugeKeys.NAME, SMALL_TEXT); - this.define.column(HugeKeys.DATA_TYPE, TINYINT); - this.define.column(HugeKeys.CARDINALITY, TINYINT); - this.define.column(HugeKeys.AGGREGATE_TYPE, TINYINT); - this.define.column(HugeKeys.WRITE_TYPE, TINYINT); - this.define.column(HugeKeys.PROPERTIES, SMALL_JSON); - this.define.column(HugeKeys.USER_DATA, LARGE_JSON); - this.define.column(HugeKeys.STATUS, TINYINT); - this.define.keys(HugeKeys.ID); - } - } - - public static class IndexLabel extends MysqlTableTemplate { - - public static final String TABLE = HugeType.INDEX_LABEL.string(); - - public IndexLabel() { - this(TYPES_MAPPING); - } - - public IndexLabel(Map typesMapping) { - super(TABLE); - - this.define = new TableDefine(typesMapping); - this.define.column(HugeKeys.ID, DATATYPE_IL); - this.define.column(HugeKeys.NAME, SMALL_TEXT); - this.define.column(HugeKeys.BASE_TYPE, TINYINT); - this.define.column(HugeKeys.BASE_VALUE, DATATYPE_SL); - this.define.column(HugeKeys.INDEX_TYPE, TINYINT); - this.define.column(HugeKeys.FIELDS, SMALL_JSON); - this.define.column(HugeKeys.USER_DATA, LARGE_JSON); - this.define.column(HugeKeys.STATUS, TINYINT); - this.define.keys(HugeKeys.ID); - } - } - - public static class Vertex extends MysqlTableTemplate { - - public static final String TABLE = HugeType.VERTEX.string(); - - public Vertex(String store) { - this(store, TYPES_MAPPING); - } - - public Vertex(String store, Map typesMapping) { - super(joinTableName(store, TABLE)); - - this.define = new TableDefine(typesMapping); - this.define.column(HugeKeys.ID, SMALL_TEXT); - this.define.column(HugeKeys.LABEL, DATATYPE_SL); - this.define.column(HugeKeys.PROPERTIES, HUGE_TEXT); - this.define.column(HugeKeys.EXPIRED_TIME, BIGINT); - this.define.keys(HugeKeys.ID); - } - } - - public static class Edge extends MysqlTableTemplate { - - public static final String TABLE_SUFFIX = HugeType.EDGE.string(); - - private final Directions direction; - private final String delByLabelTemplate; - - public Edge(String store, Directions direction) { - this(store, direction, TYPES_MAPPING); - } - - public Edge(String store, Directions direction, - Map typesMapping) { - super(joinTableName(store, table(direction))); - - this.direction = direction; - this.delByLabelTemplate = String.format( - "DELETE FROM %s WHERE %s = ?;", - this.table(), formatKey(HugeKeys.LABEL)); - - this.define = new TableDefine(typesMapping); - this.define.column(HugeKeys.OWNER_VERTEX, SMALL_TEXT); - this.define.column(HugeKeys.DIRECTION, TINYINT); - this.define.column(HugeKeys.LABEL, DATATYPE_SL); - this.define.column(HugeKeys.SUB_LABEL, DATATYPE_SL); - this.define.column(HugeKeys.SORT_VALUES, SMALL_TEXT); - this.define.column(HugeKeys.OTHER_VERTEX, SMALL_TEXT); - this.define.column(HugeKeys.PROPERTIES, LARGE_JSON); - this.define.column(HugeKeys.EXPIRED_TIME, BIGINT); - this.define.keys(HugeKeys.OWNER_VERTEX, HugeKeys.DIRECTION, - HugeKeys.LABEL, HugeKeys.SUB_LABEL, HugeKeys.SORT_VALUES, - HugeKeys.OTHER_VERTEX); - } - - @Override - public List idColumnValue(Id id) { - EdgeId edgeId; - if (id instanceof EdgeId) { - edgeId = (EdgeId) id; - } else { - String[] idParts = EdgeId.split(id); - if (idParts.length == 1) { - // Delete edge by label - return Arrays.asList(idParts); - } - id = IdUtil.readString(id.asString()); - edgeId = EdgeId.parse(id.asString()); - } - - E.checkState(edgeId.direction() == this.direction, - "Can't query %s edges from %s edges table", - edgeId.direction(), this.direction); - - List list = new ArrayList<>(5); - list.add(IdUtil.writeStoredString(edgeId.ownerVertexId())); - list.add(edgeId.directionCode()); - list.add(edgeId.edgeLabelId().asLong()); - list.add(edgeId.subLabelId().asLong()); - list.add(edgeId.sortValues()); - list.add(IdUtil.writeStoredString(edgeId.otherVertexId())); - return list; - } - - @Override - public void delete(MysqlSessions.Session session, MysqlBackendEntry.Row entry) { - // Let super class do delete if not deleting edge by label - List idParts = this.idColumnValue(entry.id()); - if (idParts.size() > 1 || !entry.columns().isEmpty()) { - super.delete(session, entry); - return; - } - - // The only element is label - this.deleteEdgesByLabel(session, entry.id()); - } - - private void deleteEdgesByLabel(MysqlSessions.Session session, Id label) { - PreparedStatement deleteStmt; - try { - // Create or get delete prepare statement - deleteStmt = session.prepareStatement(this.delByLabelTemplate); - // Delete edges - deleteStmt.setObject(1, label.asLong()); - } catch (SQLException e) { - throw new BackendException("Failed to prepare statement '%s'", - this.delByLabelTemplate); - } - session.add(deleteStmt); - } - - @Override - public BackendEntry mergeEntries(BackendEntry e1, BackendEntry e2) { - // Merge edges into vertex - // TODO: merge rows before calling row2Entry() - - MysqlBackendEntry current = (MysqlBackendEntry) e1; - MysqlBackendEntry next = (MysqlBackendEntry) e2; - - E.checkState(current == null || current.type().isVertex(), - "The current entry must be null or VERTEX"); - E.checkState(next != null && next.type().isEdge(), - "The next entry must be EDGE"); - - long maxSize = BackendEntryIterator.INLINE_BATCH_SIZE; - if (current != null && current.subRows().size() < maxSize) { - Id nextVertexId = IdGenerator.of( - next.column(HugeKeys.OWNER_VERTEX)); - if (current.id().equals(nextVertexId)) { - current.subRow(next.row()); - return current; - } - } - - return this.wrapByVertex(next); - } - - private MysqlBackendEntry wrapByVertex(MysqlBackendEntry edge) { - assert edge.type().isEdge(); - String ownerVertex = edge.column(HugeKeys.OWNER_VERTEX); - E.checkState(ownerVertex != null, "Invalid backend entry"); - Id vertexId = IdGenerator.of(ownerVertex); - MysqlBackendEntry vertex = new MysqlBackendEntry(HugeType.VERTEX, - vertexId); - - vertex.column(HugeKeys.ID, ownerVertex); - vertex.column(HugeKeys.PROPERTIES, ""); - - vertex.subRow(edge.row()); - return vertex; - } - - public static String table(Directions direction) { - assert direction == Directions.OUT || direction == Directions.IN; - return direction.type().string() + TABLE_SUFFIX; - } - - public static MysqlTable out(String store) { - return new Edge(store, Directions.OUT); - } - - public static MysqlTable in(String store) { - return new Edge(store, Directions.IN); - } - } - - public abstract static class Index extends MysqlTableTemplate { - - public Index(String table) { - super(table); - } - - protected abstract String entryId(MysqlBackendEntry entry); - } - - public static class SecondaryIndex extends Index { - - public static final String TABLE = HugeType.SECONDARY_INDEX.string(); - - public SecondaryIndex(String store) { - this(store, TABLE, TYPES_MAPPING); - } - - public SecondaryIndex(String store, String table, - Map typesMapping) { - super(joinTableName(store, table)); - - this.define = new TableDefine(typesMapping); - this.define.column(HugeKeys.FIELD_VALUES, SMALL_TEXT); - this.define.column(HugeKeys.INDEX_LABEL_ID, DATATYPE_IL); - this.define.column(HugeKeys.ELEMENT_IDS, SMALL_TEXT); - this.define.column(HugeKeys.EXPIRED_TIME, BIGINT); - this.define.keys(HugeKeys.FIELD_VALUES, - HugeKeys.INDEX_LABEL_ID, - HugeKeys.ELEMENT_IDS); - } - - @Override - public final String entryId(MysqlBackendEntry entry) { - String fieldValues = entry.column(HugeKeys.FIELD_VALUES); - Integer labelId = entry.column(HugeKeys.INDEX_LABEL_ID); - return SplicingIdGenerator.concat(fieldValues, labelId.toString()); - } - } - - public static class SearchIndex extends SecondaryIndex { - - public static final String TABLE = HugeType.SEARCH_INDEX.string(); - - public SearchIndex(String store) { - super(store, TABLE, TYPES_MAPPING); - } - } - - /** - * TODO: set field value as key and set element id as value - */ - public static class UniqueIndex extends SecondaryIndex { - - public static final String TABLE = HugeType.UNIQUE_INDEX.string(); - - public UniqueIndex(String store) { - super(store, TABLE, TYPES_MAPPING); - } - } - - public static class RangeIndex extends Index { - - public RangeIndex(String store, String table) { - this(store, table, TYPES_MAPPING); - } - - public RangeIndex(String store, String table, - Map typesMapping) { - super(joinTableName(store, table)); - - this.define = new TableDefine(typesMapping); - this.define.column(HugeKeys.INDEX_LABEL_ID, DATATYPE_IL); - this.define.column(HugeKeys.FIELD_VALUES, NUMERIC); - this.define.column(HugeKeys.ELEMENT_IDS, SMALL_TEXT); - this.define.column(HugeKeys.EXPIRED_TIME, BIGINT); - this.define.keys(HugeKeys.INDEX_LABEL_ID, - HugeKeys.FIELD_VALUES, - HugeKeys.ELEMENT_IDS); - } - - @Override - public final String entryId(MysqlBackendEntry entry) { - Double fieldValue = entry.column(HugeKeys.FIELD_VALUES); - Integer labelId = entry.column(HugeKeys.INDEX_LABEL_ID); - return SplicingIdGenerator.concat(labelId.toString(), - fieldValue.toString()); - } - } - - public static class RangeIntIndex extends RangeIndex { - - public static final String TABLE = HugeType.RANGE_INT_INDEX.string(); - - public RangeIntIndex(String store) { - this(store, TABLE, TYPES_MAPPING); - } - - public RangeIntIndex(String store, String table, - Map typesMapping) { - super(store, table); - - this.define = new TableDefine(typesMapping); - this.define.column(HugeKeys.INDEX_LABEL_ID, DATATYPE_IL); - this.define.column(HugeKeys.FIELD_VALUES, INT); - this.define.column(HugeKeys.ELEMENT_IDS, SMALL_TEXT); - this.define.column(HugeKeys.EXPIRED_TIME, BIGINT); - this.define.keys(HugeKeys.INDEX_LABEL_ID, - HugeKeys.FIELD_VALUES, - HugeKeys.ELEMENT_IDS); - } - } - - public static class RangeFloatIndex extends RangeIndex { - - public static final String TABLE = HugeType.RANGE_FLOAT_INDEX.string(); - - public RangeFloatIndex(String store) { - this(store, TABLE, TYPES_MAPPING); - } - - public RangeFloatIndex(String store, String table, - Map typesMapping) { - super(store, table); - - this.define = new TableDefine(typesMapping); - this.define.column(HugeKeys.INDEX_LABEL_ID, DATATYPE_IL); - this.define.column(HugeKeys.FIELD_VALUES, NUMERIC); - this.define.column(HugeKeys.ELEMENT_IDS, SMALL_TEXT); - this.define.column(HugeKeys.EXPIRED_TIME, BIGINT); - this.define.keys(HugeKeys.INDEX_LABEL_ID, - HugeKeys.FIELD_VALUES, - HugeKeys.ELEMENT_IDS); - } - } - - public static class RangeLongIndex extends RangeIndex { - - public static final String TABLE = HugeType.RANGE_LONG_INDEX.string(); - - public RangeLongIndex(String store) { - this(store, TABLE, TYPES_MAPPING); - } - - public RangeLongIndex(String store, String table, - Map typesMapping) { - super(store, table); - - this.define = new TableDefine(typesMapping); - this.define.column(HugeKeys.INDEX_LABEL_ID, DATATYPE_IL); - this.define.column(HugeKeys.FIELD_VALUES, BIGINT); - this.define.column(HugeKeys.ELEMENT_IDS, SMALL_TEXT); - this.define.column(HugeKeys.EXPIRED_TIME, BIGINT); - this.define.keys(HugeKeys.INDEX_LABEL_ID, - HugeKeys.FIELD_VALUES, - HugeKeys.ELEMENT_IDS); - } - } - - public static class RangeDoubleIndex extends RangeIndex { - - public static final String TABLE = HugeType.RANGE_DOUBLE_INDEX.string(); - - public RangeDoubleIndex(String store) { - this(store, TABLE, TYPES_MAPPING); - } - - public RangeDoubleIndex(String store, String table, - Map typesMapping) { - super(store, table); - - this.define = new TableDefine(typesMapping); - this.define.column(HugeKeys.INDEX_LABEL_ID, DATATYPE_IL); - this.define.column(HugeKeys.FIELD_VALUES, NUMERIC); - this.define.column(HugeKeys.ELEMENT_IDS, SMALL_TEXT); - this.define.column(HugeKeys.EXPIRED_TIME, BIGINT); - this.define.keys(HugeKeys.INDEX_LABEL_ID, - HugeKeys.FIELD_VALUES, - HugeKeys.ELEMENT_IDS); - } - } - - public static class ShardIndex extends Index { - - public static final String TABLE = HugeType.SHARD_INDEX.string(); - - public ShardIndex(String store) { - this(store, TYPES_MAPPING); - } - - public ShardIndex(String store, Map typesMapping) { - super(joinTableName(store, TABLE)); - - this.define = new TableDefine(typesMapping); - this.define.column(HugeKeys.INDEX_LABEL_ID, DATATYPE_IL); - this.define.column(HugeKeys.FIELD_VALUES, SMALL_TEXT); - this.define.column(HugeKeys.ELEMENT_IDS, SMALL_TEXT); - this.define.column(HugeKeys.EXPIRED_TIME, BIGINT); - this.define.keys(HugeKeys.INDEX_LABEL_ID, - HugeKeys.FIELD_VALUES, - HugeKeys.ELEMENT_IDS); - } - - @Override - public final String entryId(MysqlBackendEntry entry) { - Double fieldValue = entry.column(HugeKeys.FIELD_VALUES); - Integer labelId = entry.column(HugeKeys.INDEX_LABEL_ID); - return SplicingIdGenerator.concat(labelId.toString(), - fieldValue.toString()); - } - } -} diff --git a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlUtil.java b/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlUtil.java deleted file mode 100644 index 4a53b7b752..0000000000 --- a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlUtil.java +++ /dev/null @@ -1,129 +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.hugegraph.backend.store.mysql; - -public class MysqlUtil { - - public static String escapeAndWrapString(String value) { - return escapeString(value, true); - } - - public static String escapeString(String value) { - return escapeString(value, false); - } - - private static String escapeString(String value, boolean wrap) { - int length = value.length(); - if (!isEscapeNeededForString(value, length)) { - if (!wrap) { - return value; - } - StringBuilder buf = new StringBuilder(length + 2); - buf.append('\'').append(value).append('\''); - return buf.toString(); - } - - StringBuilder buffer = new StringBuilder((int) (length * 1.1d)); - - if (wrap) { - buffer.append('\''); - } - - for (int i = 0; i < length; ++i) { - char c = value.charAt(i); - switch (c) { - case '\u0000': - buffer.append('\\'); - buffer.append('0'); - break; - case '\n': - buffer.append('\\'); - buffer.append('n'); - break; - case '\r': - buffer.append('\\'); - buffer.append('r'); - break; - case '\u001a': - buffer.append('\\'); - buffer.append('Z'); - break; - case '"': - /* - * Doesn't need to add '\', because we wrap string with "'" - * Assume that we don't use Ansi Mode - */ - buffer.append('"'); - break; - case '\'': - buffer.append('\\'); - buffer.append('\''); - break; - case '\\': - buffer.append('\\'); - buffer.append('\\'); - break; - default: - buffer.append(c); - break; - } - } - - if (wrap) { - buffer.append('\''); - } - - return buffer.toString(); - } - - public static boolean isEscapeNeededForString(String sql, int length) { - boolean needsEscape = false; - - for (int i = 0; i < length; ++i) { - char c = sql.charAt(i); - switch (c) { - case '\u0000': - needsEscape = true; - break; - case '\n': - needsEscape = true; - break; - case '\r': - needsEscape = true; - break; - case '\u001a': - needsEscape = true; - break; - case '\'': - needsEscape = true; - break; - case '\\': - needsEscape = true; - break; - default: - break; - } - - if (needsEscape) { - break; - } - } - - return needsEscape; - } -} diff --git a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/ResultSetWrapper.java b/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/ResultSetWrapper.java deleted file mode 100644 index f41a4c72e3..0000000000 --- a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/ResultSetWrapper.java +++ /dev/null @@ -1,62 +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.hugegraph.backend.store.mysql; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; - -import org.apache.hugegraph.backend.BackendException; - -public class ResultSetWrapper implements AutoCloseable { - - private final ResultSet resultSet; - private final Statement statement; - - public ResultSetWrapper(ResultSet resultSet, Statement statement) { - this.resultSet = resultSet; - this.statement = statement; - } - - public boolean next() throws SQLException { - return !this.resultSet.isClosed() && this.resultSet.next(); - } - - @Override - public void close() { - try { - if (this.resultSet != null) { - this.resultSet.close(); - } - } catch (SQLException e) { - throw new BackendException("Failed to close ResultSet", e); - } finally { - try { - if (this.statement != null) { - this.statement.close(); - } - } catch (SQLException e) { - throw new BackendException("Failed to close Statement", e); - } - } - } - - public ResultSet resultSet() { - return resultSet; - } -} diff --git a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/WhereBuilder.java b/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/WhereBuilder.java deleted file mode 100644 index 5eb0fb44a3..0000000000 --- a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/WhereBuilder.java +++ /dev/null @@ -1,295 +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.hugegraph.backend.store.mysql; - -import java.util.List; - -import org.apache.hugegraph.backend.query.Condition.RelationType; -import org.apache.hugegraph.exception.NotSupportException; -import org.apache.hugegraph.util.E; - -public class WhereBuilder { - - private StringBuilder builder; - - public WhereBuilder() { - this(true); - } - - public WhereBuilder(boolean startWithWhere) { - if (startWithWhere) { - this.builder = new StringBuilder(" WHERE "); - } else { - this.builder = new StringBuilder(" "); - } - } - - public WhereBuilder relation(String key, RelationType type, Object value) { - String operator = null; - switch (type) { - case EQ: - operator = "="; - break; - case NEQ: - operator = "!="; - break; - case GT: - operator = ">"; - break; - case GTE: - operator = ">="; - break; - case LT: - operator = "<"; - break; - case LTE: - operator = "<="; - break; - case IN: - @SuppressWarnings("unchecked") - List values = (List) value; - this.in(key, values); - break; - case CONTAINS_VALUE: - case CONTAINS_KEY: - case SCAN: - default: - throw new NotSupportException("relation '%s'", type); - } - if (operator != null) { - this.builder.append(key); - this.builder.append(operator); - this.builder.append(wrapStringIfNeeded(value)); - } - return this; - } - - /** - * Concat as: cond1 and cond2... - * - * @return WhereBuilder - */ - public WhereBuilder and() { - this.builder.append(" AND "); - return this; - } - - /** - * Concat as: key1 op ? and key2 op ?... - * - * @param keys the keys to be concatted with value - * @param operator the operator to link every key and value pair - * @return WhereBuilder - */ - public WhereBuilder and(List keys, String operator) { - for (int i = 0, n = keys.size(); i < n; i++) { - this.builder.append(keys.get(i)); - this.builder.append(operator); - this.builder.append("?"); - if (i != n - 1) { - this.builder.append(" AND "); - } - } - return this; - } - - /** - * Concat as: key1 = value1 and key2 = value2... - * - * @param keys the keys to be concatted with values according to the - * same index - * @param values the values to be concatted with every keys according to - * the same index - * @return WhereBuilder - */ - public WhereBuilder and(List keys, List values) { - return this.and(keys, "=", values); - } - - /** - * Concat as: key1 op value1 and key2 op value2... - * - * @param keys the keys to be concatted with values according to the - * same index - * @param operator the operator to link every key and value pair - * @param values the values to be concatted with every keys according to - * the same index - * @return WhereBuilder - */ - public WhereBuilder and(List keys, - String operator, - List values) { - E.checkArgument(keys.size() == values.size(), - "The size of keys '%s' is not equal with " + - "values size '%s'", - keys.size(), values.size()); - - for (int i = 0, n = keys.size(); i < n; i++) { - this.builder.append(keys.get(i)); - this.builder.append(operator); - this.builder.append(wrapStringIfNeeded(values.get(i))); - if (i != n - 1) { - this.builder.append(" AND "); - } - } - return this; - } - - /** - * Concat as: key1 op1 value1 and key2 op2 value2... - * - * @param keys the keys to be concatted with values according to the - * same index - * @param operators the operators to link every key and value pair - * according to the same index - * @param values the values to be concatted with every keys according to - * the same index - * @return WhereBuilder - */ - public WhereBuilder and(List keys, - List operators, - List values) { - E.checkArgument(keys.size() == operators.size(), - "The size of keys '%s' is not equal with " + - "operators size '%s'", - keys.size(), operators.size()); - E.checkArgument(keys.size() == values.size(), - "The size of keys '%s' is not equal with " + - "values size '%s'", - keys.size(), values.size()); - - for (int i = 0, n = keys.size(); i < n; i++) { - this.builder.append(keys.get(i)); - this.builder.append(operators.get(i)); - this.builder.append(wrapStringIfNeeded(values.get(i))); - if (i != n - 1) { - this.builder.append(" AND "); - } - } - return this; - } - - /** - * Concat as: clause1 and clause2... - * - * @param clauses the clauses to be concatted with 'AND' operator - * @return WhereBuilder - */ - public WhereBuilder and(List clauses) { - E.checkArgument(clauses != null && !clauses.isEmpty(), - "The clauses can't be empty"); - - int size = clauses.size(); - int i = 0; - for (StringBuilder clause : clauses) { - this.builder.append(clause); - if (++i != size) { - this.builder.append(" AND "); - } - } - return this; - } - - /** - * Concat as: key in (value1, value2...) - * - * @param key the key to be concatted with 'IN' operator - * @param values the values to be concated with ',' and wrapped by '()' - * @return WhereBuilder - */ - public WhereBuilder in(String key, List values) { - this.builder.append(key).append(" IN ("); - for (int i = 0, n = values.size(); i < n; i++) { - this.builder.append(wrapStringIfNeeded(values.get(i))); - if (i != n - 1) { - this.builder.append(", "); - } - } - this.builder.append(")"); - return this; - } - - /** - * Concat as: (key1, key2...keyn) {@code >=} (val1, val2...valn) - * - * @param keys the keys to be concatted with {@code >=} operator - * @param values the values to be concatted with {@code >=} operator - * @return WhereBuilder - */ - public WhereBuilder gte(List keys, List values) { - E.checkArgument(keys.size() == values.size(), - "The size of keys '%s' is not equal with " + - "values size '%s'", - keys.size(), values.size()); - this.builder.append("("); - for (int i = 0, n = keys.size(); i < n; i++) { - this.builder.append(keys.get(i)); - if (i != n - 1) { - this.builder.append(", "); - } - } - this.builder.append(") >= ("); - for (int i = 0, n = values.size(); i < n; i++) { - this.builder.append(wrapStringIfNeeded(values.get(i))); - if (i != n - 1) { - this.builder.append(", "); - } - } - this.builder.append(")"); - return this; - } - - public WhereBuilder gte(String key, Object value) { - this.builder.append(" ") - .append(key) - .append(" >= ") - .append(wrapStringIfNeeded(value)) - .append(" "); - return this; - } - - public WhereBuilder lt(String key, Object value) { - this.builder.append(" ") - .append(key) - .append(" < ") - .append(wrapStringIfNeeded(value)) - .append(" "); - return this; - } - - public StringBuilder build() { - return this.builder; - } - - @Override - public String toString() { - return this.builder.toString(); - } - - protected String wrapStringIfNeeded(Object value) { - if (value instanceof String) { - return this.escapeAndWrapString((String) value); - } else { - return String.valueOf(value); - } - } - - protected String escapeAndWrapString(String value) { - return MysqlUtil.escapeAndWrapString(value); - } -} diff --git a/hugegraph-server/hugegraph-palo/pom.xml b/hugegraph-server/hugegraph-palo/pom.xml deleted file mode 100644 index 5b81e829da..0000000000 --- a/hugegraph-server/hugegraph-palo/pom.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - - - hugegraph-server - org.apache.hugegraph - ${revision} - ../pom.xml - - 4.0.0 - - hugegraph-palo - - - - org.apache.hugegraph - hugegraph-core - ${revision} - - - org.apache.hugegraph - hugegraph-mysql - ${revision} - - - - org.glassfish.jersey.core - jersey-client - ${jersey.version} - - - - diff --git a/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloFeatures.java b/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloFeatures.java deleted file mode 100644 index ee3d2ed20f..0000000000 --- a/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloFeatures.java +++ /dev/null @@ -1,134 +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.hugegraph.backend.store.palo; - -import org.apache.hugegraph.backend.store.BackendFeatures; - -public class PaloFeatures implements BackendFeatures { - - @Override - public boolean supportsScanToken() { - return false; - } - - @Override - public boolean supportsScanKeyPrefix() { - return false; - } - - @Override - public boolean supportsScanKeyRange() { - return false; - } - - @Override - public boolean supportsQuerySchemaByName() { - return true; - } - - @Override - public boolean supportsQueryByLabel() { - /* - * Create a rollup table on vertices/edges can speed up query by label, - * but it will store data in vertices/edges again. - * See: https://github.com/baidu/palo/wiki/Data-Model%2C-Rollup-%26 - * -Prefix-Index - */ - return false; - } - - @Override - public boolean supportsQueryWithInCondition() { - return false; - } - - @Override - public boolean supportsQueryWithRangeCondition() { - return true; - } - - @Override - public boolean supportsQuerySortByInputIds() { - return false; - } - - @Override - public boolean supportsQueryWithContains() { - return false; - } - - @Override - public boolean supportsQueryWithContainsKey() { - return false; - } - - @Override - public boolean supportsQueryWithOrderBy() { - return true; - } - - @Override - public boolean supportsQueryByPage() { - return true; - } - - @Override - public boolean supportsDeleteEdgeByLabel() { - return true; - } - - @Override - public boolean supportsUpdateVertexProperty() { - return false; - } - - @Override - public boolean supportsMergeVertexProperty() { - return false; - } - - @Override - public boolean supportsUpdateEdgeProperty() { - return false; - } - - @Override - public boolean supportsTransaction() { - return false; - } - - @Override - public boolean supportsNumberType() { - return true; - } - - @Override - public boolean supportsAggregateProperty() { - return false; - } - - @Override - public boolean supportsTtl() { - return false; - } - - @Override - public boolean supportsOlapProperties() { - return false; - } -} diff --git a/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloFile.java b/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloFile.java deleted file mode 100644 index d9aed31c01..0000000000 --- a/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloFile.java +++ /dev/null @@ -1,192 +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.hugegraph.backend.store.palo; - -import java.io.File; -import java.io.IOException; -import java.nio.file.Paths; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.apache.commons.io.FileUtils; -import org.apache.hugegraph.backend.BackendException; -import org.apache.hugegraph.config.HugeConfig; -import org.apache.hugegraph.util.E; - -import com.google.common.base.Charsets; -import com.google.common.collect.ImmutableList; - -public class PaloFile extends File { - - private static final long serialVersionUID = -1918775445693598353L; - - public PaloFile(String dir, String subDir, String fileName) { - this(Paths.get(dir, subDir, fileName).toString()); - } - - public PaloFile(String path, int id, int part) { - this(Paths.get(path, formatFileName(id, part)).toString()); - } - - public PaloFile(String path) { - super(path); - } - - public String table() { - return this.getParentFile().getName(); - } - - public int sessionId() { - String[] parts = this.getName().split("-"); - E.checkState(parts.length == 2, - "Invalid file name format '%s' for palo temp file, " + - "the legal format is session{m}-part{n}", this.getName()); - return Integer.parseInt(parts[0].substring("session".length())); - } - - public int sessionPart() { - String[] parts = this.getName().split("-"); - E.checkState(parts.length == 2, - "Invalid file name format '%s' for palo temp file, " + - "the legal format is session{m}-part{n}", this.getName()); - return Integer.parseInt(parts[1].substring("part".length())); - } - - public int writeLines(Collection lines) { - try { - FileUtils.writeLines(this, Charsets.UTF_8.name(), lines, true); - } catch (IOException e) { - throw new BackendException(e); - } - return lines.size(); - } - - public String readAsString() { - try { - return FileUtils.readFileToString(this); - } catch (IOException e) { - throw new BackendException(e); - } - } - - public void forceDelete() { - if (this.exists()) { - try { - FileUtils.forceDelete(this); - } catch (IOException e) { - throw new BackendException(e); - } - } - } - - public static void clearDir(String tempDir) { - File file = FileUtils.getFile(tempDir); - if (!file.exists()) { - return; - } - try { - FileUtils.forceDelete(file); - } catch (IOException e) { - throw new BackendException(e); - } - } - - public static List scan(String path, List tableDirs) { - File directory = FileUtils.getFile(path); - if (!directory.exists()) { - return ImmutableList.of(); - } - - File[] subDirs = directory.listFiles((dir, name) -> { - return tableDirs.contains(name); - }); - if (subDirs == null || subDirs.length == 0) { - return ImmutableList.of(); - } - - List paloFiles = new ArrayList<>(subDirs.length); - for (File subDir : subDirs) { - String[] fileNames = subDir.list(); - if (fileNames == null) { - continue; - } - for (String fileName : fileNames) { - paloFiles.add(new PaloFile(path, subDir.getName(), fileName)); - } - } - - /* - * Sort palo file by updated time in asc order, - * let old files to be processed in priority - */ - paloFiles.sort((file1, file2) -> { - return (int) (file1.lastModified() - file2.lastModified()); - }); - return paloFiles; - } - - private static String formatFileName(int id, int part) { - return String.format("session%s-part%s", id, part); - } - - private static int[] parseFileName(String fileName) { - String[] nameParts = fileName.split("-"); - E.checkArgument(nameParts.length == 2, - "Invalid file name format '%s' for palo temp file, " + - "the legal format is session{m}-part{n}", fileName); - int[] rs = new int[2]; - rs[0] = Integer.parseInt(nameParts[0].substring("session".length())); - rs[1] = Integer.parseInt(nameParts[1].substring("part".length())); - return rs; - } - - public static long limitSize(HugeConfig config) { - long limitSize = config.get(PaloOptions.PALO_FILE_LIMIT_SIZE); - return limitSize * 1024 * 1024; - } - - public static Set scanSessionIds(HugeConfig config, - List tableDirs) { - Set sessionIds = new HashSet<>(); - - String path = config.get(PaloOptions.PALO_TEMP_DIR); - File pathDir = Paths.get(path).toFile(); - if (!pathDir.exists()) { - return sessionIds; - } - for (String table : tableDirs) { - File tableDir = Paths.get(path, table).toFile(); - if (!tableDir.exists()) { - continue; - } - String[] fileNames = tableDir.list(); - if (fileNames == null || fileNames.length == 0) { - continue; - } - for (String fileName : fileNames) { - int[] parts = PaloFile.parseFileName(fileName); - int sessionId = parts[0]; - sessionIds.add(sessionId); - } - } - return sessionIds; - } -} 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 deleted file mode 100644 index c59b7d89b9..0000000000 --- a/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloHttpClient.java +++ /dev/null @@ -1,75 +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.hugegraph.backend.store.palo; - -import java.util.Map; - -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; - - public PaloHttpClient(HugeConfig config, String database) { - String url = this.buildUrl(config, database); - String username = config.get(PaloOptions.PALO_USERNAME); - String password = config.get(PaloOptions.PALO_PASSWORD); - Integer timeout = config.get(PaloOptions.PALO_HTTP_TIMEOUT); - - this.client = new Client(url, username, password, timeout); - } - - private String buildUrl(HugeConfig config, String database) { - String host = config.get(PaloOptions.PALO_HOST); - Integer port = config.get(PaloOptions.PALO_HTTP_PORT); - return String.format("http://%s:%s/api/%s/", host, port, database); - } - - public void bulkLoadAsync(String table, String body, String label) { - // Format path - String path = table + "/_load"; - // Format headers - RestHeaders headers = new RestHeaders(); - headers.add("Expect", "100-continue"); - // Format params - Map params = ImmutableMap.of("label", label); - // Send request - this.client.put(path, body, headers, params); - } - - private static class Client extends AbstractRestClient { - - private static final int SECOND = 1000; - - public Client(String url, String user, String password, int timeout) { - super(url, user, password, timeout * SECOND); - } - - @Override - protected void checkStatus(Response response, int... statuses) { - // pass - } - } -} diff --git a/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloLoadInfo.java b/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloLoadInfo.java deleted file mode 100644 index 91be869910..0000000000 --- a/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloLoadInfo.java +++ /dev/null @@ -1,190 +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.hugegraph.backend.store.palo; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.Date; - -public class PaloLoadInfo { - - private long jobId; - private String label; - private State state; - private String progress; - private String etlInfo; - private String taskInfo; - private String errorMsg; - private Date createTime; - private Date etlStartTime; - private Date etlFinishTime; - private Date loadStartTime; - private Date loadFinishTime; - private String url; - - public PaloLoadInfo(ResultSet result) throws SQLException { - this.jobId = result.getLong("JobId"); - this.label = result.getString("Label"); - this.state = PaloLoadInfo.State.valueOf(result.getString("State")); - this.progress = result.getString("Progress"); - this.etlInfo = result.getString("EtlInfo"); - this.taskInfo = result.getString("TaskInfo"); - this.errorMsg = result.getString("ErrorMsg"); - this.createTime = result.getDate("CreateTime"); - this.etlStartTime = result.getDate("EtlStartTime"); - this.etlFinishTime = result.getDate("EtlFinishTime"); - this.loadStartTime = result.getDate("LoadStartTime"); - this.loadFinishTime = result.getDate("LoadFinishTime"); - this.url = result.getString("URL"); - } - - public long getJobId() { - return this.jobId; - } - - public void setJobId(long jobId) { - this.jobId = jobId; - } - - public String getLabel() { - return this.label; - } - - public void setLabel(String label) { - this.label = label; - } - - public State getState() { - return this.state; - } - - public void setState(State state) { - this.state = state; - } - - public void setState(String state) { - this.state = PaloLoadInfo.State.valueOf(state); - } - - public String getProgress() { - return this.progress; - } - - public void setProgress(String progress) { - this.progress = progress; - } - - public String getEtlInfo() { - return this.etlInfo; - } - - public void setEtlInfo(String etlInfo) { - this.etlInfo = etlInfo; - } - - public String getTaskInfo() { - return this.taskInfo; - } - - public void setTaskInfo(String taskInfo) { - this.taskInfo = taskInfo; - } - - public String getErrorMsg() { - return this.errorMsg; - } - - public void setErrorMsg(String errorMsg) { - this.errorMsg = errorMsg; - } - - public Date getCreateTime() { - return this.createTime; - } - - public void setCreateTime(Date createTime) { - this.createTime = createTime; - } - - public Date getEtlStartTime() { - return this.etlStartTime; - } - - public void setEtlStartTime(Date etlStartTime) { - this.etlStartTime = etlStartTime; - } - - public Date getEtlFinishTime() { - return this.etlFinishTime; - } - - public void setEtlFinishTime(Date etlFinishTime) { - this.etlFinishTime = etlFinishTime; - } - - public Date getLoadStartTime() { - return this.loadStartTime; - } - - public void setLoadStartTime(Date loadStartTime) { - this.loadStartTime = loadStartTime; - } - - public Date getLoadFinishTime() { - return this.loadFinishTime; - } - - public void setLoadFinishTime(Date loadFinishTime) { - this.loadFinishTime = loadFinishTime; - } - - public String getUrl() { - return this.url; - } - - public void setUrl(String url) { - this.url = url; - } - - public enum State { - - UNKNOWN(0, "UNKNOWN"), - PENDING(1, "PENDING"), - ETL(2, "ETL"), - LOADING(3, "LOADING"), - FINISHED(4, "FINISHED"), - CANCELLED(5, "CANCELLED"); - - private byte code; - private String name; - - private State(int code, String name) { - assert code >= 0 && code < 256; - this.code = (byte) code; - this.name = name; - } - - public byte code() { - return this.code; - } - - public String string() { - return this.name; - } - } -} diff --git a/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloOptions.java b/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloOptions.java deleted file mode 100644 index f8faf75027..0000000000 --- a/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloOptions.java +++ /dev/null @@ -1,108 +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.hugegraph.backend.store.palo; - -import static org.apache.hugegraph.config.OptionChecker.disallowEmpty; -import static org.apache.hugegraph.config.OptionChecker.nonNegativeInt; -import static org.apache.hugegraph.config.OptionChecker.positiveInt; -import static org.apache.hugegraph.config.OptionChecker.rangeInt; - -import org.apache.hugegraph.config.ConfigOption; -import org.apache.hugegraph.config.OptionHolder; - -public class PaloOptions extends OptionHolder { - - private PaloOptions() { - super(); - } - - private static volatile PaloOptions instance; - - public static synchronized PaloOptions instance() { - if (instance == null) { - instance = new PaloOptions(); - instance.registerOptions(); - } - return instance; - } - - public static final ConfigOption PALO_HOST = - new ConfigOption<>( - "palo.host", - "The host/ip of Palo cluster.", - disallowEmpty(), - "127.0.0.1" - ); - - public static final ConfigOption PALO_HTTP_PORT = - new ConfigOption<>( - "palo.http_port", - "The http port of Palo cluster.", - positiveInt(), - 8030 - ); - - public static final ConfigOption PALO_HTTP_TIMEOUT = - new ConfigOption<>( - "palo.http_timeout", - "Timeout(second) for connecting and reading Palo.", - nonNegativeInt(), - 20 - ); - - public static final ConfigOption PALO_USERNAME = - new ConfigOption<>( - "palo.username", - "The username to login Palo.", - disallowEmpty(), - "root" - ); - - public static final ConfigOption PALO_PASSWORD = - new ConfigOption<>( - "palo.password", - "The password corresponding to palo.username.", - null, - "" - ); - - public static final ConfigOption PALO_POLL_INTERVAL = - new ConfigOption<>( - "palo.poll_interval", - "The execution period of the background thread that " + - "check whether need to load file data into Palo.", - rangeInt(5, Integer.MAX_VALUE), - 5 - ); - - public static final ConfigOption PALO_TEMP_DIR = - new ConfigOption<>( - "palo.temp_dir", - "The temporary directory to store table files.", - null, - "palo-data" - ); - - public static final ConfigOption PALO_FILE_LIMIT_SIZE = - new ConfigOption<>( - "palo.file_limit_size", - "The maximum size(MB) of each file for loading into Palo.", - rangeInt(10, 1000), - 50 - ); -} diff --git a/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloSerializer.java b/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloSerializer.java deleted file mode 100644 index 3ab941bbd3..0000000000 --- a/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloSerializer.java +++ /dev/null @@ -1,45 +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.hugegraph.backend.store.palo; - -import org.apache.hugegraph.backend.serializer.TableBackendEntry; -import org.apache.hugegraph.backend.store.mysql.MysqlSerializer; -import org.apache.hugegraph.config.HugeConfig; -import org.apache.hugegraph.schema.SchemaLabel; -import org.apache.hugegraph.type.define.HugeKeys; - -public class PaloSerializer extends MysqlSerializer { - - public PaloSerializer(HugeConfig config) { - super(config); - } - - @Override - protected void writeEnableLabelIndex(SchemaLabel schema, - TableBackendEntry entry) { - Byte enable = (byte) (schema.enableLabelIndex() ? 1 : 0); - entry.column(HugeKeys.ENABLE_LABEL_INDEX, enable); - } - - @Override - protected void readEnableLabelIndex(SchemaLabel schema, - TableBackendEntry entry) { - Number enable = entry.column(HugeKeys.ENABLE_LABEL_INDEX); - schema.enableLabelIndex(enable.byteValue() != 0); - } -} diff --git a/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloSessions.java b/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloSessions.java deleted file mode 100644 index 735645eab8..0000000000 --- a/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloSessions.java +++ /dev/null @@ -1,317 +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.hugegraph.backend.store.palo; - -import java.nio.file.Paths; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.Timer; -import java.util.TimerTask; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.concurrent.locks.Lock; -import java.util.concurrent.locks.ReadWriteLock; -import java.util.concurrent.locks.ReentrantReadWriteLock; - -import org.apache.hugegraph.backend.BackendException; -import org.apache.hugegraph.backend.store.mysql.MysqlSessions; -import org.apache.hugegraph.backend.store.mysql.ResultSetWrapper; -import org.apache.hugegraph.config.HugeConfig; -import org.apache.hugegraph.date.SafeDateFormat; -import org.apache.hugegraph.util.Log; -import org.slf4j.Logger; - -import com.google.common.collect.LinkedListMultimap; -import com.google.common.collect.Multimap; - -public class PaloSessions extends MysqlSessions { - - private static final Logger LOG = Log.logger(PaloSessions.class); - - private final AtomicInteger counter; - private final Map locks; - - private final Timer timer; - private final PaloLoadTask loadTask; - - public PaloSessions(HugeConfig config, String database, String store, - List tableDirs) { - super(config, database, store); - this.counter = new AtomicInteger(); - this.locks = new ConcurrentHashMap<>(); - // Scan disk files and restore session information - this.restoreSessionInfo(config, tableDirs); - - this.timer = new Timer(true); - long interval = config.get(PaloOptions.PALO_POLL_INTERVAL); - this.loadTask = new PaloLoadTask(tableDirs); - this.timer.schedule(this.loadTask, 0, interval * 1000); - } - - private void restoreSessionInfo(HugeConfig config, List tableDirs) { - Set sessionIds = PaloFile.scanSessionIds(config, tableDirs); - for (Integer sessionId : sessionIds) { - if (!this.locks.containsKey(sessionId)) { - // Create a read write lock for every session - this.locks.put(sessionId, new ReentrantReadWriteLock()); - } - } - // Update counter value to avoid new session has duplicate id with old - int maxSessionId = 0; - for (int sessionId : sessionIds) { - if (sessionId > maxSessionId) { - maxSessionId = sessionId; - } - } - this.counter.addAndGet(maxSessionId); - } - - @Override - protected String buildCreateDatabase(String database) { - return String.format("CREATE DATABASE IF NOT EXISTS %s;", database); - } - - @Override - public final Session session() { - return (Session) super.getOrNewSession(); - } - - @Override - protected final Session newSession() { - int id = this.counter.incrementAndGet(); - this.locks.put(id, new ReentrantReadWriteLock()); - return new Session(id); - } - - @Override - public boolean close() { - this.loadTask.join(); - this.timer.cancel(); - super.close(); - return true; - } - - public final class Session extends MysqlSessions.Session { - - private final int id; - /** - * Stores the number of the file for each table that has been recorded - * table1 -> session-part{n} - */ - private final Map parts; - /** - * Store data rows for each table - * table -> [row-1, row-2, ...row-n] - */ - private final Multimap batch; - - public Session(int id) { - super(); - this.id = id; - this.parts = new HashMap<>(); - this.batch = LinkedListMultimap.create(); - } - - public void add(String table, String row) { - this.batch.put(table, row); - this.parts.putIfAbsent(table, 0); - } - - @Override - public Integer commit() { - int updated = 0; - if (!this.batch.isEmpty()) { - updated += this.writeBatch(); - } - updated += super.commit(); - this.clear(); - return updated; - } - - @Override - public void rollback() { - super.rollback(); - this.clear(); - } - - @Override - public void clear() { - super.clear(); - this.batch.clear(); - } - - private int writeBatch() { - int updated = 0; - PaloSessions.this.locks.get(this.id).writeLock().lock(); - try { - for (String table : this.batch.keySet()) { - PaloFile file = this.getOrCreate(table); - updated += file.writeLines(this.batch.get(table)); - } - } finally { - PaloSessions.this.locks.get(this.id).writeLock().unlock(); - } - return updated; - } - - private PaloFile getOrCreate(String table) { - String tempDir = config().get(PaloOptions.PALO_TEMP_DIR); - long limitSize = PaloFile.limitSize(config()); - - // The table data path: 'palo-data/property_keys' - String path = Paths.get(tempDir, table).toString(); - int part = this.parts.get(table); - // The full file name: 'palo-data/property_keys/session1-part0' - PaloFile file = new PaloFile(path, this.id, part); - // Increase part number when file size exceed limit size - if (file.length() >= limitSize) { - this.parts.put(table, ++part); - file = new PaloFile(path, this.id, part); - } - return file; - } - - @SuppressWarnings("unused") - private PaloLoadInfo getLoadInfoByLabel(String label) { - String sql = String.format("SHOW LOAD WHERE LABEL = '%s'", label); - try (ResultSetWrapper results = this.select(sql)) { - ResultSet rs = results.resultSet(); - if (rs.next()) { - return new PaloLoadInfo(rs); - } - throw new BackendException("Non-exist load label '%s'", label); - } catch (SQLException e) { - throw new BackendException("Failed to fetch load info " + - "for label '%s'", e, label); - } - } - } - - public final class PaloLoadTask extends TimerTask { - - private static final String DF = "yyyy-MM-dd-HH-mm-ss"; - private final SafeDateFormat dateFormat = new SafeDateFormat(DF); - - /** - * There exist two running palo load task corresponds to two stores, - * `SchemaStore -> SchemaLoadTask` and `GraphStore -> GraphLoadTask`, - * the load task just handle with it's own subdirectory files, - * like: `property_keys, vertex_labels ...` for SchemaLoadTask, - * and: `vertices, edges ...` for GraphLoadTask - * these subdirectory called validSubDirs. - */ - private final List tableDirs; - /** - * session1-part1.txt session2-part1.txt ... - * vertices 128m 125m ... - * edges 256m 250m ... - * ... ... ... ... - */ - private List lastPaloFiles; - private final PaloHttpClient client; - - public PaloLoadTask(List tableDirs) { - this.tableDirs = tableDirs; - this.lastPaloFiles = null; - this.client = new PaloHttpClient(config(), database()); - } - - /** - * TODO: Need to be optimized - */ - public void join() { - Integer interval = config().get(PaloOptions.PALO_POLL_INTERVAL); - while (this.lastPaloFiles != null && - !this.lastPaloFiles.isEmpty()) { - try { - TimeUnit.SECONDS.sleep(interval); - } catch (InterruptedException e) { - throw new BackendException(e); - } - } - } - - @Override - public void run() { - LOG.debug("The Load task:{} ready to run", PaloSessions.this); - // Scan the directory to get all file size - String path = config().get(PaloOptions.PALO_TEMP_DIR); - List paloFiles = PaloFile.scan(path, this.tableDirs); - // Do nothing if there is no file at present - if (paloFiles.isEmpty()) { - return; - } - // Try to load one batch if last time and this time have some files - if (this.lastPaloFiles != null) { - this.tryLoadBatch(paloFiles); - } - // Update the last palo files - this.lastPaloFiles = paloFiles; - } - - private void tryLoadBatch(List files) { - PaloFile file = this.peekFile(files); - // Load the first file when stopped inserting data - this.loadThenDelete(file); - files.remove(file); - } - - private PaloFile peekFile(List files) { - assert !files.isEmpty(); - long limitSize = PaloFile.limitSize(config()); - // Load the file which exceed limit size in priority - for (PaloFile file : files) { - long fileSize = file.length(); - if (fileSize >= limitSize) { - return file; - } - } - // Load the oldest file(files are sorted by updated time) - return files.get(0); - } - - private void loadThenDelete(PaloFile file) { - // Parse session id from file name - int sessionId = file.sessionId(); - LOG.info("Ready to load one batch from file: {}", file); - // Get write lock because will delete file - Lock lock = PaloSessions.this.locks.get(sessionId).writeLock(); - lock.lock(); - try { - String table = file.table(); - String data = file.readAsString(); - String label = this.formatLabel(table); - this.client.bulkLoadAsync(table, data, label); - // Force delete file - file.forceDelete(); - } finally { - lock.unlock(); - } - } - - private String formatLabel(String table) { - return table + "-" + this.dateFormat.format(new Date()); - } - } -} diff --git a/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloStore.java b/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloStore.java deleted file mode 100644 index 344800868b..0000000000 --- a/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloStore.java +++ /dev/null @@ -1,50 +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.hugegraph.backend.store.palo; - -import java.util.List; -import java.util.stream.Collectors; - -import org.apache.hugegraph.backend.store.BackendStoreProvider; -import org.apache.hugegraph.backend.store.BackendTable; -import org.apache.hugegraph.backend.store.mysql.MysqlStore; -import org.apache.hugegraph.config.HugeConfig; -import org.apache.hugegraph.util.Log; -import org.slf4j.Logger; - -public abstract class PaloStore extends MysqlStore { - - private static final Logger LOG = Log.logger(PaloStore.class); - - public PaloStore(BackendStoreProvider provider, - String database, String name) { - super(provider, database, name); - } - - @Override - protected PaloSessions openSessionPool(HugeConfig config) { - LOG.info("Open palo session pool for {}", this); - return new PaloSessions(config, this.database(), this.store(), - this.tableNames()); - } - - private List tableNames() { - return this.tables().stream().map(BackendTable::table) - .collect(Collectors.toList()); - } -} diff --git a/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloStoreProvider.java b/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloStoreProvider.java deleted file mode 100644 index bde8d264ed..0000000000 --- a/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloStoreProvider.java +++ /dev/null @@ -1,175 +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.hugegraph.backend.store.palo; - -import org.apache.hugegraph.backend.LocalCounter; -import org.apache.hugegraph.backend.id.Id; -import org.apache.hugegraph.backend.store.BackendFeatures; -import org.apache.hugegraph.backend.store.BackendStore; -import org.apache.hugegraph.backend.store.BackendStoreProvider; -import org.apache.hugegraph.backend.store.mysql.MysqlStoreProvider; -import org.apache.hugegraph.config.HugeConfig; -import org.apache.hugegraph.type.HugeType; -import org.apache.hugegraph.type.define.Directions; - -public class PaloStoreProvider extends MysqlStoreProvider { - - private static final BackendFeatures FEATURES = new PaloFeatures(); - - @Override - protected BackendStore newSchemaStore(HugeConfig config, String store) { - return new PaloSchemaStore(this, this.database(), store); - } - - @Override - protected BackendStore newGraphStore(HugeConfig config, String store) { - return new PaloGraphStore(this, this.database(), store); - } - - @Override - public String type() { - return "palo"; - } - - @Override - public String driverVersion() { - /* - * Versions history: - * [1.0] HugeGraph-1328: supports backend table version checking - * [1.1] HugeGraph-1322: add support for full-text search - * [1.2] #296: support range sortKey feature - * [1.3] #270 & #398: support shard-index and vertex + sortkey prefix, - * also split range table to rangeInt, rangeFloat, - * rangeLong and rangeDouble - * [1.4] #633: support unique index - * [1.5] #661: reduce the storage of vertex/edge id - * [1.6] #746: support userdata for indexlabel - * [1.7] #894: asStoredString() encoding is changed to signed B64 - * instead of sortable B64 - * [1.8] #295: support ttl for vertex and edge - * [1.9] #1333: support read frequency for property key - * [1.10] #1506: rename read frequency to write type - * [1.10] #1533: add meta table in system store - */ - return "1.10"; - } - - public static class PaloSchemaStore extends PaloStore { - - private final LocalCounter counter; - - public PaloSchemaStore(BackendStoreProvider provider, - String database, String store) { - super(provider, database, store); - - this.counter = new LocalCounter(); - - registerTableManager(HugeType.VERTEX_LABEL, - new PaloTables.VertexLabel()); - registerTableManager(HugeType.EDGE_LABEL, - new PaloTables.EdgeLabel()); - registerTableManager(HugeType.PROPERTY_KEY, - new PaloTables.PropertyKey()); - registerTableManager(HugeType.INDEX_LABEL, - new PaloTables.IndexLabel()); - } - - @Override - public BackendFeatures features() { - return FEATURES; - } - - @Override - public Id nextId(HugeType type) { - return this.counter.nextId(type); - } - - @Override - public void increaseCounter(HugeType type, long increment) { - this.counter.increaseCounter(type, increment); - } - - @Override - public long getCounter(HugeType type) { - return this.counter.getCounter(type); - } - - @Override - public boolean isSchemaStore() { - return true; - } - } - - public static class PaloGraphStore extends PaloStore { - - public PaloGraphStore(BackendStoreProvider provider, - String database, String store) { - super(provider, database, store); - - registerTableManager(HugeType.VERTEX, - new PaloTables.Vertex(store)); - registerTableManager(HugeType.EDGE_OUT, - new PaloTables.Edge(store, Directions.OUT)); - registerTableManager(HugeType.EDGE_IN, - new PaloTables.Edge(store, Directions.IN)); - registerTableManager(HugeType.SECONDARY_INDEX, - new PaloTables.SecondaryIndex(store)); - registerTableManager(HugeType.RANGE_INT_INDEX, - new PaloTables.RangeIntIndex(store)); - registerTableManager(HugeType.RANGE_FLOAT_INDEX, - new PaloTables.RangeFloatIndex(store)); - registerTableManager(HugeType.RANGE_LONG_INDEX, - new PaloTables.RangeLongIndex(store)); - registerTableManager(HugeType.RANGE_DOUBLE_INDEX, - new PaloTables.RangeDoubleIndex(store)); - registerTableManager(HugeType.SEARCH_INDEX, - new PaloTables.SearchIndex(store)); - registerTableManager(HugeType.SHARD_INDEX, - new PaloTables.ShardIndex(store)); - registerTableManager(HugeType.UNIQUE_INDEX, - new PaloTables.UniqueIndex(store)); - } - - @Override - public BackendFeatures features() { - return FEATURES; - } - - @Override - public boolean isSchemaStore() { - return false; - } - - @Override - public Id nextId(HugeType type) { - throw new UnsupportedOperationException("PaloGraphStore.nextId()"); - } - - @Override - public void increaseCounter(HugeType type, long num) { - throw new UnsupportedOperationException( - "PaloGraphStore.increaseCounter()"); - } - - @Override - public long getCounter(HugeType type) { - throw new UnsupportedOperationException( - "PaloGraphStore.getCounter()"); - } - } -} diff --git a/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloTable.java b/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloTable.java deleted file mode 100644 index f40eef2144..0000000000 --- a/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloTable.java +++ /dev/null @@ -1,113 +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.hugegraph.backend.store.palo; - -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.apache.commons.lang3.StringUtils; -import org.apache.hugegraph.backend.BackendException; -import org.apache.hugegraph.backend.store.TableDefine; -import org.apache.hugegraph.backend.store.mysql.MysqlBackendEntry; -import org.apache.hugegraph.backend.store.mysql.MysqlSessions; -import org.apache.hugegraph.backend.store.mysql.MysqlTable; -import org.apache.hugegraph.type.define.HugeKeys; -import org.apache.hugegraph.util.Log; -import org.slf4j.Logger; - -public abstract class PaloTable extends MysqlTable { - - private static final Logger LOG = Log.logger(PaloTable.class); - - public PaloTable(String table) { - super(table); - } - - @Override - public void createTable(MysqlSessions.Session session, - TableDefine tableDefine) { - StringBuilder sql = new StringBuilder(); - sql.append("CREATE TABLE IF NOT EXISTS "); - sql.append(this.table()).append(" ("); - // Add columns - int i = 0; - for (Map.Entry entry : - tableDefine.columns().entrySet()) { - sql.append(formatKey(entry.getKey())); - sql.append(" "); - sql.append(entry.getValue()); - if (++i != tableDefine.columns().size()) { - sql.append(", "); - } - } - sql.append(")"); - // Unique keys - sql.append(" UNIQUE KEY("); - i = 0; - for (HugeKeys key : tableDefine.keys()) { - sql.append(formatKey(key)); - if (++i != tableDefine.keys().size()) { - sql.append(", "); - } - } - sql.append(")"); - // Hash keys - sql.append(" DISTRIBUTED BY HASH("); - i = 0; - for (HugeKeys key : tableDefine.keys()) { - sql.append(formatKey(key)); - if (++i != tableDefine.keys().size()) { - sql.append(", "); - } - } - sql.append(");"); - // TODO: 'replication_num(default=3)’ can be a configuration - - LOG.debug("Create table: {}", sql); - try { - session.execute(sql.toString()); - } catch (SQLException e) { - throw new BackendException("Failed to create table with '%s'", - e, sql); - } - } - - @Override - protected void appendPartition(StringBuilder delete) { - delete.append(" PARTITION ").append(this.table()); - } - - @Override - public void insert(MysqlSessions.Session session, - MysqlBackendEntry.Row entry) { - assert session instanceof PaloSessions.Session; - PaloSessions.Session paloSession = (PaloSessions.Session) session; - - Set columnNames = this.tableDefine().columnNames(); - // Ensure column order match with table define - List columnValues = new ArrayList<>(columnNames.size()); - for (HugeKeys key : columnNames) { - columnValues.add(entry.column(key)); - } - String insert = StringUtils.join(columnValues, "\t"); - paloSession.add(this.table(), insert); - } -} diff --git a/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloTables.java b/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloTables.java deleted file mode 100644 index 268c0d232f..0000000000 --- a/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloTables.java +++ /dev/null @@ -1,472 +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.hugegraph.backend.store.palo; - -import java.sql.PreparedStatement; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.apache.hugegraph.backend.BackendException; -import org.apache.hugegraph.backend.id.EdgeId; -import org.apache.hugegraph.backend.id.Id; -import org.apache.hugegraph.backend.id.IdGenerator; -import org.apache.hugegraph.backend.id.IdUtil; -import org.apache.hugegraph.backend.id.SplicingIdGenerator; -import org.apache.hugegraph.backend.store.BackendEntry; -import org.apache.hugegraph.backend.store.BackendEntryIterator; -import org.apache.hugegraph.backend.store.TableDefine; -import org.apache.hugegraph.backend.store.mysql.MysqlBackendEntry; -import org.apache.hugegraph.backend.store.mysql.MysqlSessions; -import org.apache.hugegraph.backend.store.mysql.MysqlTables; -import org.apache.hugegraph.type.HugeType; -import org.apache.hugegraph.type.define.Directions; -import org.apache.hugegraph.type.define.HugeKeys; -import org.apache.hugegraph.util.E; - -public class PaloTables { - - private static final String NOT_NULL = "NOT NULL"; - private static final String DEFAULT_EMPTY = "DEFAULT ''"; - - private static final String DATATYPE_PK = "INT"; - private static final String DATATYPE_SL = "INT"; // VL/EL - private static final String DATATYPE_IL = "INT"; - - private static final String TINYINT = "TINYINT"; - private static final String INT = "INT"; - private static final String DECIMAL = "DECIMAL(27, 9)"; - private static final String VARCHAR = "VARCHAR(255)"; - private static final String TEXT = "VARCHAR(65533)"; - - public static class PaloTableTemplate extends PaloTable { - - protected TableDefine define; - - public PaloTableTemplate(String table) { - super(table); - } - - @Override - public TableDefine tableDefine() { - return this.define; - } - } - - public static class VertexLabel extends PaloTableTemplate { - - public static final String TABLE = HugeType.VERTEX_LABEL.string(); - - public VertexLabel() { - super(TABLE); - this.define = new TableDefine(); - this.define.column(HugeKeys.ID, DATATYPE_SL, NOT_NULL); - this.define.column(HugeKeys.NAME, VARCHAR, NOT_NULL); - this.define.column(HugeKeys.ID_STRATEGY, TINYINT, NOT_NULL); - this.define.column(HugeKeys.PRIMARY_KEYS, VARCHAR, DEFAULT_EMPTY); - this.define.column(HugeKeys.PROPERTIES, VARCHAR, DEFAULT_EMPTY); - this.define.column(HugeKeys.NULLABLE_KEYS, VARCHAR, DEFAULT_EMPTY); - this.define.column(HugeKeys.INDEX_LABELS, VARCHAR, DEFAULT_EMPTY); - this.define.column(HugeKeys.ENABLE_LABEL_INDEX, TINYINT, NOT_NULL); - this.define.column(HugeKeys.USER_DATA, VARCHAR, DEFAULT_EMPTY); - this.define.column(HugeKeys.STATUS, TINYINT, NOT_NULL); - this.define.column(HugeKeys.TTL, INT, NOT_NULL); - this.define.column(HugeKeys.TTL_START_TIME, INT); - // Unique keys/hash keys - this.define.keys(HugeKeys.ID); - } - } - - public static class EdgeLabel extends PaloTableTemplate { - - public static final String TABLE = HugeType.EDGE_LABEL.string(); - - public EdgeLabel() { - super(TABLE); - this.define = new TableDefine(); - this.define.column(HugeKeys.ID, DATATYPE_SL, NOT_NULL); - this.define.column(HugeKeys.NAME, VARCHAR, NOT_NULL); - this.define.column(HugeKeys.FREQUENCY, TINYINT, NOT_NULL); - this.define.column(HugeKeys.SOURCE_LABEL, INT, NOT_NULL); - this.define.column(HugeKeys.TARGET_LABEL, INT, NOT_NULL); - this.define.column(HugeKeys.SORT_KEYS, VARCHAR, DEFAULT_EMPTY); - this.define.column(HugeKeys.PROPERTIES, VARCHAR, DEFAULT_EMPTY); - this.define.column(HugeKeys.NULLABLE_KEYS, VARCHAR, DEFAULT_EMPTY); - this.define.column(HugeKeys.INDEX_LABELS, VARCHAR, DEFAULT_EMPTY); - this.define.column(HugeKeys.ENABLE_LABEL_INDEX, TINYINT, NOT_NULL); - this.define.column(HugeKeys.USER_DATA, VARCHAR, DEFAULT_EMPTY); - this.define.column(HugeKeys.STATUS, TINYINT, NOT_NULL); - this.define.column(HugeKeys.TTL, INT, NOT_NULL); - this.define.column(HugeKeys.TTL_START_TIME, INT); - // Unique keys/hash keys - this.define.keys(HugeKeys.ID); - } - } - - public static class PropertyKey extends PaloTableTemplate { - - public static final String TABLE = HugeType.PROPERTY_KEY.string(); - - public PropertyKey() { - super(TABLE); - this.define = new TableDefine(); - this.define.column(HugeKeys.ID, DATATYPE_PK, NOT_NULL); - this.define.column(HugeKeys.NAME, VARCHAR, NOT_NULL); - this.define.column(HugeKeys.DATA_TYPE, TINYINT, NOT_NULL); - this.define.column(HugeKeys.CARDINALITY, TINYINT, NOT_NULL); - this.define.column(HugeKeys.PROPERTIES, VARCHAR, DEFAULT_EMPTY); - this.define.column(HugeKeys.USER_DATA, VARCHAR, DEFAULT_EMPTY); - this.define.column(HugeKeys.STATUS, TINYINT, NOT_NULL); - // Unique keys/hash keys - this.define.keys(HugeKeys.ID); - } - } - - public static class IndexLabel extends PaloTableTemplate { - - public static final String TABLE = HugeType.INDEX_LABEL.string(); - - public IndexLabel() { - super(TABLE); - this.define = new TableDefine(); - this.define.column(HugeKeys.ID, DATATYPE_IL, NOT_NULL); - this.define.column(HugeKeys.NAME, VARCHAR, NOT_NULL); - this.define.column(HugeKeys.BASE_TYPE, TINYINT, NOT_NULL); - this.define.column(HugeKeys.BASE_VALUE, INT, NOT_NULL); - this.define.column(HugeKeys.INDEX_TYPE, TINYINT, NOT_NULL); - this.define.column(HugeKeys.FIELDS, VARCHAR, NOT_NULL); - this.define.column(HugeKeys.USER_DATA, VARCHAR, DEFAULT_EMPTY); - this.define.column(HugeKeys.STATUS, TINYINT, NOT_NULL); - // Unique keys/hash keys - this.define.keys(HugeKeys.ID); - } - } - - public static class Vertex extends PaloTableTemplate { - - public static final String TABLE = HugeType.VERTEX.string(); - - public Vertex(String store) { - super(joinTableName(store, TABLE)); - - this.define = new TableDefine(); - this.define.column(HugeKeys.ID, VARCHAR, NOT_NULL); - this.define.column(HugeKeys.LABEL, INT, NOT_NULL); - this.define.column(HugeKeys.PROPERTIES, TEXT, DEFAULT_EMPTY); - this.define.column(HugeKeys.EXPIRED_TIME, DECIMAL, NOT_NULL); - // Unique keys/hash keys - this.define.keys(HugeKeys.ID); - } - } - - /** - * TODO: How to let Edge extends from PaloTable and MysqlTables.Edge? - */ - public static class Edge extends PaloTableTemplate { - - private final Directions direction; - private final String delByLabelTemplate; - - public Edge(String store, Directions direction) { - super(joinTableName(store, MysqlTables.Edge.table(direction))); - - this.direction = direction; - this.delByLabelTemplate = String.format( - "DELETE FROM %s PARTITION %s WHERE %s = ?;", - this.table(), this.table(), - formatKey(HugeKeys.LABEL)); - - this.define = new TableDefine(); - this.define.column(HugeKeys.OWNER_VERTEX, VARCHAR, NOT_NULL); - this.define.column(HugeKeys.DIRECTION, TINYINT, NOT_NULL); - this.define.column(HugeKeys.LABEL, INT, NOT_NULL); - this.define.column(HugeKeys.SORT_VALUES, VARCHAR, NOT_NULL, - DEFAULT_EMPTY); - this.define.column(HugeKeys.OTHER_VERTEX, VARCHAR, NOT_NULL); - this.define.column(HugeKeys.PROPERTIES, TEXT, DEFAULT_EMPTY); - this.define.column(HugeKeys.EXPIRED_TIME, DECIMAL, NOT_NULL); - // Unique keys/hash keys - this.define.keys(HugeKeys.OWNER_VERTEX, HugeKeys.DIRECTION, - HugeKeys.LABEL, HugeKeys.SORT_VALUES, - HugeKeys.OTHER_VERTEX); - } - - @Override - protected List idColumnValue(Id id) { - EdgeId edgeId; - if (!(id instanceof EdgeId)) { - String[] idParts = EdgeId.split(id); - if (idParts.length == 1) { - // Delete edge by label - return Arrays.asList(idParts); - } - id = IdUtil.readString(id.asString()); - edgeId = EdgeId.parse(id.asString()); - } else { - edgeId = (EdgeId) id; - } - - E.checkState(edgeId.direction() == this.direction, - "Can't query %s edges from %s edges table", - edgeId.direction(), this.direction); - - List list = new ArrayList<>(5); - list.add(IdUtil.writeStoredString(edgeId.ownerVertexId())); - list.add(edgeId.direction().code()); - list.add(edgeId.edgeLabelId().asLong()); - list.add(edgeId.sortValues()); - list.add(IdUtil.writeStoredString(edgeId.otherVertexId())); - return list; - } - - @Override - public void delete(MysqlSessions.Session session, - MysqlBackendEntry.Row entry) { - // Let super class do delete if not deleting edge by label - List idParts = this.idColumnValue(entry.id()); - if (idParts.size() > 1 || !entry.columns().isEmpty()) { - super.delete(session, entry); - return; - } - - // The only element is label - this.deleteEdgesByLabel(session, entry.id()); - } - - private void deleteEdgesByLabel(MysqlSessions.Session session, - Id label) { - PreparedStatement deleteStmt; - try { - // Create or get delete prepare statement - deleteStmt = session.prepareStatement(this.delByLabelTemplate); - // Delete edges - deleteStmt.setObject(1, label.asLong()); - } catch (SQLException e) { - throw new BackendException("Failed to prepare statement '%s'", - this.delByLabelTemplate); - } - session.add(deleteStmt); - } - - @Override - protected BackendEntry mergeEntries(BackendEntry e1, BackendEntry e2) { - // Merge edges into vertex - // TODO: merge rows before calling row2Entry() - - MysqlBackendEntry current = (MysqlBackendEntry) e1; - MysqlBackendEntry next = (MysqlBackendEntry) e2; - - E.checkState(current == null || current.type().isVertex(), - "The current entry must be null or VERTEX"); - E.checkState(next != null && next.type().isEdge(), - "The next entry must be EDGE"); - - long maxSize = BackendEntryIterator.INLINE_BATCH_SIZE; - if (current != null && current.subRows().size() < maxSize) { - Id nextVertexId = IdGenerator.of( - next.column(HugeKeys.OWNER_VERTEX)); - if (current.id().equals(nextVertexId)) { - current.subRow(next.row()); - return current; - } - } - - return this.wrapByVertex(next); - } - - private MysqlBackendEntry wrapByVertex(MysqlBackendEntry edge) { - assert edge.type().isEdge(); - String ownerVertex = edge.column(HugeKeys.OWNER_VERTEX); - E.checkState(ownerVertex != null, "Invalid backend entry"); - Id vertexId = IdGenerator.of(ownerVertex); - MysqlBackendEntry vertex = new MysqlBackendEntry(HugeType.VERTEX, - vertexId); - - vertex.column(HugeKeys.ID, ownerVertex); - vertex.column(HugeKeys.PROPERTIES, ""); - - vertex.subRow(edge.row()); - return vertex; - } - } - - public abstract static class Index extends PaloTableTemplate { - - public Index(String table) { - super(table); - } - - @Override - protected BackendEntry mergeEntries(BackendEntry e1, BackendEntry e2) { - MysqlBackendEntry current = (MysqlBackendEntry) e1; - MysqlBackendEntry next = (MysqlBackendEntry) e2; - - E.checkState(current == null || current.type().isIndex(), - "The current entry must be null or INDEX"); - E.checkState(next != null && next.type().isIndex(), - "The next entry must be INDEX"); - - long maxSize = BackendEntryIterator.INLINE_BATCH_SIZE; - if (current != null && current.subRows().size() < maxSize) { - String currentId = this.entryId(current); - String nextId = this.entryId(next); - if (currentId.equals(nextId)) { - current.subRow(next.row()); - return current; - } - } - return next; - } - - protected abstract String entryId(MysqlBackendEntry entry); - } - - public static class SecondaryIndex extends Index { - - public static final String TABLE = HugeType.SECONDARY_INDEX.string(); - - public SecondaryIndex(String store) { - this(store, TABLE); - } - - protected SecondaryIndex(String store, String table) { - super(joinTableName(store, table)); - - this.define = new TableDefine(); - this.define.column(HugeKeys.FIELD_VALUES, VARCHAR, NOT_NULL); - this.define.column(HugeKeys.INDEX_LABEL_ID, INT, NOT_NULL); - this.define.column(HugeKeys.ELEMENT_IDS, VARCHAR, NOT_NULL); - // Unique keys/hash keys - this.define.keys(HugeKeys.FIELD_VALUES, - HugeKeys.INDEX_LABEL_ID, - HugeKeys.ELEMENT_IDS); - } - - @Override - protected final String entryId(MysqlBackendEntry entry) { - String fieldValues = entry.column(HugeKeys.FIELD_VALUES); - Integer labelId = entry.column(HugeKeys.INDEX_LABEL_ID); - return SplicingIdGenerator.concat(fieldValues, labelId.toString()); - } - } - - public static class SearchIndex extends SecondaryIndex { - - public static final String TABLE = HugeType.SEARCH_INDEX.string(); - - public SearchIndex(String store) { - super(store, TABLE); - } - } - - public static class UniqueIndex extends SecondaryIndex { - - public static final String TABLE = HugeType.UNIQUE_INDEX.string(); - - public UniqueIndex(String store) { - super(store, TABLE); - } - } - - public abstract static class RangeIndex extends Index { - - public RangeIndex(String store, String table) { - super(joinTableName(store, table)); - - this.define = new TableDefine(); - this.define.column(HugeKeys.INDEX_LABEL_ID, INT, NOT_NULL); - this.define.column(HugeKeys.FIELD_VALUES, DECIMAL, NOT_NULL); - this.define.column(HugeKeys.ELEMENT_IDS, VARCHAR, NOT_NULL); - // Unique keys/hash keys - this.define.keys(HugeKeys.INDEX_LABEL_ID, - HugeKeys.FIELD_VALUES, - HugeKeys.ELEMENT_IDS); - } - - @Override - protected final String entryId(MysqlBackendEntry entry) { - Double fieldValue = entry.column(HugeKeys.FIELD_VALUES); - Integer labelId = entry.column(HugeKeys.INDEX_LABEL_ID); - return SplicingIdGenerator.concat(labelId.toString(), - fieldValue.toString()); - } - } - - public static class RangeIntIndex extends RangeIndex { - - public static final String TABLE = HugeType.RANGE_INT_INDEX.string(); - - public RangeIntIndex(String store) { - super(store, TABLE); - } - } - - public static class RangeFloatIndex extends RangeIndex { - - public static final String TABLE = HugeType.RANGE_FLOAT_INDEX.string(); - - public RangeFloatIndex(String store) { - super(store, TABLE); - } - } - - public static class RangeLongIndex extends RangeIndex { - - public static final String TABLE = HugeType.RANGE_LONG_INDEX.string(); - - public RangeLongIndex(String store) { - super(store, TABLE); - } - } - - public static class RangeDoubleIndex extends RangeIndex { - - public static final String TABLE = HugeType.RANGE_DOUBLE_INDEX.string(); - - public RangeDoubleIndex(String store) { - super(store, TABLE); - } - } - - public static class ShardIndex extends Index { - - public static final String TABLE = HugeType.SHARD_INDEX.string(); - - public ShardIndex(String store) { - super(joinTableName(store, TABLE)); - - this.define = new TableDefine(); - this.define.column(HugeKeys.INDEX_LABEL_ID, INT, NOT_NULL); - this.define.column(HugeKeys.FIELD_VALUES, VARCHAR, NOT_NULL); - this.define.column(HugeKeys.ELEMENT_IDS, VARCHAR, NOT_NULL); - // Unique keys/hash keys - this.define.keys(HugeKeys.INDEX_LABEL_ID, - HugeKeys.FIELD_VALUES, - HugeKeys.ELEMENT_IDS); - } - - @Override - protected final String entryId(MysqlBackendEntry entry) { - Double fieldValue = entry.column(HugeKeys.FIELD_VALUES); - Integer labelId = entry.column(HugeKeys.INDEX_LABEL_ID); - return SplicingIdGenerator.concat(labelId.toString(), - fieldValue.toString()); - } - } -} diff --git a/hugegraph-server/hugegraph-postgresql/pom.xml b/hugegraph-server/hugegraph-postgresql/pom.xml deleted file mode 100644 index f907f0e3fd..0000000000 --- a/hugegraph-server/hugegraph-postgresql/pom.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - - hugegraph-server - org.apache.hugegraph - ${revision} - ../pom.xml - - 4.0.0 - - hugegraph-postgresql - - - - org.apache.hugegraph - hugegraph-core - ${revision} - - - org.apache.hugegraph - hugegraph-mysql - ${revision} - - - org.postgresql - postgresql - 42.4.3 - - - diff --git a/hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlOptions.java b/hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlOptions.java deleted file mode 100644 index 86ebccefe1..0000000000 --- a/hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlOptions.java +++ /dev/null @@ -1,49 +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.hugegraph.backend.store.postgresql; - -import static org.apache.hugegraph.config.OptionChecker.disallowEmpty; - -import org.apache.hugegraph.backend.store.mysql.MysqlOptions; -import org.apache.hugegraph.config.ConfigOption; - -public class PostgresqlOptions extends MysqlOptions { - - private PostgresqlOptions() { - super(); - } - - private static volatile PostgresqlOptions instance; - - public static synchronized PostgresqlOptions instance() { - if (instance == null) { - instance = new PostgresqlOptions(); - instance.registerOptions(); - } - return instance; - } - - public static final ConfigOption POSTGRESQL_CONNECT_DATABASE = - new ConfigOption<>( - "jdbc.postgresql.connect_database", - "The database used to connect when init store, " + - "drop store or check store exist.", - disallowEmpty(), - "template1" - ); -} diff --git a/hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlSerializer.java b/hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlSerializer.java deleted file mode 100644 index 918c32caa6..0000000000 --- a/hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlSerializer.java +++ /dev/null @@ -1,58 +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.hugegraph.backend.store.postgresql; - -import org.apache.hugegraph.backend.id.IdUtil; -import org.apache.hugegraph.backend.serializer.TableBackendEntry; -import org.apache.hugegraph.backend.store.BackendEntry; -import org.apache.hugegraph.backend.store.mysql.MysqlSerializer; -import org.apache.hugegraph.config.HugeConfig; -import org.apache.hugegraph.structure.HugeIndex; -import org.apache.hugegraph.type.define.HugeKeys; -import org.apache.logging.log4j.util.Strings; - -public class PostgresqlSerializer extends MysqlSerializer { - - public PostgresqlSerializer(HugeConfig config) { - super(config); - } - - @Override - public BackendEntry writeIndex(HugeIndex index) { - TableBackendEntry entry = newBackendEntry(index); - /* - * When field-values is null and elementIds size is 0, it is - * meaningful for deletion of index data in secondary/range index. - */ - if (index.fieldValues() == null && index.elementIds().isEmpty()) { - entry.column(HugeKeys.INDEX_LABEL_ID, index.indexLabel().longId()); - } else { - Object value = index.fieldValues(); - if ("\u0000".equals(value)) { - value = Strings.EMPTY; - } - entry.column(HugeKeys.FIELD_VALUES, value); - entry.column(HugeKeys.INDEX_LABEL_ID, index.indexLabel().longId()); - entry.column(HugeKeys.ELEMENT_IDS, - IdUtil.writeStoredString(index.elementId())); - entry.column(HugeKeys.EXPIRED_TIME, index.expiredTime()); - entry.subId(index.elementId()); - } - return entry; - } -} diff --git a/hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlSessions.java b/hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlSessions.java deleted file mode 100644 index cccbb69453..0000000000 --- a/hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlSessions.java +++ /dev/null @@ -1,135 +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.hugegraph.backend.store.postgresql; - -import java.net.URISyntaxException; -import java.sql.Connection; -import java.sql.ResultSet; -import java.sql.SQLException; - -import org.apache.http.client.utils.URIBuilder; -import org.apache.hugegraph.backend.BackendException; -import org.apache.hugegraph.backend.store.mysql.MysqlSessions; -import org.apache.hugegraph.backend.store.mysql.MysqlUtil; -import org.apache.hugegraph.config.HugeConfig; -import org.apache.hugegraph.util.Log; -import org.postgresql.core.Utils; -import org.postgresql.util.PSQLException; -import org.slf4j.Logger; - -public class PostgresqlSessions extends MysqlSessions { - - private static final Logger LOG = Log.logger(PostgresqlSessions.class); - - private static final String COCKROACH_DB_CREATE = - "CREATE DATABASE %s ENCODING='UTF-8'"; - private static final String POSTGRESQL_DB_CREATE = COCKROACH_DB_CREATE + - " TEMPLATE=template0 LC_COLLATE='C' " + - "LC_CTYPE='C';"; - - public PostgresqlSessions(HugeConfig config, String database, String store) { - super(config, database, store); - } - - @Override - public boolean existsDatabase() { - String statement = String.format( - "SELECT datname FROM pg_catalog.pg_database " + - "WHERE datname = '%s';", this.escapedDatabase()); - try (Connection conn = this.openWithoutDB(0)) { - ResultSet result = conn.createStatement().executeQuery(statement); - return result.next(); - } catch (Exception e) { - throw new BackendException("Failed to obtain database info", e); - } - } - - @Override - public void createDatabase() { - // Create database with non-database-session - LOG.debug("Create database: {}", this.database()); - - String sql = this.buildCreateDatabase(this.database()); - try (Connection conn = this.openWithoutDB(0)) { - try { - conn.createStatement().execute(sql); - } catch (PSQLException e) { - // CockroachDB not support 'template' arg of CREATE DATABASE - if (e.getMessage().contains("syntax error at or near " + - "\"template\"")) { - sql = String.format(COCKROACH_DB_CREATE, this.database()); - conn.createStatement().execute(sql); - } - } - } catch (SQLException e) { - if (!e.getMessage().endsWith("already exists")) { - throw new BackendException("Failed to create database '%s'", e, - this.database()); - } - // Ignore exception if database already exists - } - } - - @Override - protected String buildCreateDatabase(String database) { - return String.format(POSTGRESQL_DB_CREATE, database); - } - - @Override - protected String buildDropDatabase(String database) { - return String.format( - "REVOKE CONNECT ON DATABASE %s FROM public;" + - "SELECT pg_terminate_backend(pg_stat_activity.pid) " + - " FROM pg_stat_activity " + - " WHERE pg_stat_activity.datname = %s;" + - "DROP DATABASE IF EXISTS %s;", - database, escapeAndWrapString(database), database); - } - - @Override - protected String buildExistsTable(String table) { - return String.format( - "SELECT * FROM information_schema.tables " + - "WHERE table_schema = 'public' AND table_name = '%s' LIMIT 1;", - MysqlUtil.escapeString(table)); - } - - @Override - protected URIBuilder newConnectionURIBuilder(String url) - throws URISyntaxException { - // Suppress error log when database does not exist - return new URIBuilder(url).addParameter("loggerLevel", "OFF"); - } - - @Override - protected String connectDatabase() { - return this.config().get(PostgresqlOptions.POSTGRESQL_CONNECT_DATABASE); - } - - public static String escapeAndWrapString(String value) { - StringBuilder builder = new StringBuilder(8 + value.length()); - builder.append('\''); - try { - Utils.escapeLiteral(builder, value, false); - } catch (SQLException e) { - throw new BackendException("Failed to escape '%s'", e, value); - } - builder.append('\''); - return builder.toString(); - } -} diff --git a/hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlStore.java b/hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlStore.java deleted file mode 100644 index 797dbbe29f..0000000000 --- a/hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlStore.java +++ /dev/null @@ -1,35 +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.hugegraph.backend.store.postgresql; - -import org.apache.hugegraph.backend.store.BackendStoreProvider; -import org.apache.hugegraph.backend.store.mysql.MysqlStore; -import org.apache.hugegraph.config.HugeConfig; - -public abstract class PostgresqlStore extends MysqlStore { - - public PostgresqlStore(BackendStoreProvider provider, - String database, String name) { - super(provider, database, name); - } - - @Override - protected PostgresqlSessions openSessionPool(HugeConfig config) { - return new PostgresqlSessions(config, this.database(), this.store()); - } -} diff --git a/hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlStoreProvider.java b/hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlStoreProvider.java deleted file mode 100644 index 65ed8e0fac..0000000000 --- a/hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlStoreProvider.java +++ /dev/null @@ -1,221 +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.hugegraph.backend.store.postgresql; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import org.apache.hugegraph.backend.id.Id; -import org.apache.hugegraph.backend.store.BackendStore; -import org.apache.hugegraph.backend.store.BackendStoreProvider; -import org.apache.hugegraph.backend.store.mysql.MysqlSessions; -import org.apache.hugegraph.backend.store.mysql.MysqlStoreProvider; -import org.apache.hugegraph.backend.store.mysql.MysqlTable; -import org.apache.hugegraph.config.HugeConfig; -import org.apache.hugegraph.type.HugeType; -import org.apache.hugegraph.type.define.Directions; -import org.apache.hugegraph.util.Log; -import org.slf4j.Logger; - -public class PostgresqlStoreProvider extends MysqlStoreProvider { - - private static final Logger LOG = Log.logger(PostgresqlStoreProvider.class); - - @Override - protected BackendStore newSchemaStore(HugeConfig config, String store) { - return new PostgresqlSchemaStore(this, this.database(), store); - } - - @Override - protected BackendStore newGraphStore(HugeConfig config, String store) { - return new PostgresqlGraphStore(this, this.database(), store); - } - - @Override - protected BackendStore newSystemStore(HugeConfig config, String store) { - return new PostgresqlSystemStore(this, this.database(), store); - } - - @Override - public String type() { - return "postgresql"; - } - - @Override - public String driverVersion() { - /* - * Versions history: - * [1.0] #441: supports PostgreSQL and Cockroach backend - * [1.1] #270 & #398: support shard-index and vertex + sortkey prefix, - * also split range table to rangeInt, rangeFloat, - * rangeLong and rangeDouble - * [1.2] #633: support unique index - * [1.3] #661: reduce the storage of vertex/edge id - * [1.4] #691: support aggregate property - * [1.5] #746: support userdata for indexlabel - * [1.6] #894: asStoredString() encoding is changed to signed B64 - * instead of sortable B64 - * [1.7] #295: support ttl for vertex and edge - * [1.8] #1333: support read frequency for property key - * [1.9] #1506: rename read frequency to write type - * [1.9] #1533: add meta table in system store - */ - return "1.9"; - } - - public static class PostgresqlSchemaStore extends PostgresqlStore { - - private final PostgresqlTables.Counters counters; - - public PostgresqlSchemaStore(BackendStoreProvider provider, - String database, String store) { - super(provider, database, store); - - this.counters = new PostgresqlTables.Counters(); - - registerTableManager(HugeType.VERTEX_LABEL, - new PostgresqlTables.VertexLabel()); - registerTableManager(HugeType.EDGE_LABEL, - new PostgresqlTables.EdgeLabel()); - registerTableManager(HugeType.PROPERTY_KEY, - new PostgresqlTables.PropertyKey()); - registerTableManager(HugeType.INDEX_LABEL, - new PostgresqlTables.IndexLabel()); - } - - @Override - protected Collection tables() { - List tables = new ArrayList<>(super.tables()); - tables.add(this.counters); - return tables; - } - - @Override - public void increaseCounter(HugeType type, long increment) { - this.checkOpened(); - MysqlSessions.Session session = this.session(type); - this.counters.increaseCounter(session, type, increment); - } - - @Override - public long getCounter(HugeType type) { - this.checkOpened(); - MysqlSessions.Session session = this.session(type); - return this.counters.getCounter(session, type); - } - - @Override - public boolean isSchemaStore() { - return true; - } - } - - public static class PostgresqlGraphStore extends PostgresqlStore { - - public PostgresqlGraphStore(BackendStoreProvider provider, - String database, String store) { - super(provider, database, store); - - registerTableManager(HugeType.VERTEX, - new PostgresqlTables.Vertex(store)); - registerTableManager(HugeType.EDGE_OUT, - new PostgresqlTables.Edge(store, - Directions.OUT)); - registerTableManager(HugeType.EDGE_IN, - new PostgresqlTables.Edge(store, - Directions.IN)); - registerTableManager(HugeType.SECONDARY_INDEX, - new PostgresqlTables.SecondaryIndex(store)); - registerTableManager(HugeType.RANGE_INT_INDEX, - new PostgresqlTables.RangeIntIndex(store)); - registerTableManager(HugeType.RANGE_FLOAT_INDEX, - new PostgresqlTables.RangeFloatIndex(store)); - registerTableManager(HugeType.RANGE_LONG_INDEX, - new PostgresqlTables.RangeLongIndex(store)); - registerTableManager(HugeType.RANGE_DOUBLE_INDEX, - new PostgresqlTables.RangeDoubleIndex(store)); - registerTableManager(HugeType.SEARCH_INDEX, - new PostgresqlTables.SearchIndex(store)); - registerTableManager(HugeType.SHARD_INDEX, - new PostgresqlTables.ShardIndex(store)); - registerTableManager(HugeType.UNIQUE_INDEX, - new PostgresqlTables.UniqueIndex(store)); - } - - @Override - public boolean isSchemaStore() { - return false; - } - - @Override - public Id nextId(HugeType type) { - throw new UnsupportedOperationException( - "PostgresqlGraphStore.nextId()"); - } - - @Override - public void increaseCounter(HugeType type, long increment) { - throw new UnsupportedOperationException( - "PostgresqlGraphStore.increaseCounter()"); - } - - @Override - public long getCounter(HugeType type) { - throw new UnsupportedOperationException( - "PostgresqlGraphStore.getCounter()"); - } - } - - public static class PostgresqlSystemStore extends PostgresqlGraphStore { - - private final PostgresqlTables.Meta meta; - - public PostgresqlSystemStore(BackendStoreProvider provider, - String database, String store) { - super(provider, database, store); - - this.meta = new PostgresqlTables.Meta(); - } - - @Override - public void init() { - super.init(); - this.checkOpened(); - MysqlSessions.Session session = this.session(HugeType.META); - String driverVersion = this.provider().driverVersion(); - this.meta.writeVersion(session, driverVersion); - LOG.info("Write down the backend version: {}", driverVersion); - } - - @Override - public String storedVersion() { - super.init(); - this.checkOpened(); - MysqlSessions.Session session = this.session(HugeType.META); - return this.meta.readVersion(session); - } - - @Override - protected Collection tables() { - List tables = new ArrayList<>(super.tables()); - tables.add(this.meta); - return tables; - } - } -} diff --git a/hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlTable.java b/hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlTable.java deleted file mode 100644 index 555615fe79..0000000000 --- a/hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlTable.java +++ /dev/null @@ -1,170 +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.hugegraph.backend.store.postgresql; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.hugegraph.backend.serializer.TableBackendEntry.Row; -import org.apache.hugegraph.backend.store.mysql.MysqlBackendEntry; -import org.apache.hugegraph.backend.store.mysql.MysqlSessions.Session; -import org.apache.hugegraph.backend.store.mysql.MysqlTable; -import org.apache.hugegraph.backend.store.mysql.WhereBuilder; -import org.apache.hugegraph.type.define.HugeKeys; -import org.apache.logging.log4j.util.Strings; - -public abstract class PostgresqlTable extends MysqlTable { - - private String orderByKeysTemplate = null; - - public PostgresqlTable(String table) { - super(table); - } - - @Override - protected String buildDropTemplate() { - return String.format("DROP TABLE IF EXISTS %s CASCADE;", this.table()); - } - - @Override - protected String buildTruncateTemplate() { - return String.format("TRUNCATE TABLE %s CASCADE;", this.table()); - } - - @Override - protected String engine(Session session) { - return Strings.EMPTY; - } - - @Override - protected String buildUpdateForcedTemplate(MysqlBackendEntry.Row entry) { - return this.buildInsertKeys(entry, false); - } - - @Override - protected List buildUpdateForcedParams(MysqlBackendEntry.Row entry) { - List params = new ArrayList<>(); - List allColumns = this.buildColumnsParams(entry); - params.addAll(allColumns); - params.addAll(allColumns); - return params; - } - - @Override - protected String buildUpdateIfAbsentTemplate(Row entry) { - return this.buildInsertKeys(entry, true); - } - - @Override - protected List buildUpdateIfAbsentParams(MysqlBackendEntry.Row entry) { - return this.buildColumnsParams(entry); - } - - protected String buildInsertKeys(MysqlBackendEntry.Row entry, - boolean ignoreConflicts) { - StringBuilder insert = new StringBuilder(); - insert.append("INSERT INTO ").append(this.table()).append(" ("); - - int i = 0; - int size = entry.columns().size(); - for (HugeKeys key : entry.columns().keySet()) { - insert.append(formatKey(key)); - if (++i != size) { - insert.append(", "); - } - } - insert.append(") VALUES ("); - - for (i = 0; i < size; i++) { - insert.append("?"); - if (i != size - 1) { - insert.append(", "); - } - } - insert.append(")"); - - i = 0; - size = this.tableDefine().keys().size(); - insert.append(" ON CONFLICT ("); - for (HugeKeys key : this.tableDefine().keys()) { - insert.append(formatKey(key)); - if (++i != size) { - insert.append(", "); - } - } - insert.append(")"); - - if (ignoreConflicts) { - insert.append(" DO NOTHING"); - } else { - i = 0; - size = entry.columns().keySet().size(); - insert.append(" DO UPDATE SET "); - for (HugeKeys key : entry.columns().keySet()) { - insert.append(formatKey(key)).append(" = ?"); - if (++i != size) { - insert.append(", "); - } - } - } - - return insert.toString(); - } - - @Override - protected String orderByKeys() { - // Set order-by to keep results order consistence for PostgreSQL result - if (this.orderByKeysTemplate != null) { - return this.orderByKeysTemplate; - } - int i = 0; - int size = this.tableDefine().keys().size(); - StringBuilder select = new StringBuilder(" ORDER BY "); - for (HugeKeys hugeKey : this.tableDefine().keys()) { - String key = formatKey(hugeKey); - select.append(key).append(" "); - select.append("ASC "); - if (++i != size) { - select.append(", "); - } - } - this.orderByKeysTemplate = select.toString(); - return this.orderByKeysTemplate; - } - - @Override - protected WhereBuilder newWhereBuilder(boolean startWithWhere) { - return new PgWhereBuilder(startWithWhere); - } - - private static class PgWhereBuilder extends WhereBuilder { - - public PgWhereBuilder(boolean startWithWhere) { - super(startWithWhere); - } - - @Override - protected String escapeAndWrapString(String value) { - if (value.equals("\u0000")) { - /* PR-2439 return string of '' */ - return "''"; - } - return PostgresqlSessions.escapeAndWrapString(value); - } - } -} diff --git a/hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlTables.java b/hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlTables.java deleted file mode 100644 index d57ad3c2db..0000000000 --- a/hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlTables.java +++ /dev/null @@ -1,291 +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.hugegraph.backend.store.postgresql; - -import static org.apache.hugegraph.backend.store.mysql.MysqlTables.BOOLEAN; -import static org.apache.hugegraph.backend.store.mysql.MysqlTables.HUGE_TEXT; -import static org.apache.hugegraph.backend.store.mysql.MysqlTables.INT; -import static org.apache.hugegraph.backend.store.mysql.MysqlTables.LARGE_TEXT; -import static org.apache.hugegraph.backend.store.mysql.MysqlTables.MID_TEXT; -import static org.apache.hugegraph.backend.store.mysql.MysqlTables.NUMERIC; -import static org.apache.hugegraph.backend.store.mysql.MysqlTables.SMALL_TEXT; -import static org.apache.hugegraph.backend.store.mysql.MysqlTables.TINYINT; - -import java.sql.SQLException; -import java.util.List; -import java.util.Map; - -import org.apache.hugegraph.backend.BackendException; -import org.apache.hugegraph.backend.id.Id; -import org.apache.hugegraph.backend.store.BackendEntry; -import org.apache.hugegraph.backend.store.TableDefine; -import org.apache.hugegraph.backend.store.mysql.MysqlBackendEntry; -import org.apache.hugegraph.backend.store.mysql.MysqlSessions.Session; -import org.apache.hugegraph.backend.store.mysql.MysqlTables; -import org.apache.hugegraph.backend.store.mysql.MysqlTables.MysqlTableTemplate; -import org.apache.hugegraph.type.HugeType; -import org.apache.hugegraph.type.define.Directions; -import org.apache.hugegraph.type.define.HugeKeys; - -import com.google.common.collect.ImmutableMap; - -public class PostgresqlTables { - - private static final Map TYPES_MAPPING = - ImmutableMap.builder() - .put(BOOLEAN, "BOOL") - .put(TINYINT, "INT") - .put(INT, "INT") - .put(NUMERIC, "DECIMAL") - .put(SMALL_TEXT, "VARCHAR(255)") - .put(MID_TEXT, "VARCHAR(1024)") - .put(LARGE_TEXT, "VARCHAR(65533)") - .put(HUGE_TEXT, "TEXT") - .build(); - - public static class PostgresqlTableTemplate extends PostgresqlTable { - - protected MysqlTableTemplate template; - - public PostgresqlTableTemplate(MysqlTableTemplate template) { - super(template.table()); - this.template = template; - } - - @Override - public TableDefine tableDefine() { - return this.template.tableDefine(); - } - } - - public static class Meta extends PostgresqlTableTemplate { - - public Meta() { - super(new MysqlTables.Meta(TYPES_MAPPING)); - } - - public void writeVersion(Session session, String version) { - String versionColumn = formatKey(HugeKeys.VERSION); - String insert = String.format("INSERT INTO %s VALUES ('%s', '%s') " + - "ON CONFLICT(name) DO NOTHING;", - this.table(), versionColumn, version); - try { - session.execute(insert); - } catch (SQLException e) { - throw new BackendException("Failed to insert driver version " + - "with '%s'", e, insert); - } - } - - public String readVersion(Session session) { - MysqlTables.Meta table = (MysqlTables.Meta) this.template; - return table.readVersion(session); - } - } - - public static class Counters extends PostgresqlTableTemplate { - - public Counters() { - super(new MysqlTables.Counters(TYPES_MAPPING)); - } - - public long getCounter(Session session, HugeType type) { - MysqlTables.Counters table = (MysqlTables.Counters) this.template; - return table.getCounter(session, type); - } - - public void increaseCounter(Session session, HugeType type, - long increment) { - String update = String.format( - "INSERT INTO %s (%s, %s) VALUES ('%s', %s) " + - "ON CONFLICT (%s) DO UPDATE SET ID = %s.ID + %s;", - this.table(), formatKey(HugeKeys.SCHEMA_TYPE), - formatKey(HugeKeys.ID), type.name(), increment, - formatKey(HugeKeys.SCHEMA_TYPE), - this.table(), increment); - try { - session.execute(update); - } catch (SQLException e) { - throw new BackendException( - "Failed to update counters with type '%s'", e, type); - } - } - } - - public static class VertexLabel extends PostgresqlTableTemplate { - - public VertexLabel() { - super(new MysqlTables.VertexLabel(TYPES_MAPPING)); - } - } - - public static class EdgeLabel extends PostgresqlTableTemplate { - - public EdgeLabel() { - super(new MysqlTables.EdgeLabel(TYPES_MAPPING)); - } - } - - public static class PropertyKey extends PostgresqlTableTemplate { - - public PropertyKey() { - super(new MysqlTables.PropertyKey(TYPES_MAPPING)); - } - } - - public static class IndexLabel extends PostgresqlTableTemplate { - - public IndexLabel() { - super(new MysqlTables.IndexLabel(TYPES_MAPPING)); - } - } - - public static class Vertex extends PostgresqlTableTemplate { - - public static final String TABLE = HugeType.VERTEX.string(); - - public Vertex(String store) { - super(new MysqlTables.Vertex(store, TYPES_MAPPING)); - } - } - - public static class Edge extends PostgresqlTableTemplate { - - public Edge(String store, Directions direction) { - super(new MysqlTables.Edge(store, direction, TYPES_MAPPING)); - } - - @Override - protected List idColumnValue(Id id) { - MysqlTables.Edge table = (MysqlTables.Edge) this.template; - return table.idColumnValue(id); - } - - @Override - public void delete(Session session, MysqlBackendEntry.Row entry) { - MysqlTables.Edge table = (MysqlTables.Edge) this.template; - table.delete(session, entry); - } - - @Override - protected BackendEntry mergeEntries(BackendEntry e1, BackendEntry e2) { - MysqlTables.Edge table = (MysqlTables.Edge) this.template; - return table.mergeEntries(e1, e2); - } - } - - public static class SecondaryIndex extends PostgresqlTableTemplate { - - public static final String TABLE = MysqlTables.SecondaryIndex.TABLE; - - public SecondaryIndex(String store) { - super(new MysqlTables.SecondaryIndex(store, TABLE, TYPES_MAPPING)); - } - - public SecondaryIndex(String store, String table) { - super(new MysqlTables.SecondaryIndex(store, table, TYPES_MAPPING)); - } - - protected final String entryId(MysqlBackendEntry entry) { - return ((MysqlTables.SecondaryIndex) this.template).entryId(entry); - } - } - - public static class SearchIndex extends SecondaryIndex { - - public static final String TABLE = MysqlTables.SearchIndex.TABLE; - - public SearchIndex(String store) { - super(store, TABLE); - } - } - - public static class UniqueIndex extends SecondaryIndex { - - public static final String TABLE = MysqlTables.UniqueIndex.TABLE; - - public UniqueIndex(String store) { - super(store, TABLE); - } - } - - public static class RangeIntIndex extends PostgresqlTableTemplate { - - public static final String TABLE = HugeType.RANGE_INT_INDEX.string(); - - public RangeIntIndex(String store) { - super(new MysqlTables.RangeIntIndex(store, TABLE, TYPES_MAPPING)); - } - - protected final String entryId(MysqlBackendEntry entry) { - return ((MysqlTables.RangeIntIndex) this.template).entryId(entry); - } - } - - public static class RangeFloatIndex extends PostgresqlTableTemplate { - - public static final String TABLE = HugeType.RANGE_FLOAT_INDEX.string(); - - public RangeFloatIndex(String store) { - super(new MysqlTables.RangeFloatIndex(store, TABLE, TYPES_MAPPING)); - } - - protected final String entryId(MysqlBackendEntry entry) { - return ((MysqlTables.RangeFloatIndex) this.template).entryId(entry); - } - } - - public static class RangeLongIndex extends PostgresqlTableTemplate { - - public static final String TABLE = HugeType.RANGE_LONG_INDEX.string(); - - public RangeLongIndex(String store) { - super(new MysqlTables.RangeLongIndex(store, TABLE, TYPES_MAPPING)); - } - - protected final String entryId(MysqlBackendEntry entry) { - return ((MysqlTables.RangeLongIndex) this.template).entryId(entry); - } - } - - public static class RangeDoubleIndex extends PostgresqlTableTemplate { - - public static final String TABLE = HugeType.RANGE_DOUBLE_INDEX.string(); - - public RangeDoubleIndex(String store) { - super(new MysqlTables.RangeDoubleIndex(store, TABLE, - TYPES_MAPPING)); - } - - protected final String entryId(MysqlBackendEntry entry) { - return ((MysqlTables.RangeDoubleIndex) this.template) - .entryId(entry); - } - } - - public static class ShardIndex extends PostgresqlTableTemplate { - - public ShardIndex(String store) { - super(new MysqlTables.ShardIndex(store, TYPES_MAPPING)); - } - - protected final String entryId(MysqlBackendEntry entry) { - return ((MysqlTables.ShardIndex) this.template).entryId(entry); - } - } -} diff --git a/hugegraph-server/hugegraph-scylladb/pom.xml b/hugegraph-server/hugegraph-scylladb/pom.xml deleted file mode 100644 index 50573df23b..0000000000 --- a/hugegraph-server/hugegraph-scylladb/pom.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - hugegraph-server - org.apache.hugegraph - ${revision} - ../pom.xml - - 4.0.0 - - hugegraph-scylladb - - - - org.apache.hugegraph - hugegraph-cassandra - ${revision} - - - - diff --git a/hugegraph-server/hugegraph-scylladb/src/main/java/org/apache/hugegraph/backend/store/scylladb/ScyllaDBFeatures.java b/hugegraph-server/hugegraph-scylladb/src/main/java/org/apache/hugegraph/backend/store/scylladb/ScyllaDBFeatures.java deleted file mode 100644 index 2ff7fd0bc6..0000000000 --- a/hugegraph-server/hugegraph-scylladb/src/main/java/org/apache/hugegraph/backend/store/scylladb/ScyllaDBFeatures.java +++ /dev/null @@ -1,33 +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.hugegraph.backend.store.scylladb; - -import org.apache.hugegraph.backend.store.cassandra.CassandraFeatures; - -public class ScyllaDBFeatures extends CassandraFeatures { - - @Override - public boolean supportsQueryWithContains() { - return false; - } - - @Override - public boolean supportsQueryWithContainsKey() { - return false; - } -} diff --git a/hugegraph-server/hugegraph-scylladb/src/main/java/org/apache/hugegraph/backend/store/scylladb/ScyllaDBMetrics.java b/hugegraph-server/hugegraph-scylladb/src/main/java/org/apache/hugegraph/backend/store/scylladb/ScyllaDBMetrics.java deleted file mode 100644 index 77585c73aa..0000000000 --- a/hugegraph-server/hugegraph-scylladb/src/main/java/org/apache/hugegraph/backend/store/scylladb/ScyllaDBMetrics.java +++ /dev/null @@ -1,69 +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.hugegraph.backend.store.scylladb; - -import java.util.Map; - -import org.apache.cassandra.tools.NodeProbe; -import org.apache.hugegraph.backend.store.cassandra.CassandraMetrics; -import org.apache.hugegraph.backend.store.cassandra.CassandraSessionPool; -import org.apache.hugegraph.config.HugeConfig; - -public class ScyllaDBMetrics extends CassandraMetrics { - - public ScyllaDBMetrics(HugeConfig conf, - CassandraSessionPool sessions, - String keyspace) { - super(conf, sessions, keyspace); - } - - @Override - protected void appendExtraMetrics(Map metrics, - NodeProbe probe) { - // Table counter Metrics - appendCounterMetrics(metrics, probe, this.keyspace(), this.tables(), - "EstimatedPartitionCount"); - appendCounterMetrics(metrics, probe, this.keyspace(), this.tables(), - "DroppedMutations"); - appendCounterMetrics(metrics, probe, this.keyspace(), this.tables(), - "PendingFlushes"); - //appendCounterMetrics(metrics, probe, this.keyspace(), this.tables(), - // "KeyCacheHitRate"); - appendCounterMetrics(metrics, probe, this.keyspace(), this.tables(), - "BloomFilterFalseRatio"); - - // Table timer Metrics - //appendTimerMetrics(metrics, probe, this.keyspace(), "WriteLatency"); - //appendTimerMetrics(metrics, probe, this.keyspace(), "ReadLatency"); - //appendTimerMetrics(metrics, probe, null, "WriteLatency"); - //appendTimerMetrics(metrics, probe, null, "ReadLatency"); - - // Cache Metrics - appendCacheMetrics(metrics, probe, "KeyCache", "Size"); - appendCacheMetrics(metrics, probe, "KeyCache", "Entries"); - appendCacheMetrics(metrics, probe, "RowCache", "Size"); - appendCacheMetrics(metrics, probe, "RowCache", "Entries"); - appendCacheMetrics(metrics, probe, "CounterCache", "Size"); - appendCacheMetrics(metrics, probe, "CounterCache", "Entries"); - - // Compaction Metrics - appendCompactionMetrics(metrics, probe, "CompletedTasks"); - appendCompactionMetrics(metrics, probe, "PendingTasks"); - //appendCompactionMetrics(metrics, probe, "BytesCompacted"); - } -} diff --git a/hugegraph-server/hugegraph-scylladb/src/main/java/org/apache/hugegraph/backend/store/scylladb/ScyllaDBStoreProvider.java b/hugegraph-server/hugegraph-scylladb/src/main/java/org/apache/hugegraph/backend/store/scylladb/ScyllaDBStoreProvider.java deleted file mode 100644 index 015afb8319..0000000000 --- a/hugegraph-server/hugegraph-scylladb/src/main/java/org/apache/hugegraph/backend/store/scylladb/ScyllaDBStoreProvider.java +++ /dev/null @@ -1,173 +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.hugegraph.backend.store.scylladb; - -import org.apache.hugegraph.backend.store.BackendFeatures; -import org.apache.hugegraph.backend.store.BackendStore; -import org.apache.hugegraph.backend.store.BackendStoreProvider; -import org.apache.hugegraph.backend.store.cassandra.CassandraMetrics; -import org.apache.hugegraph.backend.store.cassandra.CassandraSessionPool; -import org.apache.hugegraph.backend.store.cassandra.CassandraStore; -import org.apache.hugegraph.backend.store.cassandra.CassandraStoreProvider; -import org.apache.hugegraph.config.HugeConfig; -import org.apache.hugegraph.type.HugeType; -import org.apache.hugegraph.util.E; -import org.apache.hugegraph.util.Log; -import org.slf4j.Logger; - -public class ScyllaDBStoreProvider extends CassandraStoreProvider { - - private static final Logger LOG = Log.logger(CassandraStore.class); - - private static final BackendFeatures FEATURES = new ScyllaDBFeatures(); - - @Override - public String type() { - return "scylladb"; - } - - @Override - public BackendStore loadSchemaStore(HugeConfig config) { - String name = SCHEMA_STORE; - LOG.debug("ScyllaDBStoreProvider load SchemaStore '{}'", name); - - if (!this.stores.containsKey(name)) { - BackendStore s = new ScyllaDBSchemaStore(this, keyspace(), name); - this.stores.putIfAbsent(name, s); - } - - BackendStore store = this.stores.get(name); - E.checkNotNull(store, "store"); - E.checkState(store instanceof ScyllaDBSchemaStore, - "SchemaStore must be an instance of ScyllaDBSchemaStore"); - return store; - } - - @Override - public BackendStore loadGraphStore(HugeConfig config) { - String name = GRAPH_STORE; - LOG.debug("ScyllaDBStoreProvider load GraphStore '{}'", name); - - if (!this.stores.containsKey(name)) { - BackendStore s = new ScyllaDBGraphStore(this, keyspace(), name); - this.stores.putIfAbsent(name, s); - } - - BackendStore store = this.stores.get(name); - E.checkNotNull(store, "store"); - E.checkState(store instanceof ScyllaDBGraphStore, - "GraphStore must be an instance of ScyllaDBGraphStore"); - return store; - } - - @Override - public BackendStore loadSystemStore(HugeConfig config) { - String name = SYSTEM_STORE; - LOG.debug("ScyllaDBStoreProvider load SystemStore '{}'", name); - - if (!this.stores.containsKey(name)) { - BackendStore s = new ScyllaDBSystemStore(this, keyspace(), name); - this.stores.putIfAbsent(name, s); - } - - BackendStore store = this.stores.get(name); - E.checkNotNull(store, "store"); - E.checkState(store instanceof ScyllaDBSystemStore, - "SystemStore must be an instance of ScyllaDBSystemStore"); - return store; - } - - public static class ScyllaDBSchemaStore - extends CassandraStore.CassandraSchemaStore { - - public ScyllaDBSchemaStore(BackendStoreProvider provider, - String keyspace, String store) { - super(provider, keyspace, store); - - registerTableManager(HugeType.VERTEX_LABEL, - new ScyllaDBTablesWithMV.VertexLabel()); - registerTableManager(HugeType.EDGE_LABEL, - new ScyllaDBTablesWithMV.EdgeLabel()); - registerTableManager(HugeType.PROPERTY_KEY, - new ScyllaDBTablesWithMV.PropertyKey()); - registerTableManager(HugeType.INDEX_LABEL, - new ScyllaDBTablesWithMV.IndexLabel()); - } - - @Override - public BackendFeatures features() { - return FEATURES; - } - - @Override - protected CassandraMetrics createMetrics(HugeConfig conf, - CassandraSessionPool sessions, - String keyspace) { - return new ScyllaDBMetrics(conf, sessions, keyspace); - } - } - - public static class ScyllaDBGraphStore - extends CassandraStore.CassandraGraphStore { - - public ScyllaDBGraphStore(BackendStoreProvider provider, - String keyspace, String store) { - super(provider, keyspace, store); - - registerTableManager(HugeType.VERTEX, - new ScyllaDBTablesWithMV.Vertex(store)); - registerTableManager(HugeType.EDGE_OUT, - ScyllaDBTablesWithMV.Edge.out(store)); - registerTableManager(HugeType.EDGE_IN, - ScyllaDBTablesWithMV.Edge.in(store)); - } - - @Override - public BackendFeatures features() { - return FEATURES; - } - - @Override - protected CassandraMetrics createMetrics(HugeConfig conf, - CassandraSessionPool sessions, - String keyspace) { - return new ScyllaDBMetrics(conf, sessions, keyspace); - } - } - - public static class ScyllaDBSystemStore - extends CassandraStore.CassandraSystemStore { - - public ScyllaDBSystemStore(BackendStoreProvider provider, - String keyspace, String store) { - super(provider, keyspace, store); - } - - @Override - public BackendFeatures features() { - return FEATURES; - } - - @Override - protected CassandraMetrics createMetrics(HugeConfig conf, - CassandraSessionPool sessions, - String keyspace) { - return new ScyllaDBMetrics(conf, sessions, keyspace); - } - } -} diff --git a/hugegraph-server/hugegraph-scylladb/src/main/java/org/apache/hugegraph/backend/store/scylladb/ScyllaDBTablesWithMV.java b/hugegraph-server/hugegraph-scylladb/src/main/java/org/apache/hugegraph/backend/store/scylladb/ScyllaDBTablesWithMV.java deleted file mode 100644 index 4d0500a231..0000000000 --- a/hugegraph-server/hugegraph-scylladb/src/main/java/org/apache/hugegraph/backend/store/scylladb/ScyllaDBTablesWithMV.java +++ /dev/null @@ -1,301 +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.hugegraph.backend.store.scylladb; - -import java.util.Collection; -import java.util.List; -import java.util.stream.Collectors; - -import org.apache.hugegraph.backend.query.Condition; -import org.apache.hugegraph.backend.query.ConditionQuery; -import org.apache.hugegraph.backend.query.Query; -import org.apache.hugegraph.backend.store.cassandra.CassandraSessionPool; -import org.apache.hugegraph.backend.store.cassandra.CassandraTable; -import org.apache.hugegraph.backend.store.cassandra.CassandraTables; -import org.apache.hugegraph.type.define.Directions; -import org.apache.hugegraph.type.define.HugeKeys; - -import com.datastax.driver.core.querybuilder.Select; - -public class ScyllaDBTablesWithMV { - - private static boolean isQueryBySpecifiedKey(Query query, HugeKeys key) { - Collection conditions = query.conditions(); - if (query instanceof ConditionQuery && !conditions.isEmpty()) { - ConditionQuery cq = (ConditionQuery) query; - Object value = cq.condition(key); - return value != null && cq.allSysprop() && - conditions.size() == 1 && - cq.containsRelation(key, Condition.RelationType.EQ); - } - return false; - } - - private static boolean isQueryByLabel(Query query) { - return isQueryBySpecifiedKey(query, HugeKeys.LABEL); - } - - private static boolean isQueryByName(Query query) { - return isQueryBySpecifiedKey(query, HugeKeys.NAME); - } - - private static String mvNameTable(String table) { - return "mv_name2" + table; - } - - private static String mvLabelTable(String table) { - return "mv_label2" + table; - } - - private static void createSchemaIndexTable( - CassandraSessionPool.Session session, - String mvName, String table) { - final String NAME = CassandraTable.formatKey(HugeKeys.NAME); - final String ID = CassandraTable.formatKey(HugeKeys.ID); - String cql = String.format( - "CREATE MATERIALIZED VIEW IF NOT EXISTS %s AS " + - " SELECT * FROM %s " + - " WHERE %s IS NOT NULL " + - " PRIMARY KEY(%s, %s)", - mvName, table, NAME, - NAME, ID); - session.execute(cql); - } - - private static void dropIndexTable(CassandraSessionPool.Session session, - String mvName) { - String cql = String.format("DROP MATERIALIZED VIEW IF EXISTS %s", - mvName); - session.execute(cql); - } - - public static class PropertyKey extends CassandraTables.PropertyKey { - - private final String mvName2Pk = mvNameTable(this.table()); - - @Override - protected void createIndex(CassandraSessionPool.Session session, - String indexLabel, - HugeKeys column) { - createSchemaIndexTable(session, mvName2Pk, this.table()); - } - - @Override - protected void dropTable(CassandraSessionPool.Session session) { - dropIndexTable(session, mvName2Pk); - super.dropTable(session); - } - - @Override - protected List query2Select(String table, Query query) { - if (isQueryByName(query)) { - // Query from materialized view - return super.query2Select(mvName2Vl, query); - } - return super.query2Select(table, query); - } - } - - public static class EdgeLabel extends CassandraTables.EdgeLabel { - - private final String mvName2El = mvNameTable(this.table()); - - @Override - protected void createIndex(CassandraSessionPool.Session session, - String indexLabel, - HugeKeys column) { - createSchemaIndexTable(session, mvName2El, this.table()); - } - - @Override - protected void dropTable(CassandraSessionPool.Session session) { - dropIndexTable(session, mvName2El); - super.dropTable(session); - } - - @Override - protected List query2Select(String table, Query query) { - if (isQueryByName(query)) { - // Query from materialized view - return super.query2Select(mvName2Il, query); - } - return super.query2Select(table, query); - } - } - - public static class Vertex extends CassandraTables.Vertex { - - private final String mvLabel2Vertex = mvLabelTable(this.table()); - - public Vertex(String store) { - super(store); - } - - @Override - protected void createIndex(CassandraSessionPool.Session session, - String indexLabel, - HugeKeys column) { - final String LABEL = CassandraTable.formatKey(HugeKeys.LABEL); - final String ID = CassandraTable.formatKey(HugeKeys.ID); - String cql = String.format( - "CREATE MATERIALIZED VIEW IF NOT EXISTS %s AS " + - " SELECT * FROM %s " + - " WHERE %s IS NOT NULL " + - " PRIMARY KEY(%s, %s)", - mvLabel2Vertex, this.table(), LABEL, LABEL, ID); - session.execute(cql); - } - - @Override - protected void dropTable(CassandraSessionPool.Session session) { - dropIndexTable(session, mvLabel2Vertex); - super.dropTable(session); - } - - /** - * Query data from label index table if just want to query by label - */ - @Override - protected List query2Select(String table, Query query) { - if (isQueryByLabel(query)) { - // Query from materialized view - return super.query2Select(mvLabel2Edge, query); - } - return super.query2Select(table, query); - } - - @Override - protected String labelIndexTable() { - return mvLabel2Edge; - } - - public static Edge out(String store) { - return new Edge(store, Directions.OUT); - } - - public static Edge in(String store) { - return new Edge(store, Directions.IN); - } - } -} diff --git a/hugegraph-server/hugegraph-test/pom.xml b/hugegraph-server/hugegraph-test/pom.xml index b3fc645f79..259d5a9b9a 100644 --- a/hugegraph-server/hugegraph-test/pom.xml +++ b/hugegraph-server/hugegraph-test/pom.xml @@ -45,16 +45,6 @@ hugegraph-api ${revision} - - org.apache.hugegraph - hugegraph-cassandra - ${revision} - - - org.apache.hugegraph - hugegraph-scylladb - ${revision} - org.apache.hugegraph hugegraph-rocksdb @@ -65,16 +55,6 @@ hugegraph-hbase ${revision} - - org.apache.hugegraph - hugegraph-mysql - ${revision} - - - org.apache.hugegraph - hugegraph-postgresql - ${revision} - org.apache.hugegraph hugegraph-dist @@ -97,13 +77,6 @@ jersey-test-framework-provider-grizzly2 - - mysql - mysql-connector-java - 8.0.28 - test - - com.janeluo ikanalyzer diff --git a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/MetricsApiTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/MetricsApiTest.java index 2a903af234..d0a1775a16 100644 --- a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/MetricsApiTest.java +++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/MetricsApiTest.java @@ -90,8 +90,6 @@ public void testMetricsBackend() { int nodes = (Integer) graph.get("nodes"); switch (backend) { case "memory": - case "mysql": - case "postgresql": Assert.assertEquals(1, nodes); break; case "rocksdb": @@ -116,128 +114,6 @@ public void testMetricsBackend() { assertMapContains(host, "estimate_num_keys"); break; - case "cassandra": - assertMapContains(graph, "cluster_id"); - assertMapContains(graph, "servers"); - - servers = (Map) graph.get("servers"); - Assert.assertGte(1, servers.size()); - // TODO: Uncomment after fixed #1843 - for (Map.Entry e : servers.entrySet()) { - String key = (String) e.getKey(); - value = e.getValue(); - Assert.assertTrue(String.format("Expect map value for key %s but got %s", - key, value), value instanceof Map); - host = (Map) value; - assertMapContains(host, "mem_max"); - assertMapContains(host, "mem_committed"); - assertMapContains(host, "mem_used"); - assertMapContains(host, "mem_used_readable"); - assertMapContains(host, "mem_unit"); - - assertMapContains(host, "disk_usage"); - assertMapContains(host, "disk_usage_readable"); - assertMapContains(host, "disk_usage_details"); - assertMapContains(host, "disk_unit"); - - assertMapContains(host, "uptime"); - assertMapContains(host, "uptime_readable"); - assertMapContains(host, "time_unit"); - - assertMapContains(host, "estimated_partition_count"); - assertMapContains(host, "dropped_mutations"); - assertMapContains(host, "pending_flushes"); - assertMapContains(host, "key_cache_hit_rate"); - assertMapContains(host, "bloom_filter_false_ratio"); - - assertMapContains(host, "write_latency_hugegraph"); - assertMapContains(host, "read_latency_hugegraph"); - assertMapContains(host, "write_latency_*"); - assertMapContains(host, "read_latency_*"); - - assertMapContains(host, "key_cache_size"); - assertMapContains(host, "key_cache_entries"); - assertMapContains(host, "row_cache_size"); - assertMapContains(host, "row_cache_entries"); - assertMapContains(host, "counter_cache_size"); - assertMapContains(host, "counter_cache_entries"); - - assertMapContains(host, "compaction_completed_tasks"); - assertMapContains(host, "compaction_pending_tasks"); - assertMapContains(host, "compaction_bytes_compacted"); - - assertMapContains(host, "live_nodes"); - assertMapContains(host, "joining_nodes"); - assertMapContains(host, "moving_nodes"); - assertMapContains(host, "leaving_nodes"); - assertMapContains(host, "unreachable_nodes"); - - assertMapContains(host, "keyspaces"); - assertMapContains(host, "num_tables"); - assertMapContains(host, "exception_count"); - } - break; - case "scylladb": - assertMapContains(graph, "cluster_id"); - assertMapContains(graph, "servers"); - - servers = (Map) graph.get("servers"); - Assert.assertGte(1, servers.size()); - - for (Map.Entry e : servers.entrySet()) { - String key = (String) e.getKey(); - value = e.getValue(); - Assert.assertTrue(String.format("Expect map value for key %s but got %s", - key, value), value instanceof Map); - host = (Map) value; - assertMapContains(host, "mem_max"); - assertMapContains(host, "mem_committed"); - assertMapContains(host, "mem_used"); - assertMapContains(host, "mem_used_readable"); - assertMapContains(host, "mem_unit"); - - assertMapContains(host, "disk_usage"); - assertMapContains(host, "disk_usage_readable"); - assertMapContains(host, "disk_usage_details"); - assertMapContains(host, "disk_unit"); - - assertMapContains(host, "uptime"); - assertMapContains(host, "uptime_readable"); - assertMapContains(host, "time_unit"); - - assertMapContains(host, "estimated_partition_count"); - assertMapContains(host, "dropped_mutations"); - assertMapContains(host, "pending_flushes"); - //assertMapContains(host, "key_cache_hit_rate"); - assertMapContains(host, "bloom_filter_false_ratio"); - - //assertMapContains(host, "write_latency_hugegraph"); - //assertMapContains(host, "read_latency_hugegraph"); - //assertMapContains(host, "write_latency_*"); - //assertMapContains(host, "read_latency_*"); - - assertMapContains(host, "key_cache_size"); - assertMapContains(host, "key_cache_entries"); - assertMapContains(host, "row_cache_size"); - assertMapContains(host, "row_cache_entries"); - assertMapContains(host, "counter_cache_size"); - assertMapContains(host, "counter_cache_entries"); - - assertMapContains(host, "compaction_completed_tasks"); - assertMapContains(host, "compaction_pending_tasks"); - //assertMapContains(host, "compaction_bytes_compacted"); - - assertMapContains(host, "live_nodes"); - assertMapContains(host, "joining_nodes"); - assertMapContains(host, "moving_nodes"); - assertMapContains(host, "leaving_nodes"); - assertMapContains(host, "unreachable_nodes"); - - assertMapContains(host, "keyspaces"); - assertMapContains(host, "num_tables"); - assertMapContains(host, "exception_count"); - } - break; case "hbase": assertMapContains(graph, "cluster_id"); assertMapContains(graph, "master_name"); diff --git a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/EdgeCoreTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/EdgeCoreTest.java index eadc277136..f74c5c1c5b 100644 --- a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/EdgeCoreTest.java +++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/EdgeCoreTest.java @@ -499,27 +499,7 @@ public void testAddEdgeWithInvalidSortkey() { }); String backend = graph.backend(); - if (backend.equals("postgresql")) { - Assert.assertThrows(BackendException.class, () -> { - james.addEdge("write", book, "time", "2017-5-27\u0000"); - graph.tx().commit(); - }, e -> { - // pgsql need to clear and reset state (like auto-commit) - graph.tx().rollback(); - Assert.assertContains("invalid byte sequence for encoding " + - "\"UTF8\": 0x00", - e.getCause().getMessage()); - }); - - Assert.assertThrows(BackendException.class, () -> { - graph.traversal().V(james.id()) - .outE("write").has("time", "2017-5-27\u0000") - .toList(); - }, e -> { - Assert.assertContains("Zero bytes may not occur in string " + - "parameters", e.getCause().getMessage()); - }); - } else if (ImmutableSet.of("rocksdb", "hbase", "hstore").contains(backend)) { + if (ImmutableSet.of("rocksdb", "hbase", "hstore").contains(backend)) { Assert.assertThrows(IllegalArgumentException.class, () -> { james.addEdge("write", book, "time", "2017-5-27\u0000"); graph.tx().commit(); @@ -2930,9 +2910,6 @@ public void testQueryEdgesByHasValue() { Assert.assertEquals(3, edges.get(0).value("score")); Assert.assertEquals(3, edges.get(1).value("score")); - // TODO: Seems Cassandra Bug if contains null value #862 - //edges = graph.traversal().E().hasValue(3).toList(); - //Assert.assertEquals(3, edges.size()); } @Test @@ -5265,14 +5242,9 @@ public void testScanEdgeInPaging() { ConditionQuery query = new ConditionQuery(HugeType.EDGE); String backend = graph.backend(); - if (backend.equals("cassandra") || backend.equals("scylladb")) { - query.scan(String.valueOf(Long.MIN_VALUE), - String.valueOf(Long.MAX_VALUE)); - } else { - // QUESTION: The query method may not be well adapted - query.scan(BackendTable.ShardSplitter.START, - BackendTable.ShardSplitter.END); - } + // QUESTION: The query method may not be well adapted + query.scan(BackendTable.ShardSplitter.START, + BackendTable.ShardSplitter.END); query.limit(1); String page = PageInfo.PAGE_NONE; @@ -5896,8 +5868,7 @@ public void testAddEdgePropertyWithSpecialValueForSecondaryIndex() { Assert.assertEquals(3, edges.get(0).value("id")); String backend = graph.backend(); - Set nonZeroBackends = ImmutableSet.of("postgresql", - "rocksdb", "hbase", "hstore"); + Set nonZeroBackends = ImmutableSet.of("rocksdb", "hbase", "hstore"); if (nonZeroBackends.contains(backend)) { Assert.assertThrows(Exception.class, () -> { louise.addEdge("strike", sean, "id", 4, diff --git a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/VertexCoreTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/VertexCoreTest.java index 4b7ec65bc3..6118deee2b 100644 --- a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/VertexCoreTest.java +++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/VertexCoreTest.java @@ -4203,8 +4203,7 @@ public void testQueryByDoubleProperty() { /* * The double precision type typically has a range of around 1E-307 to - * 1E+308 with a precision of at least 15 digits. (postgresql) - * https://www.postgresql.org/docs/9.5/datatype-numeric.html#DATATYPE-NUMERIC-TABLE + * 1E+308 with a precision of at least 15 digits. */ final double max15 = new BigDecimal(Double.MAX_VALUE) .movePointLeft(308) @@ -6339,8 +6338,7 @@ public void testAddVertexPropertyWithSpecialValueForSecondaryIndex() { Assert.assertEquals("3", vertices.get(0).value("name")); String backend = graph.backend(); - Set nonZeroBackends = ImmutableSet.of("postgresql", - "rocksdb", "hbase", "hstore"); + Set nonZeroBackends = ImmutableSet.of("rocksdb", "hbase", "hstore"); if (nonZeroBackends.contains(backend)) { Assert.assertThrows(Exception.class, () -> { graph.addVertex(T.label, "person", "name", "0", @@ -7754,13 +7752,8 @@ public void testScanVertexInPaging() { ConditionQuery query = new ConditionQuery(HugeType.VERTEX); String backend = graph.backend(); - if (backend.equals("cassandra") || backend.equals("scylladb")) { - query.scan(String.valueOf(Long.MIN_VALUE), - String.valueOf(Long.MAX_VALUE)); - } else { - query.scan(BackendTable.ShardSplitter.START, - BackendTable.ShardSplitter.END); - } + query.scan(BackendTable.ShardSplitter.START, + BackendTable.ShardSplitter.END); query.limit(1); String page = PageInfo.PAGE_NONE; @@ -9135,13 +9128,11 @@ public void testAddVertexWithSpecialSymbolInPrimaryValues() { Assert.assertEquals(vertex3, g.V().hasLabel("person") .has("name", "xyz\u0003abc").next()); - if (!graph.backend().equals("postgresql")) { - Vertex vertex0 = graph.addVertex(T.label, "person", "name", - "xyz\u0000abc", "city", "Hongkong", - "age", 10); - Assert.assertEquals(vertex0, g.V().hasLabel("person") - .has("name", "xyz\u0000abc").next()); - } + Vertex vertex0 = graph.addVertex(T.label, "person", "name", + "xyz\u0000abc", "city", "Hongkong", + "age", 10); + Assert.assertEquals(vertex0, g.V().hasLabel("person") + .has("name", "xyz\u0000abc").next()); Assert.assertThrows(IllegalArgumentException.class, () -> { graph.addVertex(T.label, "person", "name", @@ -9267,18 +9258,6 @@ public void testQueryBySearchIndexWithSpecialSymbol() { Assert.assertContains("can't contains byte '0x00'", e.getMessage()); }); - } else if (backend.equals("postgresql")) { - Assert.assertThrows(BackendException.class, () -> { - graph.addVertex(T.label, "person", "name", "7", - "city", "xyz\u0000efg", - "age", 15); - graph.tx().commit(); - }, e -> { - graph.tx().rollback(); - Assert.assertContains("invalid byte sequence for encoding " + - "\"UTF8\": 0x00", - e.getCause().getMessage()); - }); } else { graph.addVertex(T.label, "person", "name", "8", "city", "xyz\u0000efg", diff --git a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/tinkerpop/TestGraph.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/tinkerpop/TestGraph.java index 9ef6d9affd..53dc1fe9ac 100644 --- a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/tinkerpop/TestGraph.java +++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/tinkerpop/TestGraph.java @@ -53,7 +53,7 @@ public class TestGraph implements Graph { public static final String DEFAULT_VL = "vertex"; - public static final Set TRUNCATE_BACKENDS = ImmutableSet.of("rocksdb", "mysql"); + public static final Set TRUNCATE_BACKENDS = ImmutableSet.of("rocksdb"); private static volatile int id = 666; diff --git a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/UnitTestSuite.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/UnitTestSuite.java index 1a4f0c2c9b..1d3dd58a83 100644 --- a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/UnitTestSuite.java +++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/UnitTestSuite.java @@ -37,7 +37,6 @@ import org.apache.hugegraph.unit.cache.CachedGraphTransactionTest; import org.apache.hugegraph.unit.cache.CachedSchemaTransactionTest; import org.apache.hugegraph.unit.cache.RamTableTest; -import org.apache.hugegraph.unit.cassandra.CassandraTest; import org.apache.hugegraph.unit.core.AnalyzerTest; import org.apache.hugegraph.unit.core.BackendMutationTest; import org.apache.hugegraph.unit.core.BackendStoreInfoTest; @@ -64,8 +63,6 @@ import org.apache.hugegraph.unit.id.IdTest; import org.apache.hugegraph.unit.id.IdUtilTest; import org.apache.hugegraph.unit.id.SplicingIdGeneratorTest; -import org.apache.hugegraph.unit.mysql.MysqlUtilTest; -import org.apache.hugegraph.unit.mysql.WhereBuilderTest; import org.apache.hugegraph.unit.rocksdb.RocksDBCountersTest; import org.apache.hugegraph.unit.rocksdb.RocksDBSessionTest; import org.apache.hugegraph.unit.rocksdb.RocksDBSessionsTest; @@ -169,13 +166,6 @@ StoreSerializerTest.class, TextSerializerTest.class, - /* cassandra */ - CassandraTest.class, - - /* mysql */ - MysqlUtilTest.class, - WhereBuilderTest.class, - /* rocksdb */ RocksDBSessionsTest.class, RocksDBSessionTest.class, diff --git a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/cassandra/CassandraTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/cassandra/CassandraTest.java deleted file mode 100644 index 6445fc38bd..0000000000 --- a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/cassandra/CassandraTest.java +++ /dev/null @@ -1,437 +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.hugegraph.unit.cassandra; - -import java.net.InetSocketAddress; -import java.util.Collections; -import java.util.Map; - -import org.apache.commons.configuration2.Configuration; -import org.apache.commons.configuration2.PropertiesConfiguration; -import org.apache.hugegraph.backend.BackendException; -import org.apache.hugegraph.backend.store.cassandra.CassandraOptions; -import org.apache.hugegraph.backend.store.cassandra.CassandraSessionPool; -import org.apache.hugegraph.backend.store.cassandra.CassandraStore; -import org.apache.hugegraph.config.HugeConfig; -import org.apache.hugegraph.config.OptionSpace; -import org.apache.hugegraph.testutil.Assert; -import org.apache.hugegraph.testutil.Whitebox; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.mockito.Mockito; - -import com.datastax.driver.core.ResultSet; -import com.datastax.driver.core.ResultSetFuture; -import com.datastax.driver.core.SimpleStatement; -import com.datastax.driver.core.Statement; -import com.datastax.driver.core.exceptions.NoHostAvailableException; -import com.datastax.driver.core.exceptions.OperationTimedOutException; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; - -public class CassandraTest { - - @Before - public void setup() { - OptionSpace.register("cassandra", - "org.apache.hugegraph.backend.store.cassandra.CassandraOptions"); - } - - @After - public void teardown() { - // pass - } - - @Test - public void testParseReplicaWithSimpleStrategy() { - String strategy = CassandraOptions.CASSANDRA_STRATEGY.name(); - String replica = CassandraOptions.CASSANDRA_REPLICATION.name(); - - Configuration conf = new PropertiesConfiguration(); - conf.setProperty(strategy, "SimpleStrategy"); - conf.setProperty(replica, ImmutableList.of("5")); - HugeConfig config = new HugeConfig(conf); - - Map result = Whitebox.invokeStatic(CassandraStore.class, - "parseReplica", - config); - - Map expected = ImmutableMap.of( - "class", "SimpleStrategy", - "replication_factor", 5); - Assert.assertEquals(expected, result); - } - - @Test - public void testParseReplicaWithNetworkTopologyStrategy() { - String strategy = CassandraOptions.CASSANDRA_STRATEGY.name(); - String replica = CassandraOptions.CASSANDRA_REPLICATION.name(); - - Configuration conf = new PropertiesConfiguration(); - conf.setProperty(strategy, "NetworkTopologyStrategy"); - conf.setProperty(replica, ImmutableList.of("dc1:2", "dc2:1")); - HugeConfig config = new HugeConfig(conf); - - Map result = Whitebox.invokeStatic(CassandraStore.class, - "parseReplica", - config); - - Map expected = ImmutableMap.of( - "class", "NetworkTopologyStrategy", - "dc1", 2, - "dc2", 1); - Assert.assertEquals(expected, result); - } - - @Test - public void testParseReplicaWithSimpleStrategyAndEmptyReplica() { - String strategy = CassandraOptions.CASSANDRA_STRATEGY.name(); - String replica = CassandraOptions.CASSANDRA_REPLICATION.name(); - - Configuration conf = new PropertiesConfiguration(); - conf.setProperty(strategy, "SimpleStrategy"); - conf.setProperty(replica, ImmutableList.of("")); - HugeConfig config = new HugeConfig(conf); - - Assert.assertThrows(RuntimeException.class, () -> { - Whitebox.invokeStatic(CassandraStore.class, "parseReplica", config); - }); - } - - @Test - public void testParseReplicaWithSimpleStrategyAndDoubleReplica() { - String strategy = CassandraOptions.CASSANDRA_STRATEGY.name(); - String replica = CassandraOptions.CASSANDRA_REPLICATION.name(); - - Configuration conf = new PropertiesConfiguration(); - conf.setProperty(strategy, "SimpleStrategy"); - conf.setProperty(replica, ImmutableList.of("1.5")); - HugeConfig config = new HugeConfig(conf); - - Assert.assertThrows(RuntimeException.class, () -> { - Whitebox.invokeStatic(CassandraStore.class, "parseReplica", config); - }); - } - - @Test - public void testParseReplicaWithSimpleStrategyAndStringReplica() { - String strategy = CassandraOptions.CASSANDRA_STRATEGY.name(); - String replica = CassandraOptions.CASSANDRA_REPLICATION.name(); - - Configuration conf = new PropertiesConfiguration(); - conf.setProperty(strategy, "SimpleStrategy"); - conf.setProperty(replica, ImmutableList.of("string")); - HugeConfig config = new HugeConfig(conf); - - Assert.assertThrows(RuntimeException.class, () -> { - Whitebox.invokeStatic(CassandraStore.class, "parseReplica", config); - }); - } - - @Test - public void testParseReplicaWithNetworkTopologyStrategyAndStringReplica() { - String strategy = CassandraOptions.CASSANDRA_STRATEGY.name(); - String replica = CassandraOptions.CASSANDRA_REPLICATION.name(); - - Configuration conf = new PropertiesConfiguration(); - conf.setProperty(strategy, "NetworkTopologyStrategy"); - conf.setProperty(replica, ImmutableList.of("dc1:2", "dc2:string")); - HugeConfig config = new HugeConfig(conf); - - Assert.assertThrows(RuntimeException.class, () -> { - Whitebox.invokeStatic(CassandraStore.class, "parseReplica", config); - }); - } - - @Test - public void testParseReplicaWithNetworkTopologyStrategyWithoutDatacenter() { - String strategy = CassandraOptions.CASSANDRA_STRATEGY.name(); - String replica = CassandraOptions.CASSANDRA_REPLICATION.name(); - - Configuration conf = new PropertiesConfiguration(); - conf.setProperty(strategy, "NetworkTopologyStrategy"); - conf.setProperty(replica, ImmutableList.of(":2", "dc2:1")); - HugeConfig config = new HugeConfig(conf); - - Assert.assertThrows(RuntimeException.class, () -> { - Whitebox.invokeStatic(CassandraStore.class, "parseReplica", config); - }); - } - - @Test - public void testParseReplicaWithNetworkTopologyStrategyAndEmptyReplica() { - String strategy = CassandraOptions.CASSANDRA_STRATEGY.name(); - String replica = CassandraOptions.CASSANDRA_REPLICATION.name(); - - Configuration conf = new PropertiesConfiguration(); - conf.setProperty(strategy, "NetworkTopologyStrategy"); - conf.setProperty(replica, ImmutableList.of("dc1:", "dc2:1")); - HugeConfig config = new HugeConfig(conf); - - Assert.assertThrows(RuntimeException.class, () -> { - Whitebox.invokeStatic(CassandraStore.class, "parseReplica", config); - }); - } - - @Test - public void testParseReplicaWithNetworkTopologyStrategyAndDoubleReplica() { - String strategy = CassandraOptions.CASSANDRA_STRATEGY.name(); - String replica = CassandraOptions.CASSANDRA_REPLICATION.name(); - - Configuration conf = new PropertiesConfiguration(); - conf.setProperty(strategy, "NetworkTopologyStrategy"); - conf.setProperty(replica, ImmutableList.of("dc1:3.5", "dc2:1")); - HugeConfig config = new HugeConfig(conf); - - Assert.assertThrows(RuntimeException.class, () -> { - Whitebox.invokeStatic(CassandraStore.class, "parseReplica", config); - }); - } - - @Test - public void testReconnectOptionsHaveSensibleDefaults() { - // Runtime-reconnection options must exist with non-zero defaults so - // HugeGraph keeps running when Cassandra restarts (issue #2740). - Assert.assertEquals(1000L, (long) CassandraOptions - .CASSANDRA_RECONNECT_BASE_DELAY.defaultValue()); - Assert.assertEquals(10_000L, (long) CassandraOptions - .CASSANDRA_RECONNECT_MAX_DELAY.defaultValue()); - Assert.assertEquals(3, (int) CassandraOptions - .CASSANDRA_QUERY_RETRY_MAX_ATTEMPTS.defaultValue()); - Assert.assertEquals(1000L, (long) CassandraOptions - .CASSANDRA_QUERY_RETRY_INTERVAL.defaultValue()); - } - - @Test - public void testReconnectOptionsAreOverridable() { - String base = CassandraOptions.CASSANDRA_RECONNECT_BASE_DELAY.name(); - String max = CassandraOptions.CASSANDRA_RECONNECT_MAX_DELAY.name(); - String retries = CassandraOptions.CASSANDRA_QUERY_RETRY_MAX_ATTEMPTS - .name(); - String interval = CassandraOptions.CASSANDRA_QUERY_RETRY_INTERVAL.name(); - - Configuration conf = new PropertiesConfiguration(); - conf.setProperty(base, 500L); - conf.setProperty(max, 30_000L); - conf.setProperty(retries, 3); - conf.setProperty(interval, 1000L); - HugeConfig config = new HugeConfig(conf); - - Assert.assertEquals(500L, (long) config.get( - CassandraOptions.CASSANDRA_RECONNECT_BASE_DELAY)); - Assert.assertEquals(30_000L, (long) config.get( - CassandraOptions.CASSANDRA_RECONNECT_MAX_DELAY)); - Assert.assertEquals(3, (int) config.get( - CassandraOptions.CASSANDRA_QUERY_RETRY_MAX_ATTEMPTS)); - Assert.assertEquals(1000L, (long) config.get( - CassandraOptions.CASSANDRA_QUERY_RETRY_INTERVAL)); - } - - @Test - public void testQueryRetryAttemptsCanBeDisabled() { - String retries = CassandraOptions.CASSANDRA_QUERY_RETRY_MAX_ATTEMPTS - .name(); - Configuration conf = new PropertiesConfiguration(); - conf.setProperty(retries, 0); - HugeConfig config = new HugeConfig(conf); - Assert.assertEquals(0, (int) config.get( - CassandraOptions.CASSANDRA_QUERY_RETRY_MAX_ATTEMPTS)); - } - - @Test - public void testExecuteWithRetrySucceedsAfterTransientFailures() { - // Configure retry knobs via config so the pool reads them through - // the normal path (no Whitebox overrides on retry fields). Keep the - // values within the validators' lower bounds (base >= 100, max >= - // base, interval >= 100). - Configuration conf = new PropertiesConfiguration(); - conf.setProperty( - CassandraOptions.CASSANDRA_RECONNECT_BASE_DELAY.name(), 100L); - conf.setProperty( - CassandraOptions.CASSANDRA_RECONNECT_MAX_DELAY.name(), 1000L); - conf.setProperty( - CassandraOptions.CASSANDRA_QUERY_RETRY_MAX_ATTEMPTS.name(), 3); - conf.setProperty( - CassandraOptions.CASSANDRA_QUERY_RETRY_INTERVAL.name(), 100L); - HugeConfig config = new HugeConfig(conf); - CassandraSessionPool pool = new CassandraSessionPool(config, - "ks", "store"); - - com.datastax.driver.core.Session driverSession = Mockito.mock( - com.datastax.driver.core.Session.class); - ResultSet rs = Mockito.mock(ResultSet.class); - NoHostAvailableException transientFailure = - new NoHostAvailableException(Collections.emptyMap()); - Mockito.when(driverSession.execute(Mockito.any(Statement.class))) - .thenThrow(transientFailure) - .thenThrow(transientFailure) - .thenReturn(rs); - - CassandraSessionPool.Session session = pool.new Session(); - Whitebox.setInternalState(session, "session", driverSession); - - ResultSet result = session.execute("SELECT now() FROM system.local"); - Assert.assertSame(rs, result); - Mockito.verify(driverSession, Mockito.times(3)) - .execute(Mockito.any(Statement.class)); - Mockito.verify(driverSession, Mockito.never()).close(); - } - - @Test - public void testExecuteWithRetrySkipsNonIdempotentTimeoutRetry() { - Configuration conf = new PropertiesConfiguration(); - conf.setProperty( - CassandraOptions.CASSANDRA_RECONNECT_BASE_DELAY.name(), 100L); - conf.setProperty( - CassandraOptions.CASSANDRA_RECONNECT_MAX_DELAY.name(), 1000L); - conf.setProperty( - CassandraOptions.CASSANDRA_QUERY_RETRY_MAX_ATTEMPTS.name(), 3); - conf.setProperty( - CassandraOptions.CASSANDRA_QUERY_RETRY_INTERVAL.name(), 100L); - HugeConfig config = new HugeConfig(conf); - CassandraSessionPool pool = new CassandraSessionPool(config, - "ks", "store"); - - com.datastax.driver.core.Session driverSession = Mockito.mock( - com.datastax.driver.core.Session.class); - OperationTimedOutException timeout = new OperationTimedOutException( - new InetSocketAddress("127.0.0.1", 9042)); - Mockito.when(driverSession.execute(Mockito.any(Statement.class))) - .thenThrow(timeout); - - CassandraSessionPool.Session session = pool.new Session(); - Whitebox.setInternalState(session, "session", driverSession); - - Assert.assertThrows(BackendException.class, () -> - session.execute("UPDATE counter SET value = value + 1")); - Mockito.verify(driverSession, Mockito.times(1)) - .execute(Mockito.any(Statement.class)); - } - - @Test - public void testExecuteWithRetryAllowsIdempotentTimeoutRetry() { - Configuration conf = new PropertiesConfiguration(); - conf.setProperty( - CassandraOptions.CASSANDRA_RECONNECT_BASE_DELAY.name(), 100L); - conf.setProperty( - CassandraOptions.CASSANDRA_RECONNECT_MAX_DELAY.name(), 1000L); - conf.setProperty( - CassandraOptions.CASSANDRA_QUERY_RETRY_MAX_ATTEMPTS.name(), 3); - conf.setProperty( - CassandraOptions.CASSANDRA_QUERY_RETRY_INTERVAL.name(), 100L); - HugeConfig config = new HugeConfig(conf); - CassandraSessionPool pool = new CassandraSessionPool(config, - "ks", "store"); - - com.datastax.driver.core.Session driverSession = Mockito.mock( - com.datastax.driver.core.Session.class); - ResultSet rs = Mockito.mock(ResultSet.class); - OperationTimedOutException timeout = new OperationTimedOutException( - new InetSocketAddress("127.0.0.1", 9042)); - SimpleStatement statement = new SimpleStatement( - "SELECT now() FROM system.local"); - statement.setIdempotent(true); - Mockito.when(driverSession.execute(statement)) - .thenThrow(timeout) - .thenReturn(rs); - - CassandraSessionPool.Session session = pool.new Session(); - Whitebox.setInternalState(session, "session", driverSession); - - ResultSet result = session.execute(statement); - Assert.assertSame(rs, result); - Mockito.verify(driverSession, Mockito.times(2)).execute(statement); - } - - @Test - public void testCommitAsyncOpensSessionBeforeExecuteAsync() { - Configuration conf = new PropertiesConfiguration(); - conf.setProperty( - CassandraOptions.CASSANDRA_RECONNECT_BASE_DELAY.name(), 100L); - conf.setProperty( - CassandraOptions.CASSANDRA_RECONNECT_MAX_DELAY.name(), 1000L); - conf.setProperty( - CassandraOptions.CASSANDRA_QUERY_RETRY_MAX_ATTEMPTS.name(), 3); - conf.setProperty( - CassandraOptions.CASSANDRA_QUERY_RETRY_INTERVAL.name(), 100L); - HugeConfig config = new HugeConfig(conf); - CassandraSessionPool pool = new CassandraSessionPool(config, - "ks", "store"); - - com.datastax.driver.core.Cluster mockCluster = Mockito.mock( - com.datastax.driver.core.Cluster.class); - com.datastax.driver.core.Session driverSession = Mockito.mock( - com.datastax.driver.core.Session.class); - ResultSetFuture future = Mockito.mock(ResultSetFuture.class); - Mockito.when(mockCluster.isClosed()).thenReturn(false); - Mockito.when(mockCluster.connect(Mockito.anyString())) - .thenReturn(driverSession); - Mockito.when(driverSession.executeAsync(Mockito.any(Statement.class))) - .thenReturn(future); - Whitebox.setInternalState(pool, "cluster", mockCluster); - - CassandraSessionPool.Session session = pool.new Session(); - Statement statement = new SimpleStatement( - "INSERT INTO system.local(key) VALUES ('test')"); - session.add(statement); - - session.commitAsync(); - - Mockito.verify(mockCluster, Mockito.times(1)).connect("ks"); - Mockito.verify(driverSession, Mockito.times(1)).executeAsync(statement); - Mockito.verify(future, Mockito.times(1)).getUninterruptibly(); - Assert.assertFalse(session.hasChanges()); - } - - @Test - public void testReconnectBaseDelayBelowMinimumRejected() { - // The validator on CASSANDRA_RECONNECT_BASE_DELAY is - // rangeInt(100L, Long.MAX_VALUE); values below 100 must be rejected - // at parse time. Setting the property as a String forces HugeConfig - // to run parseConvert() which invokes the range check. - Configuration conf = new PropertiesConfiguration(); - Assert.assertThrows(Exception.class, () -> { - conf.setProperty( - CassandraOptions.CASSANDRA_RECONNECT_BASE_DELAY.name(), - "50"); - new HugeConfig(conf); - }); - } - - @Test - public void testReconnectMaxDelayLessThanBaseRejected() { - // Both values must pass their individual range validators with margin - // (base >= 100, max >= 1000), so the only thing that can throw is the - // E.checkArgument(max >= base) cross-check inside the pool ctor. Set - // all four retry/reconnect properties explicitly so the test does not - // depend on default values changing in CassandraOptions. - Configuration conf = new PropertiesConfiguration(); - conf.setProperty( - CassandraOptions.CASSANDRA_RECONNECT_BASE_DELAY.name(), 10_000L); - conf.setProperty( - CassandraOptions.CASSANDRA_RECONNECT_MAX_DELAY.name(), 2_000L); - conf.setProperty( - CassandraOptions.CASSANDRA_QUERY_RETRY_MAX_ATTEMPTS.name(), 3); - conf.setProperty( - CassandraOptions.CASSANDRA_QUERY_RETRY_INTERVAL.name(), 1_000L); - HugeConfig config = new HugeConfig(conf); - Assert.assertThrows(IllegalArgumentException.class, () -> - new CassandraSessionPool(config, "ks", "store")); - } -} diff --git a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/mysql/MysqlUtilTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/mysql/MysqlUtilTest.java deleted file mode 100644 index 0fcd9fe8f6..0000000000 --- a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/mysql/MysqlUtilTest.java +++ /dev/null @@ -1,59 +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.hugegraph.unit.mysql; - -import org.apache.hugegraph.backend.store.mysql.MysqlUtil; -import org.apache.hugegraph.testutil.Assert; -import org.apache.hugegraph.unit.BaseUnitTest; -import org.junit.Test; - -public class MysqlUtilTest extends BaseUnitTest { - - @Test - public void testEscapeString() { - Assert.assertEquals("abc", MysqlUtil.escapeString("abc")); - Assert.assertEquals("abc\"", MysqlUtil.escapeString("abc\"")); - - Assert.assertEquals("can\\'t", MysqlUtil.escapeString("can't")); - Assert.assertEquals("abc\\n", MysqlUtil.escapeString("abc\n")); - Assert.assertEquals("abc\\r", MysqlUtil.escapeString("abc\r")); - Assert.assertEquals("abc\\\\", MysqlUtil.escapeString("abc\\")); - Assert.assertEquals("abc\\0", MysqlUtil.escapeString("abc\u0000")); - Assert.assertEquals("abc\\Z", MysqlUtil.escapeString("abc\u001a")); - } - - @Test - public void testEscapeAndWrapString() { - Assert.assertEquals("'abc'", MysqlUtil.escapeAndWrapString("abc")); - Assert.assertEquals("'abc\"'", MysqlUtil.escapeAndWrapString("abc\"")); - Assert.assertEquals("''", MysqlUtil.escapeAndWrapString("")); - - Assert.assertEquals("'can\\'t'", - MysqlUtil.escapeAndWrapString("can't")); - Assert.assertEquals("'abc\\n'", - MysqlUtil.escapeAndWrapString("abc\n")); - Assert.assertEquals("'abc\\r'", - MysqlUtil.escapeAndWrapString("abc\r")); - Assert.assertEquals("'abc\\\\'", - MysqlUtil.escapeAndWrapString("abc\\")); - Assert.assertEquals("'abc\\0'", - MysqlUtil.escapeAndWrapString("abc\u0000")); - Assert.assertEquals("'abc\\Z'", - MysqlUtil.escapeAndWrapString("abc\u001a")); - } -} diff --git a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/mysql/WhereBuilderTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/mysql/WhereBuilderTest.java deleted file mode 100644 index c4421c566a..0000000000 --- a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/mysql/WhereBuilderTest.java +++ /dev/null @@ -1,123 +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.hugegraph.unit.mysql; - -import org.apache.hugegraph.backend.query.Condition.RelationType; -import org.apache.hugegraph.backend.store.mysql.WhereBuilder; -import org.apache.hugegraph.exception.NotSupportException; -import org.apache.hugegraph.testutil.Assert; -import org.apache.hugegraph.unit.BaseUnitTest; -import org.junit.Test; - -import com.google.common.collect.ImmutableList; - -public class WhereBuilderTest extends BaseUnitTest { - - @Test - public void testRelation() { - WhereBuilder where = new WhereBuilder(); - where.relation("key1", RelationType.EQ, "value1"); - Assert.assertEquals(" WHERE key1='value1'", where.build().toString()); - Assert.assertEquals(" WHERE key1='value1'", where.toString()); - - where = new WhereBuilder(false); - where.relation("key1", RelationType.EQ, "value1"); - Assert.assertEquals(" key1='value1'", where.build().toString()); - Assert.assertEquals(" key1='value1'", where.toString()); - - where.and().relation("key2", RelationType.EQ, "value2"); - Assert.assertEquals(" key1='value1' AND key2='value2'", - where.toString()); - - where = new WhereBuilder(false); - where.relation("key1", RelationType.NEQ, "value1"); - Assert.assertEquals(" key1!='value1'", where.toString()); - - where = new WhereBuilder(false); - where.relation("key1", RelationType.GT, "value1"); - Assert.assertEquals(" key1>'value1'", where.toString()); - - where = new WhereBuilder(false); - where.relation("key1", RelationType.GTE, "value1"); - Assert.assertEquals(" key1>='value1'", where.toString()); - - where = new WhereBuilder(false); - where.relation("key1", RelationType.LT, "value1"); - Assert.assertEquals(" key1<'value1'", where.toString()); - - where = new WhereBuilder(false); - where.relation("key1", RelationType.LTE, "value1"); - Assert.assertEquals(" key1<='value1'", where.toString()); - - where = new WhereBuilder(false); - where.relation("key1", RelationType.IN, ImmutableList.of("v1", "v2")); - Assert.assertEquals(" key1 IN ('v1', 'v2')", where.toString()); - - Assert.assertThrows(NotSupportException.class, () -> { - new WhereBuilder().relation("k", RelationType.CONTAINS_KEY, "v"); - }); - Assert.assertThrows(NotSupportException.class, () -> { - new WhereBuilder().relation("k", RelationType.CONTAINS_VALUE, "v"); - }); - Assert.assertThrows(NotSupportException.class, () -> { - new WhereBuilder().relation("k", RelationType.NOT_IN, "v"); - }); - Assert.assertThrows(NotSupportException.class, () -> { - new WhereBuilder().relation("k", RelationType.TEXT_CONTAINS, "v"); - }); - Assert.assertThrows(NotSupportException.class, () -> { - new WhereBuilder().relation("k", RelationType.SCAN, "v"); - }); - } - - @Test - public void testAnd() { - WhereBuilder where = new WhereBuilder(false); - where.and(ImmutableList.of("k1", "k2"), ImmutableList.of("v1", "v2")); - Assert.assertEquals(" k1='v1' AND k2='v2'", where.toString()); - - where = new WhereBuilder(false); - where.and(ImmutableList.of("k1", "k2"), "!=", - ImmutableList.of("v1", "v2")); - Assert.assertEquals(" k1!='v1' AND k2!='v2'", where.toString()); - - where = new WhereBuilder(false); - where.and(ImmutableList.of("k1", "k2", "k3"), - ImmutableList.of("=", "!=", ">"), - ImmutableList.of("v1", "v2", 3)); - Assert.assertEquals(" k1='v1' AND k2!='v2' AND k3>3", where.toString()); - - where = new WhereBuilder(false); - where.and(ImmutableList.of("k1", "k2"), "="); - Assert.assertEquals(" k1=? AND k2=?", where.toString()); - } - - @Test - public void testIn() { - WhereBuilder where = new WhereBuilder(false); - where.in("key", ImmutableList.of("v1", "v2", "v3")); - Assert.assertEquals(" key IN ('v1', 'v2', 'v3')", where.toString()); - } - - @Test - public void testGt() { - WhereBuilder where = new WhereBuilder(false); - where.gte(ImmutableList.of("k1", "k2"), ImmutableList.of("v1", "v2")); - Assert.assertEquals(" (k1, k2) >= ('v1', 'v2')", where.toString()); - } -} diff --git a/hugegraph-server/hugegraph-test/src/main/resources/log4j2.xml b/hugegraph-server/hugegraph-test/src/main/resources/log4j2.xml index e943d3a282..30753c2c18 100644 --- a/hugegraph-server/hugegraph-test/src/main/resources/log4j2.xml +++ b/hugegraph-server/hugegraph-test/src/main/resources/log4j2.xml @@ -107,10 +107,6 @@ - - - - @@ -119,10 +115,6 @@ - - - - diff --git a/hugegraph-server/pom.xml b/hugegraph-server/pom.xml index 226199cdc8..a9169591a3 100644 --- a/hugegraph-server/pom.xml +++ b/hugegraph-server/pom.xml @@ -64,13 +64,8 @@ hugegraph-example hugegraph-dist hugegraph-test - hugegraph-cassandra - hugegraph-scylladb hugegraph-rocksdb - hugegraph-mysql - hugegraph-palo hugegraph-hbase - hugegraph-postgresql hugegraph-hstore diff --git a/install-dist/release-docs/LICENSE b/install-dist/release-docs/LICENSE index 0014317824..f12f0b0d78 100644 --- a/install-dist/release-docs/LICENSE +++ b/install-dist/release-docs/LICENSE @@ -253,7 +253,6 @@ The text of each license is also included in licenses/LICENSE-[project].txt. https://central.sonatype.com/artifact/com.github.luben/zstd-jni/1.5.5-1 -> BSD-2-Clause https://central.sonatype.com/artifact/org.latencyutils/LatencyUtils/2.0.3 -> BSD-2-Clause - https://central.sonatype.com/artifact/org.postgresql/postgresql/42.4.3 -> BSD-2-Clause ======================================================================== Third party Apache 2.0 licenses @@ -282,7 +281,6 @@ non-Apache-2.0 license text is required for a bundled component. https://central.sonatype.com/artifact/com.chenlb.mmseg4j/mmseg4j-core/1.10.0 -> Apache 2.0 https://central.sonatype.com/artifact/com.clearspring.analytics/stream/2.5.2 -> Apache 2.0 https://central.sonatype.com/artifact/com.codahale.metrics/metrics-core/3.0.2 -> Apache 2.0 - https://central.sonatype.com/artifact/com.datastax.cassandra/cassandra-driver-core/3.6.0 -> Apache 2.0 https://central.sonatype.com/artifact/com.fasterxml.jackson.core/jackson-annotations/2.13.0 -> Apache 2.0 https://central.sonatype.com/artifact/com.fasterxml.jackson.core/jackson-annotations/2.14.0-rc1 -> Apache 2.0 https://central.sonatype.com/artifact/com.fasterxml.jackson.core/jackson-annotations/2.15.2 -> Apache 2.0 @@ -514,7 +512,6 @@ non-Apache-2.0 license text is required for a bundled component. https://central.sonatype.com/artifact/net.openhft/chronicle-threads/2.20.111 -> Apache 2.0 https://central.sonatype.com/artifact/net.openhft/chronicle-wire/2.20.117 -> Apache 2.0 https://central.sonatype.com/artifact/org.ansj/ansj_seg/5.1.6 -> Apache 2.0 - https://central.sonatype.com/artifact/org.apache.cassandra/cassandra-all/4.0.10 -> Apache 2.0 https://central.sonatype.com/artifact/org.apache.commons/commons-collections4/4.4 -> Apache 2.0 https://central.sonatype.com/artifact/org.apache.commons/commons-compress/1.21 -> Apache 2.0 https://central.sonatype.com/artifact/org.apache.commons/commons-configuration2/2.8.0 -> Apache 2.0 diff --git a/install-dist/release-docs/NOTICE b/install-dist/release-docs/NOTICE index 775f03241c..22ca2676dd 100644 --- a/install-dist/release-docs/NOTICE +++ b/install-dist/release-docs/NOTICE @@ -1112,24 +1112,6 @@ BSD - Scala License Scala Library -======================================================================== - -cassandra NOTICE - -======================================================================== - -Apache Cassandra -Copyright 2009-2022 The Apache Software Foundation - -This product includes software developed by The Apache Software -Foundation (http://www.apache.org/). - -Android Code -Copyright 2005-2008 The Android Open Source Project -This product includes software developed as part of -The Android Open Source Project (http://source.android.com). - - ======================================================================== Groovy NOTICE @@ -1758,28 +1740,6 @@ Components, which can be obtained at: * https://github.com/Polymer/polymer -======================================================================== - -postgres NOTICE - -======================================================================== - -This product contains a modified portion of 'ASM', an open source -Java Bytecode library, which can be obtained at: - - * LICENSE: - * agent/src/main/resources/io/perfmark/agent/third_party/asm/LICENSE (BSD style License) - * HOMEPAGE: - * https://asm.ow2.io/ - - -PostgreSQL Database Management System -(formerly known as Postgres, then as Postgres95) - -Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group - -Portions Copyright (c) 1994, The Regents of the University of California - ======================================================================== proto-google-common-protos NOTICE diff --git a/install-dist/release-docs/licenses/LICENSE-cassandra-all-4.0.10.txt b/install-dist/release-docs/licenses/LICENSE-cassandra-all-4.0.10.txt deleted file mode 100644 index 1b0f46f767..0000000000 --- a/install-dist/release-docs/licenses/LICENSE-cassandra-all-4.0.10.txt +++ /dev/null @@ -1,240 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. - - - APACHE CASSANDRA SUBCOMPONENTS: - - Apache Cassandra includes a number of subcomponents with - separate copyright notices and license terms. Your use of the source - code for these subcomponents is subject to the terms and - conditions of the following licenses. - - This product bundles a file (AbstractIterator.java) from Chronicle-Bytes, - copyright higherfrequencytrading.com, which is available under an - Apache License version 2. - - This product bundles a file (AbstractIterator.java) from Guava, - copyright The Guava Authors, which is available under an - Apache License version 2. - - This product bundles a file (LongTimSort.java) from Android libcore, - copyright The Android Open Source Project, which is available under an - Apache License version 2. - - This product bundles several files (LongTimSort.java) from PATRICIA Trie - copyright Roger Kapsi and Sam Berlin, which is available under an - Apache License version 2. - - This product bundles a file (VIntCoding.java) from Protocol Buffers - copyright Google Inc., which is available under a BSD license. - - Thus product bundles material adapted from Cassandra, The Definitive Guide. - Published by O'Reilly Media, Inc. Copyright Jeff Carpenter and Eben Hewitt - and used with their permission. - - This product bundles The Project Gutenberg EBook of Adventures of - Huckleberry Finn, Complete by Mark Twain (Samuel Clemens), which is in - the public domain. - - This product bundles code (internalOffer) that is written by Doug Lea and - Martin Buchholz available under a Creative Commons zero license. diff --git a/install-dist/release-docs/licenses/LICENSE-cassandra-driver-core-3.6.0.txt b/install-dist/release-docs/licenses/LICENSE-cassandra-driver-core-3.6.0.txt deleted file mode 100644 index d645695673..0000000000 --- a/install-dist/release-docs/licenses/LICENSE-cassandra-driver-core-3.6.0.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. diff --git a/install-dist/release-docs/licenses/LICENSE-postgresql-42.4.3.txt b/install-dist/release-docs/licenses/LICENSE-postgresql-42.4.3.txt deleted file mode 100644 index daa7e320f2..0000000000 --- a/install-dist/release-docs/licenses/LICENSE-postgresql-42.4.3.txt +++ /dev/null @@ -1,33 +0,0 @@ -Copyright (c) 1997, PostgreSQL Global Development Group -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -Additional License files can be found in the 'licenses' folder located in the same directory as the LICENSE file (i.e. this file) - -- Software produced outside the ASF which is available under other licenses (not Apache-2.0) - -BSD-2-Clause -* com.ongres.scram:client:2.1 -* com.ongres.scram:common:2.1 -* com.ongres.stringprep:saslprep:1.1 -* com.ongres.stringprep:stringprep:1.1 diff --git a/install-dist/scripts/dependency/known-dependencies.txt b/install-dist/scripts/dependency/known-dependencies.txt index 326ac3dd76..3b05fbba11 100644 --- a/install-dist/scripts/dependency/known-dependencies.txt +++ b/install-dist/scripts/dependency/known-dependencies.txt @@ -44,8 +44,6 @@ byte-buddy-agent-1.10.5.jar byte-buddy-agent-1.11.6.jar caffeine-2.3.1.jar caffeine-2.5.6.jar -cassandra-all-4.0.10.jar -cassandra-driver-core-3.6.0.jar checker-compat-qual-2.5.5.jar checker-qual-2.0.0.jar checker-qual-3.12.0.jar @@ -486,7 +484,6 @@ perfmark-api-0.23.0.jar perfmark-api-0.25.0.jar picocli-4.3.2.jar pinyin4j-2.5.0.jar -postgresql-42.4.3.jar powermock-api-mockito2-2.0.0-RC.3.jar powermock-api-support-2.0.0-RC.3.jar powermock-classloading-base-2.0.0-RC.3.jar From ef77e86035ceb7dd3a24e73eff6d1267d0d531ed Mon Sep 17 00:00:00 2001 From: legendPei <804141866@qq.com> Date: Sat, 25 Jul 2026 16:41:49 +0800 Subject: [PATCH 02/15] feat(server): clean legacy backend remnants --- README.md | 25 ++++++------ docker/hbase/README.md | 2 +- .../org/apache/hugegraph/cmd/InitStore.java | 38 ++++--------------- 3 files changed, 22 insertions(+), 43 deletions(-) diff --git a/README.md b/README.md index f24f6f7bfd..25b2f40f6d 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ achieved through the powerful [Gremlin](https://tinkerpop.apache.org/gremlin.htm - **Schema Metadata Management**: VertexLabel, EdgeLabel, PropertyKey, and IndexLabel - **Multi-type Indexes**: Exact query, range query, and complex conditions combination query -- **Plug-in Backend Store Framework**: Mainly supports `RocksDB`/`HStore` + `HBase`; other backends available in [legacy versions](https://hugegraph.apache.org/docs/download/download/) ≤ `1.5.0` (MySQL/PostgreSQL/Cassandra...) +- **Plug-in Backend Store Framework**: Supports `RocksDB`, `HStore`, `HBase`, and `Memory`. Versions earlier than `1.7.0` included additional, now-removed backends. - **Big Data Integration**: Seamless integration with `Flink`/`Spark`/`HDFS` - **Complete Graph Ecosystem**: In/out-memory Graph Computing + Graph Visualization & Tools + Graph Learning & AI - **Dual Query Language Support**: [Gremlin](https://tinkerpop.apache.org/gremlin.html) (via [Apache TinkerPop 3](https://tinkerpop.apache.org/)) and [Cypher](https://en.wikipedia.org/wiki/Cypher_(query_language)) (OpenCypher) @@ -78,11 +78,11 @@ HugeGraph supports both **standalone** and **distributed** deployments: ┌────────────────────────────────┼────────────────────────────────┐ │ │ │ ┌────────────▼────────────┐ ┌───────────────▼───────────────┐ ┌───────────▼──────────┐ -│ Standalone Mode │ │ Distributed Mode │ │ Legacy Backends │ -│ ┌───────────────────┐ │ │ ┌─────────────────────────┐ │ │ (≤v1.5) │ -│ │ RocksDB │ │ │ │ HugeGraph-PD │ │ │ MySQL │ PostgreSQL │ -│ │ (embedded) │ │ │ │ (Raft, 3-5 nodes) │ │ │ Cassandra │ -│ └───────────────────┘ │ │ │ :8620/:8686 │ │ │ HBase (≤v1.7) │ +│ Standalone Mode │ │ Distributed Mode │ │ Supported Backends │ +│ ┌───────────────────┐ │ │ ┌─────────────────────────┐ │ │ RocksDB │ Memory │ +│ │ RocksDB │ │ │ │ HugeGraph-PD │ │ │ HBase │ HStore │ +│ │ (embedded) │ │ │ │ (Raft, 3-5 nodes) │ │ │ │ +│ └───────────────────┘ │ │ │ :8620/:8686 │ │ │ │ │ │ │ └────────────┬────────────┘ │ └──────────────────────┘ │ Use Case: │ │ │ │ │ Development/Testing │ │ ┌────────────▼────────────┐ │ @@ -148,18 +148,19 @@ flowchart TB PD <--> STORE end - subgraph Legacy["Legacy Backends (≤v1.5)"] - MYSQL[(MySQL)] - PG[(PostgreSQL)] - CASS[(Cassandra)] - HBASE[(HBase, ≤v1.7)] + subgraph Backends["Supported Backends"] + HBASE[(HBase)] + HSTORE[(HStore)] + MEMORY[(Memory)] end end Clients --> Server CORE --> ROCKS CORE --> PD - CORE -.-> Legacy + CORE --> HBASE + CORE --> HSTORE + CORE --> MEMORY style Server fill:#e1f5ff style Distributed fill:#fff4e1 diff --git a/docker/hbase/README.md b/docker/hbase/README.md index fd72514602..aa6fcd2870 100644 --- a/docker/hbase/README.md +++ b/docker/hbase/README.md @@ -158,7 +158,7 @@ After either path is up, run the shared tests below. - Base URL: `http://localhost:8080` - Graph target name: `hugegraph` -- Storage backend: persistent (HBase/Cassandra/RocksDB) +- Storage backend: persistent (HBase/RocksDB/HStore) --- diff --git a/hugegraph-server/hugegraph-dist/src/main/java/org/apache/hugegraph/cmd/InitStore.java b/hugegraph-server/hugegraph-dist/src/main/java/org/apache/hugegraph/cmd/InitStore.java index f68dfd1325..fc13706ad5 100644 --- a/hugegraph-server/hugegraph-dist/src/main/java/org/apache/hugegraph/cmd/InitStore.java +++ b/hugegraph-server/hugegraph-dist/src/main/java/org/apache/hugegraph/cmd/InitStore.java @@ -18,12 +18,10 @@ package org.apache.hugegraph.cmd; import java.util.ArrayList; -import java.util.Collection; import java.util.List; import java.util.Map; import java.util.Objects; -import org.apache.commons.collections.map.MultiValueMap; import org.apache.hugegraph.HugeFactory; import org.apache.hugegraph.HugeGraph; import org.apache.hugegraph.auth.StandardAuthenticator; @@ -49,17 +47,6 @@ public class InitStore { // A shorter interval can cause initialization state mismatches private static final long RETRY_INTERVAL = 5000; - private static final MultiValueMap EXCEPTIONS = new MultiValueMap(); - - static { - EXCEPTIONS.put("OperationTimedOutException", - "Timed out waiting for server response"); - EXCEPTIONS.put("NoHostAvailableException", - "All host(s) tried for query failed"); - EXCEPTIONS.put("InvalidQueryException", "does not exist"); - EXCEPTIONS.put("InvalidQueryException", "unconfigured table"); - } - public static void main(String[] args) throws Exception { E.checkArgument(args.length == 1, "HugeGraph init-store need to pass the config file " + @@ -132,30 +119,21 @@ private static HugeGraph initGraph(String configPath) throws Exception { private static void initBackend(final HugeGraph graph) throws InterruptedException { int retries = RETRIES; - retry: - do { + while (true) { try { graph.initBackend(); } catch (Exception e) { String clz = e.getClass().getSimpleName(); String message = e.getMessage(); - if (EXCEPTIONS.containsKey(clz) && retries > 0) { - @SuppressWarnings("unchecked") - Collection keywords = EXCEPTIONS.getCollection(clz); - for (String keyword : keywords) { - if (message.contains(keyword)) { - LOG.info("Init failed with exception '{} : {}', " + - "retry {}...", - clz, message, RETRIES - retries + 1); - - Thread.sleep(RETRY_INTERVAL); - continue retry; - } - } + if (retries-- > 0) { + LOG.info("Init failed with exception '{} : {}', retry {}...", + clz, message, RETRIES - retries); + Thread.sleep(RETRY_INTERVAL); + continue; } throw e; } - break; - } while (retries-- > 0); + return; + } } } From 3a62c5eb1774eaeaa1214ff787f40eaa66f19db4 Mon Sep 17 00:00:00 2001 From: legendPei <804141866@qq.com> Date: Sat, 25 Jul 2026 16:45:16 +0800 Subject: [PATCH 03/15] feat(server): clarify legacy backend support --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 25b2f40f6d..d8d966ddb3 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ achieved through the powerful [Gremlin](https://tinkerpop.apache.org/gremlin.htm - **Schema Metadata Management**: VertexLabel, EdgeLabel, PropertyKey, and IndexLabel - **Multi-type Indexes**: Exact query, range query, and complex conditions combination query -- **Plug-in Backend Store Framework**: Supports `RocksDB`, `HStore`, `HBase`, and `Memory`. Versions earlier than `1.7.0` included additional, now-removed backends. +- **Plug-in Backend Store Framework**: Since `1.7.0`, supported backends are `RocksDB`, `HStore`, `HBase`, and `Memory`. Historical versions earlier than `1.7.0` also supported MySQL, PostgreSQL, Cassandra, ScyllaDB, and Palo. - **Big Data Integration**: Seamless integration with `Flink`/`Spark`/`HDFS` - **Complete Graph Ecosystem**: In/out-memory Graph Computing + Graph Visualization & Tools + Graph Learning & AI - **Dual Query Language Support**: [Gremlin](https://tinkerpop.apache.org/gremlin.html) (via [Apache TinkerPop 3](https://tinkerpop.apache.org/)) and [Cypher](https://en.wikipedia.org/wiki/Cypher_(query_language)) (OpenCypher) From 2e3d7036fd77b389fbea3c7bb7382375429b48bb Mon Sep 17 00:00:00 2001 From: legendPei <804141866@qq.com> Date: Sat, 25 Jul 2026 16:00:43 +0800 Subject: [PATCH 04/15] feat(server): remove legacy backends --- .../src/main/resources/jar.txt | 5 - hugegraph-server/AGENTS.md | 13 +- hugegraph-server/hugegraph-api/pom.xml | 2 +- hugegraph-server/hugegraph-cassandra/pom.xml | 108 -- .../driver/core/querybuilder/Clauses.java | 88 -- .../cassandra/CassandraBackendEntry.java | 41 - .../cassandra/CassandraEntryIterator.java | 195 ---- .../store/cassandra/CassandraFeatures.java | 137 --- .../store/cassandra/CassandraMetrics.java | 324 ------ .../store/cassandra/CassandraOptions.java | 176 ---- .../store/cassandra/CassandraSerializer.java | 225 ---- .../store/cassandra/CassandraSessionPool.java | 494 --------- .../store/cassandra/CassandraShard.java | 319 ------ .../store/cassandra/CassandraStore.java | 814 -------------- .../cassandra/CassandraStoreProvider.java | 75 -- .../store/cassandra/CassandraTable.java | 679 ------------ .../store/cassandra/CassandraTables.java | 995 ------------------ .../hugegraph/backend/query/Condition.java | 4 +- .../apache/hugegraph/backend/store/Shard.java | 2 +- .../backend/tx/GraphTransaction.java | 5 +- .../apache/hugegraph/config/CoreOptions.java | 4 +- .../security/HugeSecurityManager.java | 41 +- .../apache/hugegraph/task/TaskCallable.java | 10 +- .../example/docker-compose-cassandra.yml | 61 -- hugegraph-server/hugegraph-dist/pom.xml | 62 +- .../src/assembly/static/conf/log4j2.xml | 6 - .../src/assembly/travis/install-backend.sh | 17 - .../src/assembly/travis/install-cassandra.sh | 44 - .../travis/install-mysql-via-docker.sh | 34 - .../src/assembly/travis/install-mysql.sh | 38 - .../travis/install-postgresql-via-docker.sh | 36 - .../src/assembly/travis/install-postgresql.sh | 33 - .../src/assembly/travis/install-scylladb.sh | 65 -- .../src/assembly/travis/mysql.cnf | 37 - .../src/assembly/travis/run-api-test.sh | 4 - .../org/apache/hugegraph/cmd/InitStore.java | 4 +- .../src/main/resources/log4j2.xml | 8 - .../apache/hugegraph/example/Example1.java | 2 +- .../hugegraph/example/PerfExample1.java | 13 +- .../hugegraph/example/PerfExample2.java | 13 +- .../src/main/resources/log4j2.xml | 8 - hugegraph-server/hugegraph-mysql/pom.xml | 49 - .../store/mysql/MysqlBackendEntry.java | 41 - .../store/mysql/MysqlEntryIterator.java | 197 ---- .../backend/store/mysql/MysqlFeatures.java | 131 --- .../backend/store/mysql/MysqlMetrics.java | 32 - .../backend/store/mysql/MysqlOptions.java | 117 -- .../backend/store/mysql/MysqlSerializer.java | 175 --- .../backend/store/mysql/MysqlSessions.java | 546 ---------- .../backend/store/mysql/MysqlStore.java | 513 --------- .../store/mysql/MysqlStoreProvider.java | 76 -- .../backend/store/mysql/MysqlTable.java | 847 --------------- .../backend/store/mysql/MysqlTables.java | 667 ------------ .../backend/store/mysql/MysqlUtil.java | 129 --- .../backend/store/mysql/ResultSetWrapper.java | 62 -- .../backend/store/mysql/WhereBuilder.java | 295 ------ hugegraph-server/hugegraph-palo/pom.xml | 50 - .../backend/store/palo/PaloFeatures.java | 134 --- .../backend/store/palo/PaloFile.java | 192 ---- .../backend/store/palo/PaloHttpClient.java | 75 -- .../backend/store/palo/PaloLoadInfo.java | 190 ---- .../backend/store/palo/PaloOptions.java | 108 -- .../backend/store/palo/PaloSerializer.java | 45 - .../backend/store/palo/PaloSessions.java | 317 ------ .../backend/store/palo/PaloStore.java | 50 - .../backend/store/palo/PaloStoreProvider.java | 175 --- .../backend/store/palo/PaloTable.java | 113 -- .../backend/store/palo/PaloTables.java | 472 --------- hugegraph-server/hugegraph-postgresql/pom.xml | 48 - .../store/postgresql/PostgresqlOptions.java | 49 - .../postgresql/PostgresqlSerializer.java | 58 - .../store/postgresql/PostgresqlSessions.java | 135 --- .../store/postgresql/PostgresqlStore.java | 35 - .../postgresql/PostgresqlStoreProvider.java | 221 ---- .../store/postgresql/PostgresqlTable.java | 170 --- .../store/postgresql/PostgresqlTables.java | 291 ----- hugegraph-server/hugegraph-scylladb/pom.xml | 39 - .../store/scylladb/ScyllaDBFeatures.java | 33 - .../store/scylladb/ScyllaDBMetrics.java | 69 -- .../store/scylladb/ScyllaDBStoreProvider.java | 173 --- .../store/scylladb/ScyllaDBTablesWithMV.java | 301 ------ hugegraph-server/hugegraph-test/pom.xml | 27 - .../apache/hugegraph/api/MetricsApiTest.java | 124 --- .../apache/hugegraph/core/EdgeCoreTest.java | 39 +- .../apache/hugegraph/core/VertexCoreTest.java | 39 +- .../apache/hugegraph/tinkerpop/TestGraph.java | 2 +- .../apache/hugegraph/unit/UnitTestSuite.java | 10 - .../unit/cassandra/CassandraTest.java | 437 -------- .../hugegraph/unit/mysql/MysqlUtilTest.java | 59 -- .../unit/mysql/WhereBuilderTest.java | 123 --- .../src/main/resources/log4j2.xml | 8 - hugegraph-server/pom.xml | 5 - install-dist/release-docs/LICENSE | 3 - install-dist/release-docs/NOTICE | 40 - .../licenses/LICENSE-cassandra-all-4.0.10.txt | 240 ----- .../LICENSE-cassandra-driver-core-3.6.0.txt | 202 ---- .../licenses/LICENSE-postgresql-42.4.3.txt | 33 - .../scripts/dependency/known-dependencies.txt | 3 - 98 files changed, 50 insertions(+), 14005 deletions(-) delete mode 100644 hugegraph-server/hugegraph-cassandra/pom.xml delete mode 100644 hugegraph-server/hugegraph-cassandra/src/main/java/com/datastax/driver/core/querybuilder/Clauses.java delete mode 100644 hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraBackendEntry.java delete mode 100644 hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraEntryIterator.java delete mode 100644 hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraFeatures.java delete mode 100644 hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraMetrics.java delete mode 100644 hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraOptions.java delete mode 100644 hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraSerializer.java delete mode 100644 hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraSessionPool.java delete mode 100644 hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraShard.java delete mode 100644 hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraStore.java delete mode 100644 hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraStoreProvider.java delete mode 100644 hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraTable.java delete mode 100644 hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraTables.java delete mode 100644 hugegraph-server/hugegraph-dist/docker/example/docker-compose-cassandra.yml delete mode 100755 hugegraph-server/hugegraph-dist/src/assembly/travis/install-cassandra.sh delete mode 100755 hugegraph-server/hugegraph-dist/src/assembly/travis/install-mysql-via-docker.sh delete mode 100755 hugegraph-server/hugegraph-dist/src/assembly/travis/install-mysql.sh delete mode 100755 hugegraph-server/hugegraph-dist/src/assembly/travis/install-postgresql-via-docker.sh delete mode 100755 hugegraph-server/hugegraph-dist/src/assembly/travis/install-postgresql.sh delete mode 100755 hugegraph-server/hugegraph-dist/src/assembly/travis/install-scylladb.sh delete mode 100644 hugegraph-server/hugegraph-dist/src/assembly/travis/mysql.cnf delete mode 100644 hugegraph-server/hugegraph-mysql/pom.xml delete mode 100644 hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlBackendEntry.java delete mode 100644 hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlEntryIterator.java delete mode 100644 hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlFeatures.java delete mode 100644 hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlMetrics.java delete mode 100644 hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlOptions.java delete mode 100644 hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlSerializer.java delete mode 100644 hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlSessions.java delete mode 100644 hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlStore.java delete mode 100644 hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlStoreProvider.java delete mode 100644 hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlTable.java delete mode 100644 hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlTables.java delete mode 100644 hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlUtil.java delete mode 100644 hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/ResultSetWrapper.java delete mode 100644 hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/WhereBuilder.java delete mode 100644 hugegraph-server/hugegraph-palo/pom.xml delete mode 100644 hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloFeatures.java delete mode 100644 hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloFile.java delete mode 100644 hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloHttpClient.java delete mode 100644 hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloLoadInfo.java delete mode 100644 hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloOptions.java delete mode 100644 hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloSerializer.java delete mode 100644 hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloSessions.java delete mode 100644 hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloStore.java delete mode 100644 hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloStoreProvider.java delete mode 100644 hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloTable.java delete mode 100644 hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloTables.java delete mode 100644 hugegraph-server/hugegraph-postgresql/pom.xml delete mode 100644 hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlOptions.java delete mode 100644 hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlSerializer.java delete mode 100644 hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlSessions.java delete mode 100644 hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlStore.java delete mode 100644 hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlStoreProvider.java delete mode 100644 hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlTable.java delete mode 100644 hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlTables.java delete mode 100644 hugegraph-server/hugegraph-scylladb/pom.xml delete mode 100644 hugegraph-server/hugegraph-scylladb/src/main/java/org/apache/hugegraph/backend/store/scylladb/ScyllaDBFeatures.java delete mode 100644 hugegraph-server/hugegraph-scylladb/src/main/java/org/apache/hugegraph/backend/store/scylladb/ScyllaDBMetrics.java delete mode 100644 hugegraph-server/hugegraph-scylladb/src/main/java/org/apache/hugegraph/backend/store/scylladb/ScyllaDBStoreProvider.java delete mode 100644 hugegraph-server/hugegraph-scylladb/src/main/java/org/apache/hugegraph/backend/store/scylladb/ScyllaDBTablesWithMV.java delete mode 100644 hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/cassandra/CassandraTest.java delete mode 100644 hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/mysql/MysqlUtilTest.java delete mode 100644 hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/mysql/WhereBuilderTest.java delete mode 100644 install-dist/release-docs/licenses/LICENSE-cassandra-all-4.0.10.txt delete mode 100644 install-dist/release-docs/licenses/LICENSE-cassandra-driver-core-3.6.0.txt delete mode 100644 install-dist/release-docs/licenses/LICENSE-postgresql-42.4.3.txt diff --git a/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/resources/jar.txt b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/resources/jar.txt index 7a566545ce..596b6f5340 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/resources/jar.txt +++ b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/resources/jar.txt @@ -1,14 +1,9 @@ hugegraph-api-${revision}.jar -hugegraph-cassandra-${revision}.jar hugegraph-common-${revision}.jar hugegraph-core-${revision}.jar hugegraph-dist-${revision}.jar hugegraph-hbase-${revision}.jar hugegraph-hstore-${revision}.jar -hugegraph-mysql-${revision}.jar -hugegraph-palo-${revision}.jar -hugegraph-postgresql-${revision}.jar hugegraph-rocksdb-${revision}.jar hugegraph-rpc-${revision}.jar -hugegraph-scylladb-${revision}.jar hugegraph-struct-${revision}.jar diff --git a/hugegraph-server/AGENTS.md b/hugegraph-server/AGENTS.md index c5b58591cb..0365dd6965 100644 --- a/hugegraph-server/AGENTS.md +++ b/hugegraph-server/AGENTS.md @@ -8,7 +8,7 @@ HugeGraph Server is the graph engine layer of Apache HugeGraph, consisting of: - **REST API Layer** (hugegraph-api): RESTful APIs for graph operations, Gremlin/Cypher queries, schema management, and authentication - **Graph Engine Layer** (hugegraph-core): TinkerPop 3 implementation, schema management, traversal optimization, task scheduling - **Backend Interface**: Abstraction layer for pluggable storage backends -- **Storage Backend Implementations**: RocksDB (default), HStore (distributed), and legacy backends (MySQL, PostgreSQL, Cassandra, ScyllaDB, HBase, Palo) +- **Storage Backend Implementations**: RocksDB (default), HStore (distributed), HBase, and Memory Technology: Java 11+, Maven 3.5+, Apache TinkerPop 3.5.1, Jersey 3.0 (REST), gRPC (distributed communication) @@ -50,7 +50,7 @@ mvn checkstyle:check - `memory`: In-memory backend (default for tests) - `rocksdb`: RocksDB backend - `hbase`: HBase backend -- `mysql`, `postgresql`, `cassandra`, `scylladb`, `palo`: Other backends +- `hstore`: HStore backend ```bash # Unit tests (from hugegraph-server/) @@ -78,7 +78,7 @@ All tests are in `hugegraph-test/` which depends on all other modules. Tests are ## Module Structure -Multi-module Maven project with 13 submodules: +Multi-module Maven project with 8 submodules: ``` hugegraph-server/ @@ -86,12 +86,7 @@ hugegraph-server/ ├── hugegraph-api # REST API, Gremlin/Cypher endpoints, authentication ├── hugegraph-rocksdb # RocksDB backend (default, embedded) ├── hugegraph-hstore # HStore backend (distributed, production) -├── hugegraph-mysql # MySQL backend (legacy) -├── hugegraph-postgresql # PostgreSQL backend (legacy) -├── hugegraph-cassandra # Cassandra backend (legacy) -├── hugegraph-scylladb # ScyllaDB backend (legacy) -├── hugegraph-hbase # HBase backend (legacy) -├── hugegraph-palo # Palo backend (legacy) +├── hugegraph-hbase # HBase backend ├── hugegraph-dist # Distribution packaging, scripts, configs ├── hugegraph-test # All test suites └── hugegraph-example # Example code diff --git a/hugegraph-server/hugegraph-api/pom.xml b/hugegraph-server/hugegraph-api/pom.xml index 8fd6821ca9..f1a8b918bd 100644 --- a/hugegraph-server/hugegraph-api/pom.xml +++ b/hugegraph-server/hugegraph-api/pom.xml @@ -70,7 +70,7 @@ com.alipay.sofa hessian - + io.netty netty-all diff --git a/hugegraph-server/hugegraph-cassandra/pom.xml b/hugegraph-server/hugegraph-cassandra/pom.xml deleted file mode 100644 index a99dbf4a62..0000000000 --- a/hugegraph-server/hugegraph-cassandra/pom.xml +++ /dev/null @@ -1,108 +0,0 @@ - - - - - org.apache.hugegraph - hugegraph-server - ${revision} - ../pom.xml - - 4.0.0 - - hugegraph-cassandra - - - - org.apache.hugegraph - hugegraph-core - ${revision} - - - org.apache.cassandra - cassandra-all - 4.0.10 - - - org.slf4j - log4j-over-slf4j - - - org.slf4j - jcl-over-slf4j - - - ch.qos.logback - logback-core - - - ch.qos.logback - logback-classic - - - it.unimi.dsi - fastutil - - - org.apache.cassandra - cassandra-thrift - - - org.eclipse.jdt.core.compiler - ecj - - - org.jboss.logging - jboss-logging - - - - - com.datastax.cassandra - cassandra-driver-core - 3.6.0 - - - io.netty - netty-handler - - - com.github.jnr - jnr-posix - - - - - - io.netty - netty-all - 4.1.44.Final - - - - - - - org.apache.maven.plugins - maven-clean-plugin - - - - - diff --git a/hugegraph-server/hugegraph-cassandra/src/main/java/com/datastax/driver/core/querybuilder/Clauses.java b/hugegraph-server/hugegraph-cassandra/src/main/java/com/datastax/driver/core/querybuilder/Clauses.java deleted file mode 100644 index 502fb152b8..0000000000 --- a/hugegraph-server/hugegraph-cassandra/src/main/java/com/datastax/driver/core/querybuilder/Clauses.java +++ /dev/null @@ -1,88 +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 com.datastax.driver.core.querybuilder; - -import java.util.List; - -import com.datastax.driver.core.CodecRegistry; -import com.datastax.driver.core.querybuilder.Clause.ContainsClause; -import com.datastax.driver.core.querybuilder.Clause.ContainsKeyClause; - -public class Clauses { - - public static boolean needAllowFiltering(Clause clause) { - return clause instanceof ContainsKeyClause || clause instanceof ContainsClause; - } - - public static Clause and(Clause left, Clause right) { - return new AndClause(left, right); - } - - public static Clause in(String name, List values) { - return new Clause.InClause(name, values); - } - - static class BinClause extends Clause { - - private final Clause left; - private final String op; - private final Clause right; - - public BinClause(Clause left, String op, Clause right) { - this.left = left; - this.op = op; - this.right = right; - } - - @Override - String name() { - return null; - } - - @Override - Object firstValue() { - return null; - } - - @Override - boolean containsBindMarker() { - return Utils.containsBindMarker(this.left) || Utils.containsBindMarker(this.right); - } - - @Override - void appendTo(StringBuilder sb, List variables, - CodecRegistry codecRegistry) { - // NOTE: '(? AND ?)' is not supported by Cassandra: - // SyntaxError: line xx missing ')' at 'AND' - // sb.append("("); - this.left.appendTo(sb, variables, codecRegistry); - sb.append(" "); - sb.append(this.op); - sb.append(" "); - this.right.appendTo(sb, variables, codecRegistry); - // sb.append(")"); - } - } - - static class AndClause extends BinClause { - - public AndClause(Clause left, Clause right) { - super(left, "AND", right); - } - } -} diff --git a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraBackendEntry.java b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraBackendEntry.java deleted file mode 100644 index 18a923b10e..0000000000 --- a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraBackendEntry.java +++ /dev/null @@ -1,41 +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.hugegraph.backend.store.cassandra; - -import org.apache.hugegraph.backend.id.Id; -import org.apache.hugegraph.backend.serializer.TableBackendEntry; -import org.apache.hugegraph.type.HugeType; - -public class CassandraBackendEntry extends TableBackendEntry { - - public CassandraBackendEntry(Id id) { - super(id); - } - - public CassandraBackendEntry(HugeType type) { - this(type, null); - } - - public CassandraBackendEntry(HugeType type, Id id) { - this(new Row(type, id)); - } - - public CassandraBackendEntry(TableBackendEntry.Row row) { - super(row); - } -} diff --git a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraEntryIterator.java b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraEntryIterator.java deleted file mode 100644 index 2f057007f1..0000000000 --- a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraEntryIterator.java +++ /dev/null @@ -1,195 +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.hugegraph.backend.store.cassandra; - -import java.util.Iterator; -import java.util.List; -import java.util.function.BiFunction; - -import org.apache.hugegraph.backend.page.PageState; -import org.apache.hugegraph.backend.query.Query; -import org.apache.hugegraph.backend.store.BackendEntry; -import org.apache.hugegraph.backend.store.BackendEntryIterator; -import org.apache.hugegraph.util.E; - -import com.datastax.driver.core.ExecutionInfo; -import com.datastax.driver.core.PagingState; -import com.datastax.driver.core.ResultSet; -import com.datastax.driver.core.Row; - -public class CassandraEntryIterator extends BackendEntryIterator { - - private final ResultSet results; - private final Iterator rows; - private final BiFunction merger; - - private int fetchedPageSize; - private long expected; - private BackendEntry next; - - public CassandraEntryIterator(ResultSet results, Query query, - BiFunction merger) { - super(query); - this.results = results; - this.rows = results.iterator(); - this.merger = merger; - - this.fetchedPageSize = results.getAvailableWithoutFetching(); - this.next = null; - - if (query.paging()) { - assert query.offset() == 0L; - assert query.limit() >= 0L || query.noLimit() : query.limit(); - // Skip page offset - this.expected = PageState.fromString(query.page()).offset(); - this.skipPageOffset(query.page()); - // Check the number of available rows - E.checkState(this.fetchedPageSize <= query.limit(), - "Unexpected fetched page size: %s", - this.fetchedPageSize); - if (results.isFullyFetched()) { - /* - * All results fetched - * NOTE: it may be enough or not enough for the entire page - */ - this.expected = this.fetchedPageSize; - } else { - /* - * Not fully fetched, that's fetchedPageSize == query.limit(), - * - * NOTE: but there may be fetchedPageSize < query.limit(), means - * not fetched the entire page (ScyllaDB may go here #1340), - * try to fetch next page later until got the expected count. - * Can simulate by: `select.setFetchSize(total - 1)` - */ - this.expected = query.total(); - } - } else { - this.expected = query.total(); - this.skipOffset(); - } - } - - @Override - public void close() throws Exception { - // pass - } - - @Override - protected final boolean fetch() { - assert this.current == null; - if (this.next != null) { - this.current = this.next; - this.next = null; - } - - while (this.expected > 0L && this.rows.hasNext()) { - // Limit expected count, due to rows.hasNext() will fetch next page - this.expected--; - Row row = this.rows.next(); - if (this.query.paging()) { - // Update fetchedPageSize if auto fetch the next page - if (this.expected > 0L && this.availableLocal() == 0) { - if (this.rows.hasNext()) { - this.fetchedPageSize = this.availableLocal(); - } - } - } - BackendEntry merged = this.merger.apply(this.current, row); - if (this.current == null) { - // The first time to read - this.current = merged; - } else if (merged == this.current) { - // The next entry belongs to the current entry - assert merged != null; - } else { - // New entry - assert this.next == null; - this.next = merged; - break; - } - } - return this.current != null; - } - - @Override - protected final long sizeOf(BackendEntry entry) { - CassandraBackendEntry e = (CassandraBackendEntry) entry; - int subRowsSize = e.subRows().size(); - return subRowsSize > 0 ? subRowsSize : 1L; - } - - @Override - protected final long skip(BackendEntry entry, long skip) { - CassandraBackendEntry e = (CassandraBackendEntry) entry; - E.checkState(e.subRows().size() > skip, "Invalid entry to skip"); - for (long i = 0; i < skip; i++) { - e.subRows().remove(0); - } - return e.subRows().size(); - } - - @Override - protected PageState pageState() { - byte[] position; - int offset = 0; - int count = (int) this.count(); - assert this.fetched() == count; - int extra = this.availableLocal(); - List infos = this.results.getAllExecutionInfo(); - if (extra > 0 && infos.size() >= 2) { - /* - * Go back to the previous page if there are still available - * results fetched to local memory but not consumed, and set page - * offset with consumed amount of results. - * - * Safely, we should get the remaining size of the current page by: - * `Whitebox.getInternalState(results, "currentPage").size()` - * instead of - * `results.getAvailableWithoutFetching()` - */ - ExecutionInfo previous = infos.get(infos.size() - 2); - PagingState page = previous.getPagingState(); - position = page.toBytes(); - offset = this.fetchedPageSize - extra; - } else { - PagingState page = this.results.getExecutionInfo().getPagingState(); - if (page == null || this.expected > 0L) { - // Call isExhausted() will lead to try to fetch the next page - E.checkState(this.results.isExhausted(), - "Unexpected paging state with expected=%s, " + - "ensure consume all the fetched results before " + - "calling pageState()", this.expected); - position = PageState.EMPTY_BYTES; - } else { - /* - * Exist page position which used to fetch the next page. - * Maybe it happens to the last page (that's the position is - * at the end of results and next page is empty) - */ - position = page.toBytes(); - } - } - - return new PageState(position, offset, count); - } - - private int availableLocal() { - return this.results.getAvailableWithoutFetching(); - } -} diff --git a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraFeatures.java b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraFeatures.java deleted file mode 100644 index 0993fde1be..0000000000 --- a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraFeatures.java +++ /dev/null @@ -1,137 +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.hugegraph.backend.store.cassandra; - -import org.apache.hugegraph.backend.store.BackendFeatures; - -public class CassandraFeatures implements BackendFeatures { - - @Override - public boolean supportsFatherAndSubEdgeLabel() { - return false; - } - - @Override - public boolean supportsScanToken() { - return true; - } - - @Override - public boolean supportsScanKeyPrefix() { - return false; - } - - @Override - public boolean supportsScanKeyRange() { - return false; - } - - @Override - public boolean supportsQuerySchemaByName() { - // Cassandra support secondary index - return true; - } - - @Override - public boolean supportsQueryByLabel() { - // Cassandra support secondary index - return true; - } - - @Override - public boolean supportsQueryWithInCondition() { - return true; - } - - @Override - public boolean supportsQueryWithRangeCondition() { - return true; - } - - @Override - public boolean supportsQueryWithOrderBy() { - return true; - } - - @Override - public boolean supportsQueryWithContains() { - return true; - } - - @Override - public boolean supportsQueryWithContainsKey() { - return true; - } - - @Override - public boolean supportsQueryByPage() { - return true; - } - - @Override - public boolean supportsQuerySortByInputIds() { - return false; - } - - @Override - public boolean supportsDeleteEdgeByLabel() { - return true; - } - - @Override - public boolean supportsUpdateVertexProperty() { - return true; - } - - @Override - public boolean supportsMergeVertexProperty() { - return false; - } - - @Override - public boolean supportsUpdateEdgeProperty() { - return true; - } - - @Override - public boolean supportsTransaction() { - // Cassandra support tx(atomicity level) with batch API - // https://docs.datastax.com/en/cassandra/2.1/cassandra/dml/dml_atomicity_c.html - return true; - } - - @Override - public boolean supportsNumberType() { - return true; - } - - @Override - public boolean supportsAggregateProperty() { - return false; - } - - @Override - public boolean supportsTtl() { - return true; - } - - @Override - public boolean supportsOlapProperties() { - return true; - } -} diff --git a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraMetrics.java b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraMetrics.java deleted file mode 100644 index 400efd024c..0000000000 --- a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraMetrics.java +++ /dev/null @@ -1,324 +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.hugegraph.backend.store.cassandra; - -import java.io.IOException; -import java.lang.management.MemoryUsage; -import java.net.Inet4Address; -import java.net.Inet6Address; -import java.net.InetAddress; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.function.Function; - -import org.apache.cassandra.metrics.CassandraMetricsRegistry.JmxCounterMBean; -import org.apache.cassandra.metrics.CassandraMetricsRegistry.JmxTimerMBean; -import org.apache.cassandra.tools.NodeProbe; -import org.apache.cassandra.tools.nodetool.Compact; -import org.apache.hugegraph.backend.store.BackendMetrics; -import org.apache.hugegraph.backend.store.BackendStoreProvider; -import org.apache.hugegraph.backend.store.BackendTable; -import org.apache.hugegraph.backend.store.cassandra.CassandraTables.Edge; -import org.apache.hugegraph.backend.store.cassandra.CassandraTables.Vertex; -import org.apache.hugegraph.config.HugeConfig; -import org.apache.hugegraph.testutil.Whitebox; -import org.apache.hugegraph.util.E; -import org.apache.hugegraph.util.InsertionOrderUtil; -import org.apache.hugegraph.util.Log; -import org.apache.hugegraph.util.UnitUtil; -import org.apache.tinkerpop.gremlin.util.NumberHelper; -import org.slf4j.Logger; - -import com.datastax.driver.core.Cluster; -import com.datastax.driver.core.Host; -import com.google.common.collect.ImmutableList; - -public class CassandraMetrics implements BackendMetrics { - - private static final Logger LOG = Log.logger(CassandraMetrics.class); - - private final Cluster cluster; - private final int port; - private final String username; - private final String password; - - private final String keyspace; - private final List tables; - - public CassandraMetrics(HugeConfig conf, - CassandraSessionPool sessions, - String keyspace) { - E.checkNotNull(conf, "config"); - E.checkArgumentNotNull(sessions, - "Cassandra sessions have not been initialized"); - this.cluster = sessions.cluster(); - this.port = conf.get(CassandraOptions.CASSANDRA_JMX_PORT); - this.username = conf.get(CassandraOptions.CASSANDRA_USERNAME); - this.password = conf.get(CassandraOptions.CASSANDRA_PASSWORD); - assert this.username != null && this.password != null; - - this.keyspace = keyspace; - String g = BackendStoreProvider.GRAPH_STORE; - String v = BackendTable.joinTableName(g, Vertex.TABLE); - String oe = BackendTable.joinTableName(g, "o" + Edge.TABLE_SUFFIX); - String ie = BackendTable.joinTableName(g, "i" + Edge.TABLE_SUFFIX); - this.tables = ImmutableList.of(v, oe, ie); - } - - @Override - public Map metrics() { - return this.executeAllHosts(this::getMetricsByHost); - } - - protected String keyspace() { - return this.keyspace; - } - - protected List tables() { - return this.tables; - } - - protected Map getMetricsByHost(String host) { - Map metrics = InsertionOrderUtil.newMap(); - // JMX client operations for Cassandra. - try (NodeProbe probe = this.newNodeProbe(host)) { - MemoryUsage heapUsage = probe.getHeapMemoryUsage(); - metrics.put(MEM_MAX, UnitUtil.bytesToMB(heapUsage.getMax())); - metrics.put(MEM_COMMITTED, - UnitUtil.bytesToMB(heapUsage.getCommitted())); - metrics.put(MEM_USED, UnitUtil.bytesToMB(heapUsage.getUsed())); - metrics.put(MEM_USED + READABLE, - UnitUtil.bytesToReadableString(heapUsage.getUsed())); - metrics.put(MEM_UNIT, "MB"); - - long diskSize = UnitUtil.bytesFromReadableString( - probe.getLoadString()); - metrics.put(DISK_USAGE, UnitUtil.bytesToGB(diskSize)); - metrics.put(DISK_USAGE + READABLE, - UnitUtil.bytesToReadableString(diskSize)); - metrics.put(DISK_USAGE + "_details", probe.getLoadMap(false)); - metrics.put(DISK_UNIT, "GB"); - - // Uptime Metrics - metrics.put("uptime", probe.getUptime()); - metrics.put("uptime_readable", - UnitUtil.timestampToReadableString(probe.getUptime())); - metrics.put("time_unit", "ms"); - - // Table/Cache/Compaction Metrics - this.appendExtraMetrics(metrics, probe); - - // Nodes Metrics - metrics.put("live_nodes", probe.getLiveNodes(false)); - metrics.put("joining_nodes", probe.getJoiningNodes(false)); - metrics.put("moving_nodes", probe.getMovingNodes(false)); - metrics.put("leaving_nodes", probe.getLeavingNodes(false)); - metrics.put("unreachable_nodes", probe.getUnreachableNodes(false)); - - // Others - metrics.put("keyspaces", probe.getKeyspaces()); - metrics.put("num_tables", probe.getNumberOfTables()); - metrics.put("exception_count", probe.getExceptionCount()); - - /* - * TODO: add metrics: - * probe.getAndResetGCStats() - * probe.getCfsProxy(keyspace, cf).estimateKeys() - * probe.takeSnapshot(snapshotName, table, options, keyspaces) - */ - } catch (Throwable e) { - LOG.debug("Unable to get metrics from host '{}':", host, e); - metrics.put(EXCEPTION, e.toString()); - } - return metrics; - } - - protected void appendExtraMetrics(Map metrics, - NodeProbe probe) { - // Table counter Metrics - appendCounterMetrics(metrics, probe, this.keyspace, this.tables, - "EstimatedPartitionCount"); - appendCounterMetrics(metrics, probe, this.keyspace, this.tables, - "DroppedMutations"); - appendCounterMetrics(metrics, probe, this.keyspace, this.tables, - "PendingFlushes"); - appendCounterMetrics(metrics, probe, this.keyspace, this.tables, - "KeyCacheHitRate"); - appendCounterMetrics(metrics, probe, this.keyspace, this.tables, - "BloomFilterFalseRatio"); - - // Table timer Metrics - appendTimerMetrics(metrics, probe, this.keyspace, "WriteLatency"); - appendTimerMetrics(metrics, probe, this.keyspace, "ReadLatency"); - appendTimerMetrics(metrics, probe, null, "WriteLatency"); - appendTimerMetrics(metrics, probe, null, "ReadLatency"); - - // Cache Metrics - appendCacheMetrics(metrics, probe, "KeyCache", "Size"); - appendCacheMetrics(metrics, probe, "KeyCache", "Entries"); - appendCacheMetrics(metrics, probe, "RowCache", "Size"); - appendCacheMetrics(metrics, probe, "RowCache", "Entries"); - appendCacheMetrics(metrics, probe, "CounterCache", "Size"); - appendCacheMetrics(metrics, probe, "CounterCache", "Entries"); - - // Compaction Metrics - appendCompactionMetrics(metrics, probe, "CompletedTasks"); - appendCompactionMetrics(metrics, probe, "PendingTasks"); - appendCompactionMetrics(metrics, probe, "BytesCompacted"); - } - - protected static void appendCounterMetrics(Map metrics, - NodeProbe probe, - String keyspace, - List tables, - String metric) { - // "EstimatedPartitionCount" => "estimated_partition_count" - String name = humpToLine(metric); - - // Aggregation of metrics for the whole host tables - Number number = 0; - for (String table : tables) { - // like: "hugegraph", "g_v", "EstimatedPartitionCount" - Object value = probe.getColumnFamilyMetric(keyspace, table, metric); - if (!(value instanceof Number)) { - value = Double.parseDouble(value.toString()); - } - number = NumberHelper.add(number, (Number) value); - } - metrics.put(name, number); - } - - protected static void appendTimerMetrics(Map metrics, - NodeProbe probe, - String keyspace, - String metric) { - // "ReadLatency" => "read_latency_hugegraph" - String suffix = keyspace == null ? "*" : keyspace; - String name = humpToLine(metric + "_" + suffix); - // Aggregation of metrics for the whole host if keyspace=null - JmxTimerMBean value = (JmxTimerMBean) probe.getColumnFamilyMetric( - keyspace, null, metric); - Map timerMap = InsertionOrderUtil.newMap(); - timerMap.put("count", value.getCount()); - timerMap.put("min", value.getMin()); - timerMap.put("mean", value.getMean()); - timerMap.put("max", value.getMax()); - timerMap.put("stddev", value.getStdDev()); - timerMap.put("p50", value.get50thPercentile()); - timerMap.put("p75", value.get75thPercentile()); - timerMap.put("p95", value.get95thPercentile()); - timerMap.put("p98", value.get98thPercentile()); - timerMap.put("p99", value.get99thPercentile()); - timerMap.put("p999", value.get999thPercentile()); - timerMap.put("duration_unit", value.getDurationUnit()); - timerMap.put("mean_rate", value.getMeanRate()); - timerMap.put("m15_rate", value.getFifteenMinuteRate()); - timerMap.put("m5_rate", value.getFiveMinuteRate()); - timerMap.put("m1_rate", value.getOneMinuteRate()); - timerMap.put("rate_unit", value.getRateUnit()); - - metrics.put(name, timerMap); - } - - protected static void appendCompactionMetrics(Map metrics, - NodeProbe probe, - String metric) { - // "CompletedTasks" => "compaction_completed_tasks" - String name = humpToLine("compaction" + metric); - Object value = probe.getCompactionMetric(metric); - if (value instanceof JmxCounterMBean) { - value = ((JmxCounterMBean) value).getCount(); - } - metrics.put(name, value); - } - - protected static void appendCacheMetrics(Map metrics, - NodeProbe probe, - String cacheType, - String metric) { - // "RowCache" + "Size" => "row_cache_size" - String name = humpToLine(cacheType + metric); - metrics.put(name, probe.getCacheMetric(cacheType, metric)); - } - - private static String humpToLine(String name) { - name = name.replaceAll("[A-Z]", "_$0").toLowerCase(); - if (!name.isEmpty() && name.charAt(0) == '_') { - name = name.substring(1); - } - return name; - } - - public Map compact() { - return this.executeAllHosts(this::compactHost); - } - - private Object compactHost(String host) { - try (NodeProbe probe = this.newNodeProbe(host)) { - Compact compact = new Compact(); - /* - * Set the keyspace to be compacted - * NOTE: use Whitebox due to no public api is provided, args format - * is [ ...], the first arg means keyspace. - */ - Whitebox.invoke(compact, "args", new Class[]{Object.class}, - "add", this.keyspace); - compact.execute(probe); - return "OK"; - } catch (Throwable e) { - return e.toString(); - } - } - - private Map executeAllHosts(Function func) { - Set hosts = this.cluster.getMetadata().getAllHosts(); - - Map results = InsertionOrderUtil.newMap(); - results.put(CLUSTER_ID, this.cluster.getClusterName()); - results.put(NODES, hosts.size()); - - Map hostsResults = InsertionOrderUtil.newMap(); - for (Host host : hosts) { - InetAddress address = host.getAddress(); - String hostAddress; - if (address instanceof Inet4Address) { - hostAddress = host.getAddress().getHostAddress(); - /* - * Translate IPv4 to IPv6 to fix issue #1843 - * TODO: delete this workaround code after fixed CASSANDRA-17581 - */ - hostAddress = "::FFFF:" + hostAddress; - } else { - assert address instanceof Inet6Address; - hostAddress = host.getAddress().getHostAddress(); - } - hostsResults.put(hostAddress, func.apply(hostAddress)); - } - results.put(SERVERS, hostsResults); - - return results; - } - - private NodeProbe newNodeProbe(String host) throws IOException { - LOG.debug("Probe to cassandra node: '{}:{}'", host, this.port); - return this.username.isEmpty() ? - new NodeProbe(host, this.port) : - new NodeProbe(host, this.port, this.username, this.password); - } -} diff --git a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraOptions.java b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraOptions.java deleted file mode 100644 index 6cb3b41389..0000000000 --- a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraOptions.java +++ /dev/null @@ -1,176 +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.hugegraph.backend.store.cassandra; - -import static org.apache.hugegraph.config.OptionChecker.allowValues; -import static org.apache.hugegraph.config.OptionChecker.disallowEmpty; -import static org.apache.hugegraph.config.OptionChecker.positiveInt; -import static org.apache.hugegraph.config.OptionChecker.rangeInt; - -import org.apache.hugegraph.config.ConfigListOption; -import org.apache.hugegraph.config.ConfigOption; -import org.apache.hugegraph.config.OptionHolder; - -public class CassandraOptions extends OptionHolder { - - private CassandraOptions() { - super(); - } - - private static volatile CassandraOptions instance; - - public static synchronized CassandraOptions instance() { - if (instance == null) { - instance = new CassandraOptions(); - instance.registerOptions(); - } - return instance; - } - - public static final ConfigOption CASSANDRA_HOST = - new ConfigOption<>( - "cassandra.host", - "The seeds hostname or ip address of cassandra cluster.", - disallowEmpty(), - "localhost" - ); - - public static final ConfigOption CASSANDRA_PORT = - new ConfigOption<>( - "cassandra.port", - "The seeds port address of cassandra cluster.", - rangeInt(1, 65535), - 9042 - ); - - public static final ConfigOption CASSANDRA_USERNAME = - new ConfigOption<>( - "cassandra.username", - "The username to use to login to cassandra cluster.", - "" - ); - - public static final ConfigOption CASSANDRA_PASSWORD = - new ConfigOption<>( - "cassandra.password", - "The password corresponding to cassandra.username.", - "" - ); - - public static final ConfigOption CASSANDRA_CONN_TIMEOUT = - new ConfigOption<>( - "cassandra.connect_timeout", - "The cassandra driver connect server timeout(seconds).", - rangeInt(1, 30), - 5 - ); - - public static final ConfigOption CASSANDRA_READ_TIMEOUT = - new ConfigOption<>( - "cassandra.read_timeout", - "The cassandra driver read from server timeout(seconds).", - rangeInt(1, 120), - 20 - ); - - public static final ConfigOption CASSANDRA_STRATEGY = - new ConfigOption<>( - "cassandra.keyspace.strategy", - "The replication strategy of keyspace, valid value is " + - "SimpleStrategy or NetworkTopologyStrategy.", - allowValues("SimpleStrategy", "NetworkTopologyStrategy"), - "SimpleStrategy" - ); - - public static final ConfigListOption CASSANDRA_REPLICATION = - new ConfigListOption<>( - "cassandra.keyspace.replication", - "The keyspace replication factor of SimpleStrategy, " + - "like '[3]'. Or replicas in each datacenter of " + - "NetworkTopologyStrategy, like '[dc1:2,dc2:1]'.", - disallowEmpty(), - "3" - ); - - public static final ConfigOption CASSANDRA_COMPRESSION = - new ConfigOption<>( - "cassandra.compression_type", - "The compression algorithm of cassandra transport: none/snappy/lz4.", - allowValues("none", "snappy", "lz4"), - "none" - ); - - public static final ConfigOption CASSANDRA_JMX_PORT = - new ConfigOption<>( - "cassandra.jmx_port", - "The port of JMX API service for cassandra", - rangeInt(1, 65535), - 7199 - ); - - public static final ConfigOption AGGR_TIMEOUT = - new ConfigOption<>( - "cassandra.aggregation_timeout", - "The timeout in seconds of waiting for aggregation.", - positiveInt(), - 12 * 60 * 60 - ); - - public static final ConfigOption CASSANDRA_RECONNECT_BASE_DELAY = - new ConfigOption<>( - "cassandra.reconnect_base_delay", - "The base delay in milliseconds used by the driver's " + - "exponential reconnection policy when a Cassandra host " + - "becomes unreachable.", - rangeInt(100L, Long.MAX_VALUE), - 1000L - ); - - public static final ConfigOption CASSANDRA_RECONNECT_MAX_DELAY = - new ConfigOption<>( - "cassandra.reconnect_max_delay", - "The maximum delay in milliseconds used by the driver's " + - "exponential reconnection policy when a Cassandra host " + - "becomes unreachable.", - rangeInt(1000L, Long.MAX_VALUE), - 10_000L - ); - - public static final ConfigOption CASSANDRA_QUERY_RETRY_MAX_ATTEMPTS = - new ConfigOption<>( - "cassandra.query_retry_max_attempts", - "The maximum number of retry attempts applied at query-time when " + - "a Cassandra host is temporarily unreachable. " + - "OperationTimedOutException is retried only for " + - "idempotent statements. " + - "Set to 0 to disable query-time retries.", - rangeInt(0, Integer.MAX_VALUE), - 3 - ); - - public static final ConfigOption CASSANDRA_QUERY_RETRY_INTERVAL = - new ConfigOption<>( - "cassandra.query_retry_interval", - "The interval in milliseconds between query-time retries " + - "when a Cassandra host is temporarily unreachable. The " + - "actual wait grows with exponential backoff, capped at " + - "cassandra.reconnect_max_delay.", - rangeInt(100L, Long.MAX_VALUE), - 1000L - ); -} diff --git a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraSerializer.java b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraSerializer.java deleted file mode 100644 index fc3c499a81..0000000000 --- a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraSerializer.java +++ /dev/null @@ -1,225 +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.hugegraph.backend.store.cassandra; - -import java.nio.ByteBuffer; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.apache.hugegraph.backend.BackendException; -import org.apache.hugegraph.backend.id.Id; -import org.apache.hugegraph.backend.id.IdGenerator; -import org.apache.hugegraph.backend.id.IdUtil; -import org.apache.hugegraph.backend.serializer.BytesBuffer; -import org.apache.hugegraph.backend.serializer.TableBackendEntry; -import org.apache.hugegraph.backend.serializer.TableSerializer; -import org.apache.hugegraph.backend.store.BackendEntry; -import org.apache.hugegraph.config.HugeConfig; -import org.apache.hugegraph.schema.PropertyKey; -import org.apache.hugegraph.schema.SchemaElement; -import org.apache.hugegraph.structure.HugeElement; -import org.apache.hugegraph.structure.HugeIndex; -import org.apache.hugegraph.structure.HugeProperty; -import org.apache.hugegraph.structure.HugeVertex; -import org.apache.hugegraph.type.HugeType; -import org.apache.hugegraph.type.define.DataType; -import org.apache.hugegraph.type.define.HugeKeys; -import org.apache.hugegraph.util.E; -import org.apache.hugegraph.util.InsertionOrderUtil; -import org.apache.hugegraph.util.JsonUtil; - -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableSet; - -public class CassandraSerializer extends TableSerializer { - - public CassandraSerializer(HugeConfig config) { - super(config); - } - - @Override - public CassandraBackendEntry newBackendEntry(HugeType type, Id id) { - return new CassandraBackendEntry(type, id); - } - - @Override - protected TableBackendEntry newBackendEntry(TableBackendEntry.Row row) { - return new CassandraBackendEntry(row); - } - - @Override - protected TableBackendEntry newBackendEntry(HugeIndex index) { - TableBackendEntry backendEntry = newBackendEntry(index.type(), - index.id()); - if (index.indexLabel().olap()) { - backendEntry.olap(true); - } - return backendEntry; - } - - @Override - protected CassandraBackendEntry convertEntry(BackendEntry backendEntry) { - if (!(backendEntry instanceof CassandraBackendEntry)) { - throw new BackendException("Not supported by CassandraSerializer"); - } - return (CassandraBackendEntry) backendEntry; - } - - @Override - protected Set parseIndexElemIds(TableBackendEntry entry) { - return ImmutableSet.of(entry.column(HugeKeys.ELEMENT_IDS)); - } - - @Override - protected Id toId(Number number) { - return IdGenerator.of(number.longValue()); - } - - @Override - protected Id[] toIdArray(Object object) { - assert object instanceof Collection; - @SuppressWarnings("unchecked") - Collection numbers = (Collection) object; - Id[] ids = new Id[numbers.size()]; - int i = 0; - for (Number number : numbers) { - ids[i++] = toId(number); - } - return ids; - } - - @Override - protected Object toLongSet(Collection ids) { - Set results = InsertionOrderUtil.newSet(); - for (Id id : ids) { - results.add(id.asLong()); - } - return results; - } - - @Override - protected Object toLongList(Collection ids) { - List results = new ArrayList<>(ids.size()); - for (Id id : ids) { - results.add(id.asLong()); - } - return results; - } - - @Override - protected void formatProperties(HugeElement element, - TableBackendEntry.Row row) { - if (!element.hasProperties() && !element.removed()) { - row.column(HugeKeys.PROPERTIES, ImmutableMap.of()); - } else { - // Format properties - for (HugeProperty prop : element.getProperties()) { - this.formatProperty(prop, row); - } - } - } - - @Override - protected void parseProperties(HugeElement element, - TableBackendEntry.Row row) { - Map props = row.column(HugeKeys.PROPERTIES); - for (Map.Entry prop : props.entrySet()) { - Id pkeyId = this.toId(prop.getKey()); - this.parseProperty(pkeyId, prop.getValue(), element); - } - } - - @Override - public BackendEntry writeOlapVertex(HugeVertex vertex) { - CassandraBackendEntry entry = newBackendEntry(HugeType.OLAP, - vertex.id()); - entry.column(HugeKeys.ID, this.writeId(vertex.id())); - - Collection> properties = vertex.getProperties(); - E.checkArgument(properties.size() == 1, - "Expect only 1 property for olap vertex, but got %s", - properties.size()); - HugeProperty property = properties.iterator().next(); - PropertyKey pk = property.propertyKey(); - entry.subId(pk.id()); - entry.column(HugeKeys.PROPERTY_VALUE, - this.writeProperty(pk, property.value())); - entry.olap(true); - return entry; - } - - @Override - protected Object writeProperty(PropertyKey propertyKey, Object value) { - BytesBuffer buffer = BytesBuffer.allocate(BytesBuffer.BUF_PROPERTY); - if (propertyKey == null) { - /* - * Since we can't know the type of the property value in some - * scenarios so need to construct a fake property key to - * serialize to reuse code. - */ - propertyKey = new PropertyKey(null, IdGenerator.of(0L), "fake"); - propertyKey.dataType(DataType.fromClass(value.getClass())); - } - buffer.writeProperty(propertyKey, value); - buffer.forReadWritten(); - return buffer.asByteBuffer(); - } - - @Override - @SuppressWarnings("unchecked") - protected T readProperty(PropertyKey pkey, Object value) { - BytesBuffer buffer = BytesBuffer.wrap((ByteBuffer) value); - return (T) buffer.readProperty(pkey); - } - - @Override - protected Object writeId(Id id) { - return IdUtil.writeBinString(id); - } - - @Override - protected Id readId(Object id) { - return IdUtil.readBinString(id); - } - - @Override - protected void writeUserdata(SchemaElement schema, - TableBackendEntry entry) { - assert entry instanceof CassandraBackendEntry; - for (Map.Entry e : schema.userdata().entrySet()) { - entry.column(HugeKeys.USER_DATA, e.getKey(), - JsonUtil.toJson(e.getValue())); - } - } - - @Override - protected void readUserdata(SchemaElement schema, - TableBackendEntry entry) { - assert entry instanceof CassandraBackendEntry; - // Parse all user data of a schema element - Map userdata = entry.column(HugeKeys.USER_DATA); - for (Map.Entry e : userdata.entrySet()) { - String key = e.getKey(); - Object value = JsonUtil.fromJson(e.getValue(), Object.class); - schema.userdata(key, value); - } - } -} diff --git a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraSessionPool.java b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraSessionPool.java deleted file mode 100644 index a217d53444..0000000000 --- a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraSessionPool.java +++ /dev/null @@ -1,494 +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.hugegraph.backend.store.cassandra; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.concurrent.atomic.AtomicBoolean; - -import org.apache.hugegraph.backend.BackendException; -import org.apache.hugegraph.backend.store.BackendSession.AbstractBackendSession; -import org.apache.hugegraph.backend.store.BackendSessionPool; -import org.apache.hugegraph.config.HugeConfig; -import org.apache.hugegraph.util.E; -import org.apache.hugegraph.util.Log; -import org.slf4j.Logger; - -import com.datastax.driver.core.BatchStatement; -import com.datastax.driver.core.Cluster; -import com.datastax.driver.core.Cluster.Builder; -import com.datastax.driver.core.Metadata; -import com.datastax.driver.core.ProtocolOptions.Compression; -import com.datastax.driver.core.ResultSet; -import com.datastax.driver.core.ResultSetFuture; -import com.datastax.driver.core.SimpleStatement; -import com.datastax.driver.core.SocketOptions; -import com.datastax.driver.core.Statement; -import com.datastax.driver.core.exceptions.DriverException; -import com.datastax.driver.core.exceptions.InvalidQueryException; -import com.datastax.driver.core.exceptions.NoHostAvailableException; -import com.datastax.driver.core.exceptions.OperationTimedOutException; -import com.datastax.driver.core.policies.ExponentialReconnectionPolicy; - -public class CassandraSessionPool extends BackendSessionPool { - - private static final Logger LOG = Log.logger(CassandraSessionPool.class); - - private static final int SECOND = 1000; - private static final String HEALTH_CHECK_CQL = - "SELECT now() FROM system.local"; - - /** - * Guards the one-time JVM-wide warning about {@code commitAsync()} not - * being covered by query-time retries. {@link CassandraSessionPool} is - * instantiated once per backend store per graph, so without this guard - * the warning would fire many times on startup for a structural - * limitation that does not change between instances. - */ - private static final AtomicBoolean ASYNC_RETRY_WARNING_LOGGED = - new AtomicBoolean(false); - - private Cluster cluster; - private final String keyspace; - private final int maxRetries; - private final long retryInterval; - private final long retryBaseDelay; - private final long retryMaxDelay; - - public CassandraSessionPool(HugeConfig config, - String keyspace, String store) { - super(config, keyspace + "/" + store); - this.cluster = null; - this.keyspace = keyspace; - this.maxRetries = config.get( - CassandraOptions.CASSANDRA_QUERY_RETRY_MAX_ATTEMPTS); - this.retryInterval = config.get( - CassandraOptions.CASSANDRA_QUERY_RETRY_INTERVAL); - long reconnectBase = config.get( - CassandraOptions.CASSANDRA_RECONNECT_BASE_DELAY); - long reconnectMax = config.get( - CassandraOptions.CASSANDRA_RECONNECT_MAX_DELAY); - E.checkArgument(reconnectMax >= reconnectBase, - "'%s' (%s) must be >= '%s' (%s)", - CassandraOptions.CASSANDRA_RECONNECT_MAX_DELAY.name(), - reconnectMax, - CassandraOptions.CASSANDRA_RECONNECT_BASE_DELAY.name(), - reconnectBase); - this.retryBaseDelay = reconnectBase; - this.retryMaxDelay = reconnectMax; - - if (this.maxRetries > 0 && - ASYNC_RETRY_WARNING_LOGGED.compareAndSet(false, true)) { - LOG.warn("cassandra.query_retry_max_attempts={} applies to sync commit()" + - " only. commitAsync() has no retry protection.", this.maxRetries); - } - } - - @Override - public synchronized void open() { - if (this.opened()) { - throw new BackendException("Please close the old SessionPool " + - "before opening a new one"); - } - - HugeConfig config = this.config(); - // Contact options - String hosts = config.get(CassandraOptions.CASSANDRA_HOST); - int port = config.get(CassandraOptions.CASSANDRA_PORT); - - assert this.cluster == null || this.cluster.isClosed(); - /* - * We disable cassandra metrics through withoutMetrics(), due to - * metrics versions are incompatible, java11 glassfish use metrics 4, - * but cassandra use metrics 3. - * TODO: fix it after after cassandra upgrade metrics version - */ - Builder builder = Cluster.builder() - .addContactPoints(hosts.split(",")) - .withoutMetrics() - .withPort(port); - - // Timeout options - int connTimeout = config.get(CassandraOptions.CASSANDRA_CONN_TIMEOUT); - int readTimeout = config.get(CassandraOptions.CASSANDRA_READ_TIMEOUT); - - SocketOptions socketOptions = new SocketOptions(); - socketOptions.setConnectTimeoutMillis(connTimeout * SECOND); - socketOptions.setReadTimeoutMillis(readTimeout * SECOND); - - builder.withSocketOptions(socketOptions); - - // Reconnection policy: let driver keep retrying nodes in background - // with exponential backoff after they go down (see issue #2740). - builder.withReconnectionPolicy( - new ExponentialReconnectionPolicy(this.retryBaseDelay, - this.retryMaxDelay)); - - // Credential options - String username = config.get(CassandraOptions.CASSANDRA_USERNAME); - String password = config.get(CassandraOptions.CASSANDRA_PASSWORD); - if (!username.isEmpty()) { - builder.withCredentials(username, password); - } - - // Compression options - String compression = config.get(CassandraOptions.CASSANDRA_COMPRESSION); - builder.withCompression(Compression.valueOf(compression.toUpperCase())); - - this.cluster = builder.build(); - } - - @Override - public final synchronized boolean opened() { - return (this.cluster != null && !this.cluster.isClosed()); - } - - protected final synchronized Cluster cluster() { - E.checkState(this.cluster != null, - "Cassandra cluster has not been initialized"); - return this.cluster; - } - - @Override - public final Session session() { - return (Session) super.getOrNewSession(); - } - - @Override - protected Session newSession() { - E.checkState(this.cluster != null, - "Cassandra cluster has not been initialized"); - return new Session(); - } - - @Override - protected synchronized void doClose() { - if (this.cluster != null && !this.cluster.isClosed()) { - this.cluster.close(); - } - } - - public final boolean clusterConnected() { - E.checkState(this.cluster != null, - "Cassandra cluster has not been initialized"); - return !this.cluster.isClosed(); - } - - /** - * The Session class is a wrapper of driver Session - * Expect every thread hold its own session(wrapper) - */ - public final class Session extends AbstractBackendSession { - - private com.datastax.driver.core.Session session; - private BatchStatement batch; - - public Session() { - this.session = null; - this.batch = new BatchStatement(); // LOGGED - } - - public BatchStatement add(Statement statement) { - return this.batch.add(statement); - } - - @Override - public void rollback() { - this.batch.clear(); - } - - @Override - public ResultSet commit() { - ResultSet rs = this.executeWithRetry(this.batch); - // Clear batch if execute() successfully (retained if failed) - this.batch.clear(); - return rs; - } - - public void commitAsync() { - Collection statements = this.batch.getStatements(); - if (statements.isEmpty()) { - this.batch.clear(); - return; - } - - int count = 0; - int processors = Math.min(statements.size(), 1023); - List results = new ArrayList<>(processors + 1); - com.datastax.driver.core.Session driverSession = - this.sessionForAsyncCommit(); - for (Statement s : statements) { - // TODO: track async retry support in a follow-up issue. - // commitAsync() bypasses executeWithRetry(). - // During a Cassandra restart, async writes may fail with - // NoHostAvailableException even when maxRetries > 0. Callers - // must handle ResultSetFuture failures surfaced by - // getUninterruptibly(). A follow-up issue should wrap each - // future with retry semantics. - ResultSetFuture future = driverSession.executeAsync(s); - results.add(future); - - if (++count > processors) { - results.forEach(ResultSetFuture::getUninterruptibly); - results.clear(); - count = 0; - } - } - for (ResultSetFuture future : results) { - future.getUninterruptibly(); - } - - // Clear batch if execute() successfully (retained if failed) - this.batch.clear(); - } - - public ResultSet query(Statement statement) { - assert !this.hasChanges(); - return this.execute(statement); - } - - public ResultSet execute(Statement statement) { - return this.executeWithRetry(statement); - } - - public ResultSet execute(String statement) { - return this.executeWithRetry(new SimpleStatement(statement)); - } - - public ResultSet execute(String statement, Object... args) { - return this.executeWithRetry(new SimpleStatement(statement, args)); - } - - /** - * Execute a statement, retrying on transient connectivity failures - * (NoHostAvailableException / OperationTimedOutException). The driver - * itself keeps retrying connections in the background via the - * reconnection policy, so once Cassandra comes back online, a - * subsequent attempt here will succeed without restarting the server. - * - *

OperationTimedOutException is only retried for statements marked - * idempotent; otherwise a timed-out mutation might be applied once by - * Cassandra and then duplicated by a client-side retry. - * - *

If the driver session has been discarded (e.g. by - * {@link #reconnectIfNeeded()} after a failed health-check) it is - * lazily reopened at the start of each attempt. - * - *

Blocking note: retries block the calling thread via - * {@link Thread#sleep(long)}. Worst-case a single call blocks for - * {@code maxRetries * retryMaxDelay} ms. Under high-throughput - * workloads concurrent threads may pile up in {@code sleep()} during - * a Cassandra outage. For such deployments lower - * {@code cassandra.query_retry_max_attempts} (default 3) and - * {@code cassandra.reconnect_max_delay} (default 10000ms) so the - * request fails fast and pressure is released back to the caller. - */ - private ResultSet executeWithRetry(Statement statement) { - int retries = CassandraSessionPool.this.maxRetries; - long interval = CassandraSessionPool.this.retryInterval; - long maxDelay = CassandraSessionPool.this.retryMaxDelay; - DriverException lastError = null; - for (int attempt = 0; attempt <= retries; attempt++) { - try { - if (this.session == null || this.session.isClosed()) { - // Lazy reopen: may itself throw NHAE while - // Cassandra is still unreachable; the catch below - // treats that as a transient failure. - this.session = null; - this.open(); - } - return this.session.execute(statement); - } catch (NoHostAvailableException | OperationTimedOutException e) { - lastError = e; - if (e instanceof OperationTimedOutException && - !Boolean.TRUE.equals(statement.isIdempotent())) { - throw new BackendException( - "Cassandra query timed out and won't be " + - "retried because the statement is not " + - "marked idempotent", e); - } - if (attempt >= retries) { - break; - } - long cap = maxDelay > 0 ? maxDelay : interval; - long shift = 1L << Math.min(attempt, 20); - long delay; - try { - // Guard against Long overflow when retryInterval is huge. - delay = Math.min(Math.multiplyExact(interval, shift), cap); - } catch (ArithmeticException overflow) { - delay = cap; - } - LOG.warn("Cassandra temporarily unavailable ({}), " + - "retry {}/{} in {} ms", - e.getClass().getSimpleName(), attempt + 1, - retries, delay); - try { - Thread.sleep(delay); - } catch (InterruptedException ie) { - Thread.currentThread().interrupt(); - throw new BackendException("Interrupted while " + - "waiting to retry " + - "Cassandra query", ie); - } - } - } - // Preserve original exception as cause (stack trace + type) by - // pre-formatting the message and using the (String, Throwable) - // constructor explicitly to avoid ambiguity with varargs overloads. - String msg = String.format( - "Failed to execute Cassandra query after %s retries: %s", - retries, - lastError == null ? "" : lastError.getMessage()); - throw new BackendException(msg, lastError); - } - - private void tryOpen() { - assert this.session == null; - try { - this.open(); - } catch (InvalidQueryException ignored) { - // ignore - } - } - - private com.datastax.driver.core.Session sessionForAsyncCommit() { - if (this.session == null || this.session.isClosed()) { - this.session = null; - try { - this.open(); - } catch (DriverException e) { - throw new BackendException( - "Failed to open Cassandra session for async commit", - e); - } - } - if (this.session == null) { - throw new BackendException( - "Cassandra session is unavailable for async commit"); - } - return this.session; - } - - @Override - public void open() { - this.opened = true; - assert this.session == null; - this.session = cluster().connect(keyspace()); - } - - @Override - public boolean opened() { - if (this.opened && this.session == null) { - this.tryOpen(); - } - return this.opened && this.session != null; - } - - @Override - public boolean closed() { - if (!this.opened || this.session == null) { - return true; - } - return this.session.isClosed(); - } - - @Override - public void close() { - assert this.closeable(); - if (this.session == null) { - return; - } - this.session.close(); - this.session = null; - } - - @Override - public boolean hasChanges() { - return this.batch.size() > 0; - } - - /** - * Periodic liveness probe invoked by {@link BackendSessionPool} to - * recover thread-local sessions after Cassandra has been restarted. - * Reopens the driver session if it was closed and pings the cluster - * with a lightweight query. On failure the session is discarded via - * {@link #reset()} so the next call to - * {@link #executeWithRetry(Statement)} reopens it; any exception - * here is swallowed so the caller can still issue the real query. - */ - @Override - public void reconnectIfNeeded() { - if (!this.opened) { - return; - } - try { - if (this.session == null || this.session.isClosed()) { - this.session = null; - this.tryOpen(); - } - if (this.session != null) { - this.session.execute(new SimpleStatement(HEALTH_CHECK_CQL)); - } - } catch (NoHostAvailableException | OperationTimedOutException e) { - LOG.debug("Cassandra health-check failed, resetting session: {}", - e.getMessage()); - this.reset(); - } - } - - /** - * Force-close the driver session so it is re-opened on the next - * {@link #opened()} call. Used when a failure is observed and we - * want to start fresh on the next attempt. - */ - @Override - public void reset() { - if (this.session == null) { - return; - } - try { - this.session.close(); - } catch (Exception e) { - // Do not swallow Error (OOM / StackOverflow); only log - // ordinary exceptions raised by the driver on close. - LOG.warn("Failed to reset Cassandra session", e); - } finally { - this.session = null; - } - } - - public Collection statements() { - return this.batch.getStatements(); - } - - public String keyspace() { - return CassandraSessionPool.this.keyspace; - } - - public Metadata metadata() { - return CassandraSessionPool.this.cluster.getMetadata(); - } - - public int aggregateTimeout() { - HugeConfig conf = CassandraSessionPool.this.config(); - return conf.get(CassandraOptions.AGGR_TIMEOUT); - } - } -} diff --git a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraShard.java b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraShard.java deleted file mode 100644 index 5f37922985..0000000000 --- a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraShard.java +++ /dev/null @@ -1,319 +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.hugegraph.backend.store.cassandra; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; -import java.util.Set; -import java.util.concurrent.Callable; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Future; -import java.util.concurrent.LinkedBlockingQueue; -import java.util.concurrent.ThreadPoolExecutor; -import java.util.concurrent.TimeUnit; -import java.util.stream.Collectors; - -import org.apache.cassandra.db.SystemKeyspace; -import org.apache.cassandra.dht.ByteOrderedPartitioner; -import org.apache.cassandra.dht.IPartitioner; -import org.apache.cassandra.dht.Murmur3Partitioner; -import org.apache.cassandra.dht.OrderPreservingPartitioner; -import org.apache.cassandra.dht.Range; -import org.apache.cassandra.dht.Token; -import org.apache.cassandra.dht.Token.TokenFactory; -import org.apache.cassandra.schema.SchemaConstants; -import org.apache.hugegraph.backend.BackendException; -import org.apache.hugegraph.backend.store.Shard; -import org.apache.hugegraph.util.Bytes; - -import com.datastax.driver.core.Host; -import com.datastax.driver.core.Metadata; -import com.datastax.driver.core.ResultSet; -import com.datastax.driver.core.Row; -import com.datastax.driver.core.TokenRange; -import com.google.common.collect.ImmutableMap; - -/** - * CassandraShard is used for cassandra scanning operations. - * Each shard represents a range of tokens for a node. - * Reading data from a given shard does not cross multiple nodes. - *

- * Refer to AbstractColumnFamilyInputFormat from: - * ... - */ -public class CassandraShard { - - /** The minimal shard size should >= 1M to prevent too many number of shards */ - private static final int MIN_SHARD_SIZE = (int) Bytes.MB; - - private CassandraSessionPool.Session session; - private String keyspace; - private String table; - - private IPartitioner partitioner; - - public CassandraShard(CassandraSessionPool.Session session, - String keyspace, String table) { - this.session = session; - this.keyspace = keyspace; - this.table = table; - - this.partitioner = new Murmur3Partitioner(); - } - - /** - * Get splits of a table - * - * @param splitPartitions: expected partitions count per split - * @param splitSize: expected size(bytes) per split, - * splitPartitions will be ignored if splitSize is passed - * @return a list of Shard - */ - public List getSplits(long splitPartitions, long splitSize) { - // Canonical ranges, split into pieces, fetch the splits in parallel - ExecutorService executor = new ThreadPoolExecutor(0, 128, 60L, TimeUnit.SECONDS, - new LinkedBlockingQueue<>()); - - List splits = new ArrayList<>(); - try { - List>> futures = new ArrayList<>(); - - // Canonical ranges and nodes holding replicas - Map> masterRangeNodes = getRangeMap(); - - for (TokenRange range : masterRangeNodes.keySet()) { - /* - * For each token range, pick a live owner and ask it to - * compute bite-sized splits. - */ - futures.add(executor.submit(new SplitCallable( - range, splitPartitions, splitSize))); - } - - // Wait until we have all the results back - for (Future> future : futures) { - try { - splits.addAll(future.get()); - } catch (Exception e) { - throw new BackendException("Can't get cassandra shards", e); - } - } - assert splits.size() > masterRangeNodes.size(); - } finally { - executor.shutdownNow(); - } - - Collections.shuffle(splits, new Random(System.nanoTime())); - return splits; - } - - /** - * Get splits of a table in specified range - * NOTE: maybe we don't need this method - * - * @param start: the start of range - * @param end: the end of range - * @param splitPartitions: expected partitions count per split - * @param splitSize: expected size(bytes) per split, - * splitPartitions will be ignored if splitSize is passed - * @return a list of Shard - */ - public List getSplits(String start, String end, - int splitPartitions, int splitSize) { - - ExecutorService executor = new ThreadPoolExecutor(0, 128, 60L, TimeUnit.SECONDS, - new LinkedBlockingQueue<>()); - - List splits = new ArrayList<>(); - try { - List>> futures = new ArrayList<>(); - TokenFactory tokenFactory = this.partitioner.getTokenFactory(); - TokenRange tokenRange = rangeToTokenRange(new Range<>( - tokenFactory.fromString(start), - tokenFactory.fromString(end))); - - // Canonical ranges and nodes holding replicas - Map> masterRangeNodes = getRangeMap(); - - for (TokenRange range : masterRangeNodes.keySet()) { - for (TokenRange r : range.intersectWith(tokenRange)) { - // For each tokenRange, pick a live owner and ask it - // to compute bite-sized splits - futures.add(executor.submit(new SplitCallable( - r, splitPartitions, splitSize))); - } - } - - // Wait until we have all the results back - for (Future> future : futures) { - try { - splits.addAll(future.get()); - } catch (Exception e) { - throw new BackendException("Can't get cassandra shards", e); - } - } - assert splits.size() >= masterRangeNodes.size(); - } finally { - executor.shutdownNow(); - } - - Collections.shuffle(splits, new Random(System.nanoTime())); - return splits; - } - - private boolean isPartitionerOpp() { - return this.partitioner instanceof OrderPreservingPartitioner || - this.partitioner instanceof ByteOrderedPartitioner; - } - - private TokenRange rangeToTokenRange(Range range) { - TokenFactory tokenFactory = this.partitioner.getTokenFactory(); - Metadata metadata = this.session.metadata(); - return metadata.newTokenRange( - metadata.newToken(tokenFactory.toString(range.left)), - metadata.newToken(tokenFactory.toString(range.right))); - } - - private Map getSubSplits(TokenRange tokenRange, - long splitPartitions, - long splitSize) { - try { - return describeSplits(this.session, this.keyspace, this.table, - splitPartitions, splitSize, tokenRange); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - private Map> getRangeMap() { - Metadata metadata = this.session.metadata(); - return metadata.getTokenRanges().stream().collect(Collectors.toMap( - p -> p, - p -> metadata.getReplicas('"' + this.keyspace + '"', p))); - } - - private static Map describeSplits( - CassandraSessionPool.Session session, - String keyspace, - String table, - long splitPartitions, - long splitSize, - TokenRange tokenRange) { - - String query = String.format( - "SELECT mean_partition_size, partitions_count FROM %s.%s " + - "WHERE keyspace_name = ? AND table_name = ? AND " + - "range_start = ? AND range_end = ?", - SchemaConstants.SYSTEM_KEYSPACE_NAME, - SystemKeyspace.LEGACY_SIZE_ESTIMATES); - - ResultSet resultSet = session.execute(query, keyspace, table, - tokenRange.getStart().toString(), - tokenRange.getEnd().toString()); - Row row = resultSet.one(); - - long meanPartitionSize; - long partitionsCount = 0L; - long splitCount = 0L; - - if (row != null) { - meanPartitionSize = row.getLong("mean_partition_size"); - partitionsCount = row.getLong("partitions_count"); - assert splitSize <= 0 || splitSize >= MIN_SHARD_SIZE; - splitCount = splitSize > 0 ? - (meanPartitionSize * partitionsCount / splitSize) : - (partitionsCount / splitPartitions); - } - - /* - * If we have no data on this split or the size estimate is 0, - * return the full split i.e., do not sub-split - * Assume the smallest granularity of partition count available from CASSANDRA-7688. - */ - if (splitCount == 0) { - return ImmutableMap.of(tokenRange, (long) 128); - } - - List ranges = tokenRange.splitEvenly((int) splitCount); - Map rangesWithLength = new HashMap<>(); - for (TokenRange range : ranges) { - // Add a sub-range (with its partitions count per sub-range) - rangesWithLength.put(range, partitionsCount / splitCount); - } - return rangesWithLength; - } - - /** - * Gets a token tokenRange and splits it up according to the suggested size - * into input splits that Hugegraph can use. - */ - class SplitCallable implements Callable> { - - private final TokenRange tokenRange; - private final long splitPartitions; - private final long splitSize; - - public SplitCallable(TokenRange tokenRange, - long splitPartitions, long splitSize) { - if (splitSize <= 0 && splitPartitions <= 0) { - throw new IllegalArgumentException(String.format( - "The split-partitions must be > 0, but got %s", - splitPartitions)); - } - - if (splitSize > 0 && splitSize < MIN_SHARD_SIZE) { - // splitSize should be at least 1M if passed - throw new IllegalArgumentException(String.format( - "The split-size must be >= %s bytes, but got %s", - MIN_SHARD_SIZE, splitSize)); - } - - this.tokenRange = tokenRange; - this.splitPartitions = splitPartitions; - this.splitSize = splitSize; - } - - @Override - public List call() throws Exception { - ArrayList splits = new ArrayList<>(); - - Map subSplits = getSubSplits( - this.tokenRange, - this.splitPartitions, - this.splitSize); - for (Map.Entry entry : subSplits.entrySet()) { - List ranges = entry.getKey().unwrap(); - for (TokenRange subrange : ranges) { - String start = !isPartitionerOpp() ? - subrange.getStart().toString() : - subrange.getStart().toString().substring(2); - String end = !isPartitionerOpp() ? - subrange.getEnd().toString() : - subrange.getEnd().toString().substring(2); - long length = entry.getValue(); - splits.add(new Shard(start, end, length)); - } - } - return splits; - } - } -} diff --git a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraStore.java b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraStore.java deleted file mode 100644 index d302c65d5c..0000000000 --- a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraStore.java +++ /dev/null @@ -1,814 +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.hugegraph.backend.store.cassandra; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; - -import org.apache.hugegraph.HugeException; -import org.apache.hugegraph.backend.BackendException; -import org.apache.hugegraph.backend.id.Id; -import org.apache.hugegraph.backend.query.Query; -import org.apache.hugegraph.backend.serializer.MergeIterator; -import org.apache.hugegraph.backend.store.AbstractBackendStore; -import org.apache.hugegraph.backend.store.BackendAction; -import org.apache.hugegraph.backend.store.BackendEntry; -import org.apache.hugegraph.backend.store.BackendFeatures; -import org.apache.hugegraph.backend.store.BackendMutation; -import org.apache.hugegraph.backend.store.BackendStoreProvider; -import org.apache.hugegraph.config.CoreOptions; -import org.apache.hugegraph.config.HugeConfig; -import org.apache.hugegraph.exception.ConnectionException; -import org.apache.hugegraph.type.HugeType; -import org.apache.hugegraph.util.E; -import org.apache.hugegraph.util.Log; -import org.slf4j.Logger; - -import com.datastax.driver.core.Cluster; -import com.datastax.driver.core.KeyspaceMetadata; -import com.datastax.driver.core.Session; -import com.datastax.driver.core.Statement; -import com.datastax.driver.core.exceptions.DriverException; -import com.datastax.driver.core.exceptions.InvalidQueryException; -import com.datastax.driver.core.schemabuilder.SchemaBuilder; - -public abstract class CassandraStore extends AbstractBackendStore { - - private static final Logger LOG = Log.logger(CassandraStore.class); - - private static final BackendFeatures FEATURES = new CassandraFeatures(); - - private final String store; - private final String keyspace; - - private final BackendStoreProvider provider; - // TODO: move to parent class - private final Map tables; - - private CassandraSessionPool sessions; - private HugeConfig conf; - private boolean isGraphStore; - - public CassandraStore(final BackendStoreProvider provider, - final String keyspace, final String store) { - E.checkNotNull(keyspace, "keyspace"); - E.checkNotNull(store, "store"); - - this.provider = provider; - - this.keyspace = keyspace; - this.store = store; - this.tables = new ConcurrentHashMap<>(); - - this.sessions = null; - this.conf = null; - - this.registerMetaHandlers(); - LOG.debug("Store loaded: {}", store); - } - - private void registerMetaHandlers() { - this.registerMetaHandler("metrics", (session, meta, args) -> { - CassandraMetrics metrics = this.createMetrics(this.conf, - this.sessions, - this.keyspace); - return metrics.metrics(); - }); - - this.registerMetaHandler("compact", (session, meta, args) -> { - CassandraMetrics metrics = this.createMetrics(this.conf, - this.sessions, - this.keyspace); - return metrics.compact(); - }); - } - - protected CassandraMetrics createMetrics(HugeConfig conf, - CassandraSessionPool sessions, - String keyspace) { - return new CassandraMetrics(conf, sessions, keyspace); - } - - protected void registerTableManager(HugeType type, CassandraTable table) { - this.registerTableManager(type.string(), table); - } - - protected void registerTableManager(String name, CassandraTable table) { - this.tables.put(name, table); - } - - protected void unregisterTableManager(String name) { - this.tables.remove(name); - } - - @Override - public String store() { - return this.store; - } - - @Override - public String database() { - return this.keyspace; - } - - @Override - public BackendStoreProvider provider() { - return this.provider; - } - - @Override - public synchronized void open(HugeConfig config) { - LOG.debug("Store open: {}", this.store); - E.checkNotNull(config, "config"); - - if (this.sessions == null) { - this.sessions = new CassandraSessionPool(config, this.keyspace, - this.store); - } - - assert this.sessions != null; - if (!this.sessions.closed()) { - // TODO: maybe we should throw an exception here instead of ignore - LOG.debug("Store {} has been opened before", this.store); - this.sessions.useSession(); - return; - } - this.conf = config; - String graphStore = this.conf.get(CoreOptions.STORE_GRAPH); - this.isGraphStore = this.store.equals(graphStore); - - // Init cluster - this.sessions.open(); - - // Init a session for current thread - try { - LOG.debug("Store connect with keyspace: {}", this.keyspace); - try { - this.sessions.session().open(); - } catch (InvalidQueryException e) { - // TODO: the error message may be changed in different versions - if (!e.getMessage().contains(String.format("Keyspace '%s' does not exist", - this.keyspace))) { - throw e; - } - if (this.isSchemaStore()) { - LOG.info("Failed to connect keyspace: {}, try to init keyspace later", - this.keyspace); - } - } - } catch (Throwable e) { - try { - this.sessions.close(); - } catch (Throwable e2) { - LOG.warn("Failed to close cluster after an error", e2); - } - throw new ConnectionException("Failed to connect to Cassandra", e); - } - - LOG.debug("Store opened: {}", this.store); - } - - @Override - public void close() { - LOG.debug("Store close: {}", this.store); - this.sessions.close(); - } - - @Override - public boolean opened() { - this.checkClusterConnected(); - return this.sessions.session().opened(); - } - - @Override - public void mutate(BackendMutation mutation) { - if (LOG.isDebugEnabled()) { - LOG.debug("Store {} mutation: {}", this.store, mutation); - } - - this.checkOpened(); - CassandraSessionPool.Session session = this.sessions.session(); - - for (Iterator it = mutation.mutation(); it.hasNext(); ) { - this.mutate(session, it.next()); - } - } - - private void mutate(CassandraSessionPool.Session session, BackendAction item) { - CassandraBackendEntry entry = castBackendEntry(item.entry()); - - // Check if the entry has no change - if (!entry.selfChanged() && entry.subRows().isEmpty()) { - LOG.warn("The entry will be ignored due to no change: {}", entry); - } - - CassandraTable table; - if (!entry.olap()) { - // Oltp table - table = this.table(entry.type()); - } else { - if (entry.type().isIndex()) { - // Olap index - table = this.table(this.olapTableName(entry.type())); - } else { - // Olap vertex - table = this.table(this.olapTableName(entry.subId())); - } - } - - switch (item.action()) { - case INSERT: - // Insert entry - if (entry.selfChanged()) { - table.insert(session, entry.row()); - } - // Insert sub rows (edges) - for (CassandraBackendEntry.Row row : entry.subRows()) { - this.table(row.type()).insert(session, row); - } - break; - case DELETE: - // Delete entry - if (entry.selfChanged()) { - table.delete(session, entry.row()); - } - // Delete sub rows (edges) - for (CassandraBackendEntry.Row row : entry.subRows()) { - this.table(row.type()).delete(session, row); - } - break; - case APPEND: - // Append entry - if (entry.selfChanged()) { - table.append(session, entry.row()); - } - // Append sub rows (edges) - for (CassandraBackendEntry.Row row : entry.subRows()) { - this.table(row.type()).append(session, row); - } - break; - case ELIMINATE: - // Eliminate entry - if (entry.selfChanged()) { - table.eliminate(session, entry.row()); - } - // Eliminate sub rows (edges) - for (CassandraBackendEntry.Row row : entry.subRows()) { - this.table(row.type()).eliminate(session, row); - } - break; - case UPDATE_IF_PRESENT: - if (entry.selfChanged()) { - // TODO: forward to master-writer node - table.updateIfPresent(session, entry.row()); - } - assert entry.subRows().isEmpty() : entry.subRows(); - break; - case UPDATE_IF_ABSENT: - if (entry.selfChanged()) { - // TODO: forward to master-writer node - table.updateIfAbsent(session, entry.row()); - } - assert entry.subRows().isEmpty() : entry.subRows(); - break; - default: - throw new AssertionError(String.format( - "Unsupported mutate action: %s", item.action())); - } - } - - @Override - public Iterator query(Query query) { - this.checkOpened(); - HugeType type = CassandraTable.tableType(query); - String tableName = query.olap() ? this.olapTableName(type) : - type.string(); - CassandraTable table = this.table(tableName); - Iterator entries = table.query(this.session(null), query); - // Merge olap results as needed - Set olapPks = query.olapPks(); - if (this.isGraphStore && !olapPks.isEmpty()) { - List> iterators = new ArrayList<>(); - for (Id pk : olapPks) { - Query q = query.copy(); - table = this.table(this.olapTableName(pk)); - iterators.add(table.query(this.session(null), q)); - } - entries = new MergeIterator<>(entries, iterators, - BackendEntry::mergeable); - } - return entries; - } - - @Override - public Number queryNumber(Query query) { - this.checkOpened(); - - CassandraTable table = this.table(CassandraTable.tableType(query)); - return table.queryNumber(this.sessions.session(), query); - } - - @Override - public BackendFeatures features() { - return FEATURES; - } - - @Override - public void init() { - this.checkClusterConnected(); - - // Create keyspace if needed - if (!this.existsKeyspace()) { - this.initKeyspace(); - } - - if (this.sessions.session().opened()) { - // Session has ever been opened. - LOG.warn("Session has ever been opened(exist keyspace '{}' before)", - this.keyspace); - } else { - // Open session explicitly to get the exception when it fails - this.sessions.session().open(); - } - - // Create tables - this.checkOpened(); - this.initTables(); - - LOG.debug("Store initialized: {}", this.store); - } - - @Override - public void clear(boolean clearSpace) { - this.checkClusterConnected(); - - if (this.existsKeyspace()) { - if (!clearSpace) { - this.checkOpened(); - this.clearTables(); - } else { - this.clearKeyspace(); - } - } - - LOG.debug("Store cleared: {}", this.store); - } - - @Override - public boolean initialized() { - this.checkClusterConnected(); - - if (!this.existsKeyspace()) { - return false; - } - for (CassandraTable table : this.tables()) { - if (!this.existsTable(table.table())) { - return false; - } - } - return true; - } - - @Override - public void truncate() { - this.checkOpened(); - - this.truncateTables(); - LOG.debug("Store truncated: {}", this.store); - } - - @Override - public void beginTx() { - this.checkOpened(); - - CassandraSessionPool.Session session = this.sessions.session(); - if (session.txState() != TxState.CLEAN) { - LOG.warn("Store {} expect state CLEAN than {} when begin()", - this.store, session.txState()); - } - session.txState(TxState.BEGIN); - } - - @Override - public void commitTx() { - this.checkOpened(); - - CassandraSessionPool.Session session = this.sessions.session(); - if (session.txState() != TxState.BEGIN) { - LOG.warn("Store {} expect state BEGIN than {} when commit()", - this.store, session.txState()); - } - - if (!session.hasChanges()) { - session.txState(TxState.CLEAN); - LOG.debug("Store {} has nothing to commit", this.store); - return; - } - - if (LOG.isDebugEnabled()) { - LOG.debug("Store {} commit {} statements: {}", this.store, - session.statements().size(), session.statements()); - } - - // TODO how to implement tx perfectly? - - // Do update - session.txState(TxState.COMMITTING); - try { - session.commit(); - session.txState(TxState.CLEAN); - } catch (DriverException e) { - session.txState(TxState.COMMITT_FAIL); - LOG.error("Failed to commit statements due to:", e); - assert !session.statements().isEmpty(); - throw new BackendException( - "Failed to commit %s statements: '%s'...", e, - session.statements().size(), - session.statements().iterator().next()); - } - } - - @Override - public void rollbackTx() { - this.checkOpened(); - - CassandraSessionPool.Session session = this.sessions.session(); - - // TODO how to implement perfectly? - - if (session.txState() != TxState.COMMITT_FAIL && - session.txState() != TxState.CLEAN) { - LOG.warn("Store {} expect state COMMIT_FAIL/COMMITTING/CLEAN " + - "than {} when rollback()", this.store, session.txState()); - } - - session.txState(TxState.ROLLBACKING); - try { - session.rollback(); - } finally { - // Assume batch commit would auto rollback - session.txState(TxState.CLEAN); - } - } - - protected Cluster cluster() { - return this.sessions.cluster(); - } - - protected boolean existsKeyspace() { - return this.cluster().getMetadata().getKeyspace(this.keyspace) != null; - } - - protected boolean existsTable(String table) { - KeyspaceMetadata keyspace = this.cluster().getMetadata().getKeyspace(this.keyspace); - return keyspace != null && keyspace.getTable(table) != null; - } - - protected void initKeyspace() { - Statement stmt = SchemaBuilder.createKeyspace(this.keyspace) - .ifNotExists().with() - .replication(parseReplica(this.conf)); - // Create keyspace with non-keyspace-session - LOG.debug("Create keyspace: {}", stmt); - Session session = this.cluster().connect(); - try { - session.execute(stmt); - } finally { - if (!session.isClosed()) { - session.close(); - } - } - } - - private static Map parseReplica(HugeConfig conf) { - Map replication = new HashMap<>(); - // Replication strategy: SimpleStrategy or NetworkTopologyStrategy - String strategy = conf.get(CassandraOptions.CASSANDRA_STRATEGY); - replication.put("class", strategy); - - switch (strategy) { - case "SimpleStrategy": - List replicas = - conf.get(CassandraOptions.CASSANDRA_REPLICATION); - E.checkArgument(replicas.size() == 1, - "Individual factor value should be provided " + - "with SimpleStrategy for Cassandra"); - int factor = convertFactor(replicas.get(0)); - replication.put("replication_factor", factor); - break; - case "NetworkTopologyStrategy": - // The replicas format is like 'dc1:2,dc2:1' - Map replicaMap = - conf.getMap(CassandraOptions.CASSANDRA_REPLICATION); - for (Map.Entry e : replicaMap.entrySet()) { - E.checkArgument(!e.getKey().isEmpty(), - "The datacenter can't be empty"); - replication.put(e.getKey(), convertFactor(e.getValue())); - } - break; - default: - throw new AssertionError(String.format( - "Illegal replication strategy '%s', valid strategy " + - "is 'SimpleStrategy' or 'NetworkTopologyStrategy'", - strategy)); - } - return replication; - } - - private static int convertFactor(String factor) { - try { - return Integer.parseInt(factor); - } catch (NumberFormatException e) { - throw new BackendException( - "Expect int factor value for SimpleStrategy, " + - "but got '%s'", factor); - } - } - - protected void clearKeyspace() { - // Drop keyspace with non-keyspace-session - Statement stmt = SchemaBuilder.dropKeyspace(this.keyspace).ifExists(); - LOG.debug("Drop keyspace: {}", stmt); - - Session session = this.cluster().connect(); - try { - session.execute(stmt); - } finally { - if (!session.isClosed()) { - session.close(); - } - } - } - - protected void initTables() { - CassandraSessionPool.Session session = this.sessions.session(); - for (CassandraTable table : this.tables()) { - table.init(session); - } - } - - protected void clearTables() { - CassandraSessionPool.Session session = this.sessions.session(); - for (CassandraTable table : this.tables()) { - table.clear(session); - } - } - - protected void truncateTables() { - CassandraSessionPool.Session session = this.sessions.session(); - for (CassandraTable table : this.tables()) { - if (table.isOlap()) { - table.dropTable(session); - } else { - table.truncate(session); - } - } - } - - protected Collection tables() { - return this.tables.values(); - } - - @Override - protected final CassandraTable table(HugeType type) { - return this.table(convertTaskOrServerToVertex(type).string()); - } - - protected final CassandraTable table(String name) { - assert name != null; - CassandraTable table = this.tables.get(name); - if (table == null) { - throw new BackendException("Unsupported table: %s", name); - } - return table; - } - - @Override - protected CassandraSessionPool.Session session(HugeType type) { - this.checkOpened(); - return this.sessions.session(); - } - - protected final void checkClusterConnected() { - E.checkState(this.sessions != null && this.sessions.clusterConnected(), - "Cassandra cluster has not been connected"); - } - - protected static final CassandraBackendEntry castBackendEntry(BackendEntry entry) { - assert entry instanceof CassandraBackendEntry : entry.getClass(); - if (!(entry instanceof CassandraBackendEntry)) { - throw new BackendException("Cassandra store only supports CassandraBackendEntry"); - } - return (CassandraBackendEntry) entry; - } - - /***************************** Store defines *****************************/ - - public static class CassandraSchemaStore extends CassandraStore { - - private final CassandraTables.Counters counters; - - public CassandraSchemaStore(BackendStoreProvider provider, - String keyspace, String store) { - super(provider, keyspace, store); - - this.counters = new CassandraTables.Counters(); - - registerTableManager(HugeType.VERTEX_LABEL, - new CassandraTables.VertexLabel()); - registerTableManager(HugeType.EDGE_LABEL, - new CassandraTables.EdgeLabel()); - registerTableManager(HugeType.PROPERTY_KEY, - new CassandraTables.PropertyKey()); - registerTableManager(HugeType.INDEX_LABEL, - new CassandraTables.IndexLabel()); - } - - @Override - protected Collection tables() { - List tables = new ArrayList<>(super.tables()); - tables.add(this.counters); - return tables; - } - - @Override - public void increaseCounter(HugeType type, long increment) { - this.checkOpened(); - CassandraSessionPool.Session session = super.sessions.session(); - this.counters.increaseCounter(session, type, increment); - } - - @Override - public long getCounter(HugeType type) { - this.checkOpened(); - CassandraSessionPool.Session session = super.sessions.session(); - return this.counters.getCounter(session, type); - } - - @Override - public boolean isSchemaStore() { - return true; - } - } - - public static class CassandraGraphStore extends CassandraStore { - - public CassandraGraphStore(BackendStoreProvider provider, - String keyspace, String store) { - super(provider, keyspace, store); - - registerTableManager(HugeType.VERTEX, - new CassandraTables.Vertex(store)); - - registerTableManager(HugeType.EDGE_OUT, - CassandraTables.Edge.out(store)); - registerTableManager(HugeType.EDGE_IN, - CassandraTables.Edge.in(store)); - - registerTableManager(HugeType.SECONDARY_INDEX, - new CassandraTables.SecondaryIndex(store)); - registerTableManager(HugeType.RANGE_INT_INDEX, - new CassandraTables.RangeIntIndex(store)); - registerTableManager(HugeType.RANGE_FLOAT_INDEX, - new CassandraTables.RangeFloatIndex(store)); - registerTableManager(HugeType.RANGE_LONG_INDEX, - new CassandraTables.RangeLongIndex(store)); - registerTableManager(HugeType.RANGE_DOUBLE_INDEX, - new CassandraTables.RangeDoubleIndex(store)); - registerTableManager(HugeType.SEARCH_INDEX, - new CassandraTables.SearchIndex(store)); - registerTableManager(HugeType.SHARD_INDEX, - new CassandraTables.ShardIndex(store)); - registerTableManager(HugeType.UNIQUE_INDEX, - new CassandraTables.UniqueIndex(store)); - - registerTableManager(this.olapTableName(HugeType.SECONDARY_INDEX), - new CassandraTables.OlapSecondaryIndex(store)); - registerTableManager(this.olapTableName(HugeType.RANGE_INT_INDEX), - new CassandraTables.OlapRangeIntIndex(store)); - registerTableManager(this.olapTableName(HugeType.RANGE_LONG_INDEX), - new CassandraTables.OlapRangeLongIndex(store)); - registerTableManager(this.olapTableName(HugeType.RANGE_FLOAT_INDEX), - new CassandraTables.OlapRangeFloatIndex(store)); - registerTableManager(this.olapTableName(HugeType.RANGE_DOUBLE_INDEX), - new CassandraTables.OlapRangeDoubleIndex(store)); - } - - @Override - public Id nextId(HugeType type) { - throw new UnsupportedOperationException( - "CassandraGraphStore.nextId()"); - } - - @Override - public void increaseCounter(HugeType type, long num) { - throw new UnsupportedOperationException( - "CassandraGraphStore.increaseCounter()"); - } - - @Override - public long getCounter(HugeType type) { - throw new UnsupportedOperationException( - "CassandraGraphStore.getCounter()"); - } - - @Override - public boolean isSchemaStore() { - return false; - } - - /** - * TODO: can we remove this method since createOlapTable would register? - */ - @Override - public void checkAndRegisterOlapTable(Id id) { - CassandraTable table = new CassandraTables.Olap(this.store(), id); - if (!this.existsTable(table.table())) { - throw new HugeException("Not exist table '%s'", table.table()); - } - registerTableManager(this.olapTableName(id), table); - } - - @Override - public void createOlapTable(Id id) { - CassandraTable table = new CassandraTables.Olap(this.store(), id); - table.init(this.session(null)); - registerTableManager(this.olapTableName(id), table); - } - - @Override - public void clearOlapTable(Id id) { - String name = this.olapTableName(id); - CassandraTable table = this.table(name); - if (!this.existsTable(table.table())) { - throw new HugeException("Not exist table '%s'", name); - } - table.truncate(this.session(null)); - } - - @Override - public void removeOlapTable(Id id) { - String name = this.olapTableName(id); - CassandraTable table = this.table(name); - if (!this.existsTable(table.table())) { - throw new HugeException("Not exist table '%s'", name); - } - table.dropTable(this.session(null)); - this.unregisterTableManager(name); - } - } - - public static class CassandraSystemStore extends CassandraGraphStore { - - private final CassandraTables.Meta meta; - - public CassandraSystemStore(BackendStoreProvider provider, String keyspace, String store) { - super(provider, keyspace, store); - - this.meta = new CassandraTables.Meta(); - } - - @Override - public void init() { - super.init(); - this.checkOpened(); - String driverVersion = this.provider().driverVersion(); - this.meta.writeVersion(this.session(null), driverVersion); - LOG.info("Write down the backend version: {}", driverVersion); - } - - @Override - public String storedVersion() { - CassandraSessionPool.Session session = this.session(null); - return this.meta.readVersion(session); - } - - @Override - protected Collection tables() { - List tables = new ArrayList<>(super.tables()); - tables.add(this.meta); - return tables; - } - } -} diff --git a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraStoreProvider.java b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraStoreProvider.java deleted file mode 100644 index adf2d9f3f2..0000000000 --- a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraStoreProvider.java +++ /dev/null @@ -1,75 +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.hugegraph.backend.store.cassandra; - -import org.apache.hugegraph.backend.store.AbstractBackendStoreProvider; -import org.apache.hugegraph.backend.store.BackendStore; -import org.apache.hugegraph.backend.store.cassandra.CassandraStore.CassandraGraphStore; -import org.apache.hugegraph.backend.store.cassandra.CassandraStore.CassandraSchemaStore; -import org.apache.hugegraph.backend.store.cassandra.CassandraStore.CassandraSystemStore; -import org.apache.hugegraph.config.HugeConfig; - -public class CassandraStoreProvider extends AbstractBackendStoreProvider { - - protected String keyspace() { - return this.graph().toLowerCase(); - } - - @Override - protected BackendStore newSchemaStore(HugeConfig config, String store) { - return new CassandraSchemaStore(this, this.keyspace(), store); - } - - @Override - protected BackendStore newGraphStore(HugeConfig config, String store) { - return new CassandraGraphStore(this, this.keyspace(), store); - } - - @Override - protected BackendStore newSystemStore(HugeConfig config, String store) { - return new CassandraSystemStore(this, this.keyspace(), store); - } - - @Override - public String type() { - return "cassandra"; - } - - @Override - public String driverVersion() { - /* - * Versions history: - * [1.0] HugeGraph-1328: supports backend table version checking - * [1.1] HugeGraph-1322: add support for full-text search - * [1.2] #296: support range sortKey feature - * [1.3] #455: fix scylladb backend doesn't support label query in page - * [1.4] #270 & #398: support shard-index and vertex + sortkey prefix, - * also split range table to rangeInt, rangeFloat, - * rangeLong and rangeDouble - * [1.5] #633: support unique index - * [1.6] #661 & #680: support bin serialization for cassandra - * [1.7] #691: support aggregate property - * [1.8] #746: support userdata for indexlabel - * [1.9] #295: support ttl for vertex and edge - * [1.10] #1333: support read frequency for property key - * [1.11] #1506: support olap properties - * [1.11] #1533: add meta table in system store - */ - return "1.11"; - } -} diff --git a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraTable.java b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraTable.java deleted file mode 100644 index 15ad1a7bd3..0000000000 --- a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraTable.java +++ /dev/null @@ -1,679 +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.hugegraph.backend.store.cassandra; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.function.BiFunction; -import java.util.function.Function; - -import org.apache.hugegraph.backend.BackendException; -import org.apache.hugegraph.backend.id.Id; -import org.apache.hugegraph.backend.page.PageState; -import org.apache.hugegraph.backend.query.Aggregate; -import org.apache.hugegraph.backend.query.Condition; -import org.apache.hugegraph.backend.query.Condition.Relation; -import org.apache.hugegraph.backend.query.IdQuery; -import org.apache.hugegraph.backend.query.Query; -import org.apache.hugegraph.backend.query.Query.Order; -import org.apache.hugegraph.backend.store.BackendEntry; -import org.apache.hugegraph.backend.store.BackendTable; -import org.apache.hugegraph.backend.store.Shard; -import org.apache.hugegraph.exception.NotFoundException; -import org.apache.hugegraph.exception.NotSupportException; -import org.apache.hugegraph.iterator.ExtendableIterator; -import org.apache.hugegraph.iterator.WrappedIterator; -import org.apache.hugegraph.type.HugeType; -import org.apache.hugegraph.type.define.HugeKeys; -import org.apache.hugegraph.util.CopyUtil; -import org.apache.hugegraph.util.E; -import org.apache.hugegraph.util.Log; -import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils; -import org.slf4j.Logger; - -import com.datastax.driver.core.ColumnDefinitions.Definition; -import com.datastax.driver.core.DataType; -import com.datastax.driver.core.PagingState; -import com.datastax.driver.core.ResultSet; -import com.datastax.driver.core.Row; -import com.datastax.driver.core.Statement; -import com.datastax.driver.core.exceptions.DriverException; -import com.datastax.driver.core.exceptions.PagingStateException; -import com.datastax.driver.core.querybuilder.Clause; -import com.datastax.driver.core.querybuilder.Clauses; -import com.datastax.driver.core.querybuilder.Delete; -import com.datastax.driver.core.querybuilder.Insert; -import com.datastax.driver.core.querybuilder.QueryBuilder; -import com.datastax.driver.core.querybuilder.Select; -import com.datastax.driver.core.querybuilder.Select.Selection; -import com.datastax.driver.core.querybuilder.Update; -import com.datastax.driver.core.schemabuilder.Create; -import com.datastax.driver.core.schemabuilder.SchemaBuilder; -import com.datastax.driver.core.schemabuilder.SchemaStatement; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; - -public abstract class CassandraTable - extends BackendTable { - - private static final Logger LOG = Log.logger(CassandraTable.class); - private static final int MAX_ELEMENTS_IN_CLAUSE = 65535; - - public CassandraTable(String table) { - super(table); - } - - @Override - protected void registerMetaHandlers() { - this.registerMetaHandler("splits", (session, meta, args) -> { - E.checkArgument(args.length == 1, - "The args count of %s must be 1", meta); - long splitSize = (long) args[0]; - CassandraShard splitter = new CassandraShard(session, - session.keyspace(), - this.table()); - return splitter.getSplits(0, splitSize); - }); - } - - @Override - public boolean queryExist(CassandraSessionPool.Session session, - CassandraBackendEntry.Row entry) { - Query query = new IdQuery.OneIdQuery(HugeType.UNKNOWN, entry.id()); - Iterator iter = this.query(session, query); - try { - return iter.hasNext(); - } finally { - WrappedIterator.close(iter); - } - } - - @Override - public Number queryNumber(CassandraSessionPool.Session session, - Query query) { - Aggregate aggregate = query.aggregateNotNull(); - Iterator results = this.query(query, statement -> { - // Set request timeout to a large value - int timeout = session.aggregateTimeout(); - statement.setReadTimeoutMillis(timeout * 1000); - return session.query(statement); - }, (q, rs) -> { - Row row = rs.one(); - if (row == null) { - return IteratorUtils.of(aggregate.defaultValue()); - } - return IteratorUtils.of(row.getLong(0)); - }); - return aggregate.reduce(results); - } - - @Override - public Iterator query(CassandraSessionPool.Session session, - Query query) { - return this.query(query, session::query, this::results2Entries); - } - - protected Iterator query(Query query, - Function fetcher, - BiFunction> parser) { - ExtendableIterator rs = new ExtendableIterator<>(); - - if (query.limit() == 0L && !query.noLimit()) { - LOG.debug("Return empty result(limit=0) for query {}", query); - return rs; - } - - List query2Select(String table, Query query) { - // Build query - Selection selection = QueryBuilder.select(); - - // Set aggregate - Aggregate aggregate = query.aggregate(); - if (aggregate != null) { - if (aggregate.countAll()) { - selection.countAll(); - } else { - selection.fcall(aggregate.func().string(), aggregate.column()); - } - } - - // Set table - Select select = selection.from(table); - - // NOTE: Cassandra does not support query.offset() - if (query.offset() != 0) { - LOG.debug("Query offset is not supported on Cassandra store " + - "currently, it will be replaced by [0, offset + limit)"); - } - - // Set order-by - for (Map.Entry order : query.orders().entrySet()) { - String name = formatKey(order.getKey()); - if (order.getValue() == Order.ASC) { - select.orderBy(QueryBuilder.asc(name)); - } else { - assert order.getValue() == Order.DESC; - select.orderBy(QueryBuilder.desc(name)); - } - } - - // Is query by id? - List conds = new ArrayList<>(ids.size()); - for (Select id : ids) { - // Query by condition - conds.addAll(this.queryCondition2Select(query, id)); - } - this.setPageState(query, conds); - LOG.debug("Query by conditions: {}", conds); - return conds; - } - } - - protected void setPageState(Query query, List queryId2Select(Query query, Select select) { - // Query by id(s) - if (query.idsSize() == 0) { - return ImmutableList.of(select); - } - - List nameParts = this.idColumnName(); - - List> ids = new ArrayList<>(query.idsSize()); - for (Id id : query.ids()) { - List idParts = this.idColumnValue(id); - if (nameParts.size() != idParts.size()) { - throw new NotFoundException( - "Unsupported ID format: '%s' (should contain %s)", - id, nameParts); - } - ids.add(idParts); - } - - // Query only by partition-key - if (nameParts.size() == 1) { - List idList = new ArrayList<>(ids.size()); - for (List id : ids) { - assert id.size() == 1; - idList.add(id.get(0)); - } - return this.ids2IdSelects(select, nameParts.get(0), idList); - } - - /* - * Query by partition-key + clustering-key - * NOTE: Error if multi-column IN clause include partition key: - * error: multi-column relations can only be applied to clustering - * columns when using: select.where(QueryBuilder.in(names, idList)); - * So we use multi-query instead of IN - */ - List queryCondition2Select(Query query, - Select select) { - // Query by conditions - Collection conditions = query.conditions(); - for (Condition condition : conditions) { - Clause clause = condition2Cql(condition); - select.where(clause); - if (Clauses.needAllowFiltering(clause)) { - select.allowFiltering(); - } - } - return ImmutableList.of(select); - } - - protected Clause condition2Cql(Condition condition) { - switch (condition.type()) { - case AND: - Condition.And and = (Condition.And) condition; - Clause left = condition2Cql(and.left()); - Clause right = condition2Cql(and.right()); - return Clauses.and(left, right); - case OR: - throw new BackendException("Not support OR currently"); - case RELATION: - Condition.Relation r = (Condition.Relation) condition; - return relation2Cql(r); - default: - final String msg = "Unsupported condition: " + condition; - throw new AssertionError(msg); - } - } - - protected Clause relation2Cql(Relation relation) { - String key = relation.serialKey().toString(); - Object value = relation.serialValue(); - - switch (relation.relation()) { - case EQ: - return QueryBuilder.eq(key, value); - case GT: - return QueryBuilder.gt(key, value); - case GTE: - return QueryBuilder.gte(key, value); - case LT: - return QueryBuilder.lt(key, value); - case LTE: - return QueryBuilder.lte(key, value); - case IN: - return Clauses.in(key, (List) value); - case CONTAINS_VALUE: - return QueryBuilder.contains(key, value); - case CONTAINS_KEY: - return QueryBuilder.containsKey(key, value); - case SCAN: - String[] col = pkColumnName().stream() - .map(CassandraTable::formatKey) - .toArray(String[]::new); - Shard shard = (Shard) value; - Object start = QueryBuilder.raw(shard.start()); - Object end = QueryBuilder.raw(shard.end()); - return Clauses.and( - QueryBuilder.gte(QueryBuilder.token(col), start), - QueryBuilder.lt(QueryBuilder.token(col), end)); - /* - * Currently we can't support LIKE due to error: - * "cassandra no viable alternative at input 'like'..." - */ - // case LIKE: - // return QueryBuilder.like(key, value); - case NEQ: - default: - throw new NotSupportException("relation '%s'", relation); - } - } - - private List selects = new ArrayList<>(); - for (int i = 0, j; i < size; i = j) { - j = Math.min(i + MAX_ELEMENTS_IN_CLAUSE, size); - Select idSelect = cloneSelect(select, this.table()); - idSelect.where(QueryBuilder.in(formatKey(key), ids.subList(i, j))); - selects.add(idSelect); - } - return selects; - } - - protected static Select cloneSelect(Select select, String table) { - // NOTE: there is no Select.clone(), just use copy instead - return CopyUtil.copy(select, QueryBuilder.select().from(table)); - } - - protected Iterator results2Entries(Query q, ResultSet r) { - return new CassandraEntryIterator(r, q, (e1, row) -> { - CassandraBackendEntry e2 = row2Entry(q.resultType(), row); - return this.mergeEntries(e1, e2); - }); - } - - protected static CassandraBackendEntry row2Entry(HugeType type, Row row) { - CassandraBackendEntry entry = new CassandraBackendEntry(type); - - List cols = row.getColumnDefinitions().asList(); - for (Definition col : cols) { - String name = col.getName(); - HugeKeys key = CassandraTable.parseKey(name); - Object value = row.getObject(name); - if (value == null) { - assert key == HugeKeys.EXPIRED_TIME; - continue; - } - entry.column(key, value); - } - - return entry; - } - - protected List pkColumnName() { - return idColumnName(); - } - - protected List idColumnName() { - return ImmutableList.of(HugeKeys.ID); - } - - protected List idColumnValue(Id id) { - return ImmutableList.of(id.asObject()); - } - - protected List idColumnValue(CassandraBackendEntry.Row entry) { - return ImmutableList.of(entry.id().asLong()); - } - - protected List modifiableColumnName() { - return ImmutableList.of(HugeKeys.PROPERTIES); - } - - protected BackendEntry mergeEntries(BackendEntry e1, BackendEntry e2) { - // Return the next entry (not merged) - return e2; - } - - public static final String formatKey(HugeKeys key) { - return key.name(); - } - - public static final HugeKeys parseKey(String name) { - return HugeKeys.valueOf(name.toUpperCase()); - } - - public static final Clause formatEQ(HugeKeys key, Object value) { - return QueryBuilder.eq(formatKey(key), value); - } - - /** - * Insert an entire row - */ - @Override - public void insert(CassandraSessionPool.Session session, - CassandraBackendEntry.Row entry) { - session.add(this.buildInsert(entry)); - } - - /** - * Append several elements to the collection column of a row - */ - @Override - public void append(CassandraSessionPool.Session session, - CassandraBackendEntry.Row entry) { - session.add(this.buildAppend(entry)); - } - - /** - * Eliminate several elements from the collection column of a row - */ - @Override - public void eliminate(CassandraSessionPool.Session session, - CassandraBackendEntry.Row entry) { - session.add(this.buildEliminate(entry)); - } - - /** - * Delete an entire row - */ - @Override - public void delete(CassandraSessionPool.Session session, - CassandraBackendEntry.Row entry) { - session.add(this.buildDelete(entry)); - } - - protected Insert buildInsert(CassandraBackendEntry.Row entry) { - assert !entry.columns().isEmpty(); - Insert insert = QueryBuilder.insertInto(this.table()); - - for (Map.Entry c : entry.columns().entrySet()) { - insert.value(formatKey(c.getKey()), c.getValue()); - } - return insert; - } - - protected Update buildAppend(CassandraBackendEntry.Row entry) { - List idNames = this.idColumnName(); - List colNames = this.modifiableColumnName(); - - Map columns = entry.columns(); - - Update update = QueryBuilder.update(table()); - - for (HugeKeys key : colNames) { - if (!columns.containsKey(key)) { - continue; - } - - String name = formatKey(key); - Object value = columns.get(key); - - if (value instanceof Map) { - update.with(QueryBuilder.putAll(name, (Map) value)); - } else if (value instanceof List) { - update.with(QueryBuilder.appendAll(name, (List) value)); - } else { - update.with(QueryBuilder.append(name, value)); - } - } - - for (HugeKeys idName : idNames) { - assert columns.containsKey(idName); - update.where(formatEQ(idName, columns.get(idName))); - } - return update; - } - - protected Update buildEliminate(CassandraBackendEntry.Row entry) { - List idNames = this.idColumnName(); - List colNames = this.modifiableColumnName(); - - Map columns = entry.columns(); - - // Update by id - Update update = QueryBuilder.update(table()); - - for (HugeKeys key : colNames) { - /* - * NOTE: eliminate from map should just pass key, - * if we use the following statement: - * UPDATE vertices SET PROPERTIES=PROPERTIES-{'city':'"Wuhan"'} - * WHERE LABEL='person' AND PRIMARY_VALUES='josh'; - * it will throw a cassandra exception: - * Invalid map literal for properties of type-frozen> - */ - if (!columns.containsKey(key)) { - continue; - } - - String name = formatKey(key); - Object value = columns.get(key); - if (value instanceof Map) { - @SuppressWarnings("rawtypes") - Set keySet = ((Map) value).keySet(); - update.with(QueryBuilder.removeAll(name, keySet)); - } else if (value instanceof Set) { - update.with(QueryBuilder.removeAll(name, (Set) value)); - } else if (value instanceof List) { - Set keySet = new HashSet<>((List) value); - update.with(QueryBuilder.removeAll(name, keySet)); - } else { - update.with(QueryBuilder.remove(name, value)); - } - } - - for (HugeKeys idName : idNames) { - assert columns.containsKey(idName); - update.where(formatEQ(idName, columns.get(idName))); - } - return update; - } - - protected Delete buildDelete(CassandraBackendEntry.Row entry) { - List idNames = this.idColumnName(); - Delete delete = QueryBuilder.delete().from(this.table()); - - if (entry.columns().isEmpty()) { - // Delete just by id - List idValues = this.idColumnValue(entry); - assert idNames.size() == idValues.size(); - - for (int i = 0, n = idNames.size(); i < n; i++) { - delete.where(formatEQ(idNames.get(i), idValues.get(i))); - } - } else { - // Delete just by column keys(must be id columns) - for (HugeKeys idName : idNames) { - // TODO: should support other filters (like containsKey) - delete.where(formatEQ(idName, entry.column(idName))); - } - /* - * TODO: delete by id + keys(like index element-ids -- it seems - * has been replaced by eliminate() method) - */ - } - return delete; - } - - protected void createTable(CassandraSessionPool.Session session, - ImmutableMap partitionKeys, - ImmutableMap clusteringKeys, - ImmutableMap columns) { - - Create table = SchemaBuilder.createTable(this.table()).ifNotExists(); - - for (Map.Entry entry : partitionKeys.entrySet()) { - table.addPartitionKey(formatKey(entry.getKey()), entry.getValue()); - } - for (Map.Entry entry : clusteringKeys.entrySet()) { - table.addClusteringColumn(formatKey(entry.getKey()), - entry.getValue()); - } - for (Map.Entry entry : columns.entrySet()) { - table.addColumn(formatKey(entry.getKey()), entry.getValue()); - } - - LOG.debug("Create table: {}", table); - session.execute(table); - } - - protected void dropTable(CassandraSessionPool.Session session) { - LOG.debug("Drop table: {}", this.table()); - session.execute(SchemaBuilder.dropTable(this.table()).ifExists()); - } - - protected void truncateTable(CassandraSessionPool.Session session) { - LOG.debug("Truncate table: {}", this.table()); - session.execute(QueryBuilder.truncate(this.table())); - } - - protected void createIndex(CassandraSessionPool.Session session, - String indexLabel, HugeKeys column) { - String indexName = joinTableName(this.table(), indexLabel); - SchemaStatement index = SchemaBuilder.createIndex(indexName) - .ifNotExists() - .onTable(this.table()) - .andColumn(formatKey(column)); - LOG.debug("Create index: {}", index); - session.execute(index); - } - - @Override - public void clear(CassandraSessionPool.Session session) { - this.dropTable(session); - } - - public void truncate(CassandraSessionPool.Session session) { - this.truncateTable(session); - } - - public boolean isOlap() { - return false; - } -} diff --git a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraTables.java b/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraTables.java deleted file mode 100644 index ece8f2ae8e..0000000000 --- a/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraTables.java +++ /dev/null @@ -1,995 +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.hugegraph.backend.store.cassandra; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Iterator; -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; - -import org.apache.hugegraph.backend.BackendException; -import org.apache.hugegraph.backend.id.EdgeId; -import org.apache.hugegraph.backend.id.Id; -import org.apache.hugegraph.backend.id.IdGenerator; -import org.apache.hugegraph.backend.id.IdUtil; -import org.apache.hugegraph.backend.query.Query; -import org.apache.hugegraph.backend.store.BackendEntry; -import org.apache.hugegraph.backend.store.BackendEntryIterator; -import org.apache.hugegraph.type.HugeType; -import org.apache.hugegraph.type.define.Directions; -import org.apache.hugegraph.type.define.HugeKeys; -import org.apache.hugegraph.util.E; - -import com.datastax.driver.core.DataType; -import com.datastax.driver.core.ResultSet; -import com.datastax.driver.core.Row; -import com.datastax.driver.core.Statement; -import com.datastax.driver.core.exceptions.DriverException; -import com.datastax.driver.core.querybuilder.BuiltStatement; -import com.datastax.driver.core.querybuilder.Clause; -import com.datastax.driver.core.querybuilder.Delete; -import com.datastax.driver.core.querybuilder.Insert; -import com.datastax.driver.core.querybuilder.QueryBuilder; -import com.datastax.driver.core.querybuilder.Select; -import com.datastax.driver.core.querybuilder.Update; -import com.datastax.driver.core.querybuilder.Using; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; - -import org.apache.hugegraph.util.HashUtil; - -public class CassandraTables { - - public static final String LABEL_INDEX = "label_index"; - public static final String NAME_INDEX = "name_index"; - - private static final DataType TYPE_PK = DataType.cint(); - private static final DataType TYPE_SL = DataType.cint(); // VL/EL - private static final DataType TYPE_IL = DataType.cint(); - - private static final DataType TYPE_UD = DataType.map(DataType.text(), - DataType.text()); - - private static final DataType TYPE_ID = DataType.blob(); - private static final DataType TYPE_PROP = DataType.blob(); - - private static final DataType TYPE_TTL = DataType.bigint(); - private static final DataType TYPE_EXPIRED_TIME = DataType.bigint(); - - private static final long COMMIT_DELETE_BATCH = Query.COMMIT_BATCH; - - public static class Meta extends CassandraTable { - - public static final String TABLE = HugeType.META.string(); - - public Meta() { - super(TABLE); - } - - @Override - public void init(CassandraSessionPool.Session session) { - ImmutableMap pkeys = ImmutableMap.of( - HugeKeys.NAME, DataType.text() - ); - ImmutableMap ckeys = ImmutableMap.of(); - ImmutableMap columns = ImmutableMap.of( - HugeKeys.VALUE, DataType.text() - ); - - this.createTable(session, pkeys, ckeys, columns); - } - - public void writeVersion(CassandraSessionPool.Session session, - String version) { - Insert insert = QueryBuilder.insertInto(TABLE); - insert.value(formatKey(HugeKeys.NAME), formatKey(HugeKeys.VERSION)); - insert.value(formatKey(HugeKeys.VALUE), version); - session.execute(insert); - } - - public String readVersion(CassandraSessionPool.Session session) { - Clause where = formatEQ(HugeKeys.NAME, formatKey(HugeKeys.VERSION)); - Select select = QueryBuilder.select(formatKey(HugeKeys.VALUE)) - .from(TABLE); - select.where(where); - Row row = session.execute(select).one(); - if (row == null) { - return null; - } - return row.getString(formatKey(HugeKeys.VALUE)); - } - } - - public static class Counters extends CassandraTable { - - public static final String TABLE = HugeType.COUNTER.string(); - - public Counters() { - super(TABLE); - } - - @Override - public void init(CassandraSessionPool.Session session) { - ImmutableMap pkeys = ImmutableMap.of( - HugeKeys.SCHEMA_TYPE, DataType.text() - ); - ImmutableMap ckeys = ImmutableMap.of(); - ImmutableMap columns = ImmutableMap.of( - HugeKeys.ID, DataType.counter() - ); - - this.createTable(session, pkeys, ckeys, columns); - } - - public long getCounter(CassandraSessionPool.Session session, - HugeType type) { - Clause where = formatEQ(HugeKeys.SCHEMA_TYPE, type.name()); - Select select = QueryBuilder.select(formatKey(HugeKeys.ID)) - .from(TABLE); - select.where(where); - Row row = session.execute(select).one(); - if (row == null) { - return 0L; - } else { - return row.getLong(formatKey(HugeKeys.ID)); - } - } - - public void increaseCounter(CassandraSessionPool.Session session, - HugeType type, long increment) { - Update update = QueryBuilder.update(TABLE); - update.with(QueryBuilder.incr(formatKey(HugeKeys.ID), increment)); - update.where(formatEQ(HugeKeys.SCHEMA_TYPE, type.name())); - session.execute(update); - } - } - - public static class VertexLabel extends CassandraTable { - - public static final String TABLE = HugeType.VERTEX_LABEL.string(); - - public VertexLabel() { - super(TABLE); - } - - @Override - public void init(CassandraSessionPool.Session session) { - ImmutableMap pkeys = ImmutableMap.of( - HugeKeys.ID, TYPE_SL - ); - ImmutableMap ckeys = ImmutableMap.of(); - ImmutableMap columns = ImmutableMap - .builder() - .put(HugeKeys.NAME, DataType.text()) - .put(HugeKeys.ID_STRATEGY, DataType.tinyint()) - .put(HugeKeys.PRIMARY_KEYS, DataType.list(TYPE_PK)) - .put(HugeKeys.NULLABLE_KEYS, DataType.set(TYPE_PK)) - .put(HugeKeys.INDEX_LABELS, DataType.set(TYPE_IL)) - .put(HugeKeys.PROPERTIES, DataType.set(TYPE_PK)) - .put(HugeKeys.ENABLE_LABEL_INDEX, DataType.cboolean()) - .put(HugeKeys.USER_DATA, TYPE_UD) - .put(HugeKeys.STATUS, DataType.tinyint()) - .put(HugeKeys.TTL, TYPE_TTL) - .put(HugeKeys.TTL_START_TIME, TYPE_PK) - .build(); - - this.createTable(session, pkeys, ckeys, columns); - this.createIndex(session, NAME_INDEX, HugeKeys.NAME); - } - } - - public static class EdgeLabel extends CassandraTable { - - public static final String TABLE = HugeType.EDGE_LABEL.string(); - - public EdgeLabel() { - super(TABLE); - } - - @Override - public void init(CassandraSessionPool.Session session) { - ImmutableMap pkeys = ImmutableMap.of( - HugeKeys.ID, TYPE_SL - ); - ImmutableMap ckeys = ImmutableMap.of(); - ImmutableMap columns = ImmutableMap - .builder() - .put(HugeKeys.NAME, DataType.text()) - .put(HugeKeys.FREQUENCY, DataType.tinyint()) - .put(HugeKeys.SOURCE_LABEL, TYPE_SL) - .put(HugeKeys.TARGET_LABEL, TYPE_SL) - .put(HugeKeys.SORT_KEYS, DataType.list(TYPE_PK)) - .put(HugeKeys.NULLABLE_KEYS, DataType.set(TYPE_PK)) - .put(HugeKeys.INDEX_LABELS, DataType.set(TYPE_IL)) - .put(HugeKeys.PROPERTIES, DataType.set(TYPE_PK)) - .put(HugeKeys.ENABLE_LABEL_INDEX, DataType.cboolean()) - .put(HugeKeys.USER_DATA, TYPE_UD) - .put(HugeKeys.STATUS, DataType.tinyint()) - .put(HugeKeys.TTL, TYPE_TTL) - .put(HugeKeys.TTL_START_TIME, TYPE_PK) - .build(); - - this.createTable(session, pkeys, ckeys, columns); - this.createIndex(session, NAME_INDEX, HugeKeys.NAME); - } - } - - public static class PropertyKey extends CassandraTable { - - public static final String TABLE = HugeType.PROPERTY_KEY.string(); - - public PropertyKey() { - super(TABLE); - } - - @Override - public void init(CassandraSessionPool.Session session) { - ImmutableMap pkeys = ImmutableMap.of( - HugeKeys.ID, DataType.cint() - ); - ImmutableMap ckeys = ImmutableMap.of(); - ImmutableMap columns = ImmutableMap - .builder() - .put(HugeKeys.NAME, DataType.text()) - .put(HugeKeys.DATA_TYPE, DataType.tinyint()) - .put(HugeKeys.CARDINALITY, DataType.tinyint()) - .put(HugeKeys.AGGREGATE_TYPE, DataType.tinyint()) - .put(HugeKeys.WRITE_TYPE, DataType.tinyint()) - .put(HugeKeys.PROPERTIES, DataType.set(TYPE_PK)) - .put(HugeKeys.USER_DATA, TYPE_UD) - .put(HugeKeys.STATUS, DataType.tinyint()) - .build(); - - this.createTable(session, pkeys, ckeys, columns); - this.createIndex(session, NAME_INDEX, HugeKeys.NAME); - } - } - - public static class IndexLabel extends CassandraTable { - - public static final String TABLE = HugeType.INDEX_LABEL.string(); - - public IndexLabel() { - super(TABLE); - } - - @Override - public void init(CassandraSessionPool.Session session) { - ImmutableMap pkeys = ImmutableMap.of( - HugeKeys.ID, TYPE_IL - ); - ImmutableMap ckeys = ImmutableMap.of(); - ImmutableMap columns = ImmutableMap - .builder() - .put(HugeKeys.NAME, DataType.text()) - .put(HugeKeys.BASE_TYPE, DataType.tinyint()) - .put(HugeKeys.BASE_VALUE, TYPE_SL) - .put(HugeKeys.INDEX_TYPE, DataType.tinyint()) - .put(HugeKeys.FIELDS, DataType.list(TYPE_PK)) - .put(HugeKeys.USER_DATA, TYPE_UD) - .put(HugeKeys.STATUS, DataType.tinyint()) - .build(); - - this.createTable(session, pkeys, ckeys, columns); - this.createIndex(session, NAME_INDEX, HugeKeys.NAME); - } - } - - public static class Vertex extends CassandraTable { - - public static final String TABLE = HugeType.VERTEX.string(); - - public Vertex(String store) { - super(joinTableName(store, TABLE)); - } - - @Override - public void init(CassandraSessionPool.Session session) { - ImmutableMap pkeys = ImmutableMap.of( - HugeKeys.ID, TYPE_ID - ); - ImmutableMap ckeys = ImmutableMap.of(); - ImmutableMap columns = ImmutableMap.of( - HugeKeys.LABEL, TYPE_SL, - HugeKeys.PROPERTIES, DataType.map(TYPE_PK, TYPE_PROP), - HugeKeys.EXPIRED_TIME, TYPE_EXPIRED_TIME - ); - - this.createTable(session, pkeys, ckeys, columns); - this.createIndex(session, LABEL_INDEX, HugeKeys.LABEL); - } - - @Override - public void insert(CassandraSessionPool.Session session, - CassandraBackendEntry.Row entry) { - Insert insert = this.buildInsert(entry); - session.add(setTtl(insert, entry)); - } - - @Override - public void append(CassandraSessionPool.Session session, - CassandraBackendEntry.Row entry) { - Update append = this.buildAppend(entry); - session.add(setTtl(append, entry)); - } - } - - public static class Edge extends CassandraTable { - - public static final String TABLE_SUFFIX = HugeType.EDGE.string(); - - private final String store; - private final Directions direction; - - protected Edge(String store, Directions direction) { - super(joinTableName(store, table(direction))); - this.store = store; - this.direction = direction; - } - - protected String edgesTable(Directions direction) { - return joinTableName(this.store, table(direction)); - } - - protected Directions direction() { - return this.direction; - } - - protected String labelIndexTable() { - return this.table(); - } - - @Override - public void init(CassandraSessionPool.Session session) { - ImmutableMap pkeys = ImmutableMap.of( - HugeKeys.OWNER_VERTEX, TYPE_ID - ); - ImmutableMap ckeys = ImmutableMap.of( - HugeKeys.DIRECTION, DataType.tinyint(), - HugeKeys.LABEL, TYPE_SL, - HugeKeys.SORT_VALUES, DataType.text(), - HugeKeys.OTHER_VERTEX, TYPE_ID - ); - ImmutableMap columns = ImmutableMap.of( - HugeKeys.PROPERTIES, DataType.map(TYPE_PK, TYPE_PROP), - HugeKeys.EXPIRED_TIME, TYPE_EXPIRED_TIME - ); - - this.createTable(session, pkeys, ckeys, columns); - - /* - * Only out-edges table needs label index because we query edges - * by label from out-edges table - */ - if (this.direction == Directions.OUT) { - this.createIndex(session, LABEL_INDEX, HugeKeys.LABEL); - } - } - - @Override - public void insert(CassandraSessionPool.Session session, - CassandraBackendEntry.Row entry) { - Insert insert = this.buildInsert(entry); - session.add(setTtl(insert, entry)); - } - - @Override - public void append(CassandraSessionPool.Session session, - CassandraBackendEntry.Row entry) { - Update update = this.buildAppend(entry); - session.add(setTtl(update, entry)); - } - - @Override - protected List pkColumnName() { - return ImmutableList.of(HugeKeys.OWNER_VERTEX); - } - - @Override - protected List idColumnName() { - return Arrays.stream(EdgeId.KEYS) - .filter(key -> !Objects.equals(key, HugeKeys.SUB_LABEL)) - .collect(Collectors.toList()); - } - - @Override - protected List idColumnValue(Id id) { - EdgeId edgeId; - if (id instanceof EdgeId) { - edgeId = (EdgeId) id; - } else { - String[] idParts = EdgeId.split(id); - if (idParts.length == 1) { - // Delete edge by label - return Arrays.asList(idParts); - } - id = IdUtil.readString(id.asString()); - edgeId = EdgeId.parse(id.asString()); - } - - E.checkState(edgeId.direction() == this.direction, - "Can't query %s edges from %s edges table", - edgeId.direction(), this.direction); - - return idColumnValue(edgeId); - } - - protected final List idColumnValue(EdgeId edgeId) { - // TODO: move to Serializer - List list = new ArrayList<>(5); - list.add(IdUtil.writeBinString(edgeId.ownerVertexId())); - list.add(edgeId.directionCode()); - list.add(edgeId.edgeLabelId().asLong()); - list.add(edgeId.sortValues()); - list.add(IdUtil.writeBinString(edgeId.otherVertexId())); - return list; - } - - @Override - public void delete(CassandraSessionPool.Session session, - CassandraBackendEntry.Row entry) { - /* - * TODO: Delete edge by label - * Need to implement the framework that can delete with query - * which contains id or condition. - */ - - // Let super class do delete if not deleting edge by label - List idParts = this.idColumnValue(entry.id()); - if (idParts.size() > 1 || !entry.columns().isEmpty()) { - super.delete(session, entry); - return; - } - - // The only element is labeled - this.deleteEdgesByLabel(session, entry.id()); - } - - protected void deleteEdgesByLabel(CassandraSessionPool.Session session, - Id label) { - // Edges in edges_in table will be deleted when direction is OUT - if (this.direction == Directions.IN) { - return; - } - - final String OWNER_VERTEX = formatKey(HugeKeys.OWNER_VERTEX); - final String SORT_VALUES = formatKey(HugeKeys.SORT_VALUES); - final String OTHER_VERTEX = formatKey(HugeKeys.OTHER_VERTEX); - - // Query edges by label index - Select select = QueryBuilder.select().from(this.labelIndexTable()); - select.where(formatEQ(HugeKeys.LABEL, label.asLong())); - - ResultSet rs; - try { - rs = session.execute(select); - } catch (DriverException e) { - throw new BackendException("Failed to query edges " + - "with label '%s' for deleting", e, label); - } - - // Delete edges - long count = 0L; - for (Row row : rs) { - Object ownerVertex = row.getObject(OWNER_VERTEX); - Object sortValues = row.getObject(SORT_VALUES); - Object otherVertex = row.getObject(OTHER_VERTEX); - - // Delete OUT edges from edges_out table - session.add(buildDelete(label, ownerVertex, Directions.OUT, - sortValues, otherVertex)); - // Delete IN edges from edges_in table - session.add(buildDelete(label, otherVertex, Directions.IN, - sortValues, ownerVertex)); - - count += 2L; - if (count >= COMMIT_DELETE_BATCH) { - session.commit(); - count = 0; - } - } - if (count > 0L) { - session.commit(); - } - } - - private Delete buildDelete(Id label, Object ownerVertex, - Directions direction, Object sortValues, - Object otherVertex) { - Delete delete = QueryBuilder.delete().from(edgesTable(direction)); - delete.where(formatEQ(HugeKeys.OWNER_VERTEX, ownerVertex)); - delete.where(formatEQ(HugeKeys.DIRECTION, - EdgeId.directionToCode(direction))); - delete.where(formatEQ(HugeKeys.LABEL, label.asLong())); - delete.where(formatEQ(HugeKeys.SORT_VALUES, sortValues)); - delete.where(formatEQ(HugeKeys.OTHER_VERTEX, otherVertex)); - return delete; - } - - @Override - protected BackendEntry mergeEntries(BackendEntry e1, BackendEntry e2) { - // Merge edges into vertex - // TODO: merge rows before calling row2Entry() - - CassandraBackendEntry current = (CassandraBackendEntry) e1; - CassandraBackendEntry next = (CassandraBackendEntry) e2; - - E.checkState(current == null || current.type().isVertex(), - "The current entry must be null or VERTEX"); - E.checkState(next != null && next.type().isEdge(), - "The next entry must be EDGE"); - - long maxSize = BackendEntryIterator.INLINE_BATCH_SIZE; - if (current != null && current.subRows().size() < maxSize) { - Object nextVertexId = next.column(HugeKeys.OWNER_VERTEX); - if (current.id().equals(IdGenerator.of(nextVertexId))) { - current.subRow(next.row()); - return current; - } - } - - return this.wrapByVertex(next); - } - - private CassandraBackendEntry wrapByVertex(CassandraBackendEntry edge) { - assert edge.type().isEdge(); - Object ownerVertex = edge.column(HugeKeys.OWNER_VERTEX); - E.checkState(ownerVertex != null, "Invalid backend entry"); - Id vertexId = IdGenerator.of(ownerVertex); - CassandraBackendEntry vertex = new CassandraBackendEntry( - HugeType.VERTEX, vertexId); - - vertex.column(HugeKeys.ID, ownerVertex); - vertex.column(HugeKeys.PROPERTIES, ImmutableMap.of()); - - vertex.subRow(edge.row()); - return vertex; - } - - private static String table(Directions direction) { - assert direction == Directions.OUT || direction == Directions.IN; - return direction.type().string() + TABLE_SUFFIX; - } - - public static CassandraTable out(String store) { - return new Edge(store, Directions.OUT); - } - - public static CassandraTable in(String store) { - return new Edge(store, Directions.IN); - } - } - - public static class SecondaryIndex extends CassandraTable { - - public static final String TABLE = HugeType.SECONDARY_INDEX.string(); - - public SecondaryIndex(String store) { - this(store, TABLE); - } - - protected SecondaryIndex(String store, String table) { - super(joinTableName(store, table)); - } - - @Override - public void init(CassandraSessionPool.Session session) { - ImmutableMap pkeys = ImmutableMap.of( - HugeKeys.FIELD_VALUES, DataType.text() - ); - ImmutableMap ckeys = ImmutableMap.of( - HugeKeys.INDEX_LABEL_ID, TYPE_IL, - HugeKeys.ELEMENT_IDS, TYPE_ID - ); - ImmutableMap columns = ImmutableMap.of( - HugeKeys.EXPIRED_TIME, TYPE_EXPIRED_TIME - ); - - this.createTable(session, pkeys, ckeys, columns); - } - - @Override - protected List idColumnName() { - return ImmutableList.of(HugeKeys.FIELD_VALUES, - HugeKeys.INDEX_LABEL_ID, - HugeKeys.ELEMENT_IDS); - } - - @Override - protected List modifiableColumnName() { - return ImmutableList.of(); - } - - @Override - public void delete(CassandraSessionPool.Session session, - CassandraBackendEntry.Row entry) { - String fieldValues = entry.column(HugeKeys.FIELD_VALUES); - if (fieldValues != null) { - super.delete(session, entry); - return; - } - - Long indexLabel = entry.column(HugeKeys.INDEX_LABEL_ID); - if (indexLabel == null) { - throw new BackendException("SecondaryIndex deletion needs " + - "INDEX_LABEL_ID, but not provided."); - } - - Select select = QueryBuilder.select().from(this.table()); - select.where(formatEQ(HugeKeys.INDEX_LABEL_ID, indexLabel)); - select.allowFiltering(); - - ResultSet rs; - try { - rs = session.execute(select); - } catch (DriverException e) { - throw new BackendException("Failed to query secondary " + - "indexes with index label id '%s' for deleting", - indexLabel, e); - } - - final String FIELD_VALUES = formatKey(HugeKeys.FIELD_VALUES); - long count = 0L; - for (Row r : rs) { - fieldValues = r.get(FIELD_VALUES, String.class); - Delete delete = QueryBuilder.delete().from(this.table()); - delete.where(formatEQ(HugeKeys.INDEX_LABEL_ID, indexLabel)); - delete.where(formatEQ(HugeKeys.FIELD_VALUES, fieldValues)); - session.add(delete); - - if (++count >= COMMIT_DELETE_BATCH) { - session.commit(); - count = 0L; - } - } - } - - @Override - public void insert(CassandraSessionPool.Session session, - CassandraBackendEntry.Row entry) { - throw new BackendException("SecondaryIndex insertion is not supported."); - } - - @Override - public void append(CassandraSessionPool.Session session, - CassandraBackendEntry.Row entry) { - assert entry.columns().size() == 3 || entry.columns().size() == 4; - Insert insert = this.buildInsert(entry); - session.add(setTtl(insert, entry)); - } - - @Override - public void eliminate(CassandraSessionPool.Session session, - CassandraBackendEntry.Row entry) { - assert entry.columns().size() == 3 || entry.columns().size() == 4; - this.delete(session, entry); - } - } - - public static class SearchIndex extends SecondaryIndex { - - public static final String TABLE = HugeType.SEARCH_INDEX.string(); - - public SearchIndex(String store) { - super(store, TABLE); - } - - @Override - public void insert(CassandraSessionPool.Session session, - CassandraBackendEntry.Row entry) { - throw new BackendException("SearchIndex insertion is not supported."); - } - } - - /** - * TODO: set field value as key and set element id as value - */ - public static class UniqueIndex extends SecondaryIndex { - - public static final String TABLE = HugeType.UNIQUE_INDEX.string(); - - public UniqueIndex(String store) { - super(store, TABLE); - } - - @Override - public void insert(CassandraSessionPool.Session session, - CassandraBackendEntry.Row entry) { - throw new BackendException("UniqueIndex insertion is not supported."); - } - } - - public abstract static class RangeIndex extends CassandraTable { - - protected RangeIndex(String store, String table) { - super(joinTableName(store, table)); - } - - @Override - public void init(CassandraSessionPool.Session session) { - ImmutableMap pkeys = ImmutableMap.of( - HugeKeys.INDEX_LABEL_ID, TYPE_IL - ); - ImmutableMap ckeys = ImmutableMap.of( - HugeKeys.FIELD_VALUES, this.fieldValuesType(), - HugeKeys.ELEMENT_IDS, TYPE_ID - ); - ImmutableMap columns = ImmutableMap.of( - HugeKeys.EXPIRED_TIME, TYPE_EXPIRED_TIME - ); - - this.createTable(session, pkeys, ckeys, columns); - } - - protected DataType fieldValuesType() { - return DataType.decimal(); - } - - @Override - protected List idColumnName() { - return ImmutableList.of(HugeKeys.INDEX_LABEL_ID, - HugeKeys.FIELD_VALUES, - HugeKeys.ELEMENT_IDS); - } - - @Override - protected List modifiableColumnName() { - return ImmutableList.of(); - } - - @Override - public void delete(CassandraSessionPool.Session session, - CassandraBackendEntry.Row entry) { - Object fieldValues = entry.column(HugeKeys.FIELD_VALUES); - if (fieldValues != null) { - super.delete(session, entry); - return; - } - - Long indexLabel = entry.column(HugeKeys.INDEX_LABEL_ID); - if (indexLabel == null) { - throw new BackendException("Range index deletion needs INDEX_LABEL_ID, " + - "but not provided."); - } - - Delete delete = QueryBuilder.delete().from(this.table()); - delete.where(formatEQ(HugeKeys.INDEX_LABEL_ID, indexLabel)); - session.add(delete); - } - - @Override - public void insert(CassandraSessionPool.Session session, - CassandraBackendEntry.Row entry) { - throw new BackendException("RangeIndex insertion is not supported."); - } - - @Override - public void append(CassandraSessionPool.Session session, - CassandraBackendEntry.Row entry) { - assert entry.columns().size() == 3 || entry.columns().size() == 4; - Insert insert = this.buildInsert(entry); - session.add(setTtl(insert, entry)); - } - - @Override - public void eliminate(CassandraSessionPool.Session session, - CassandraBackendEntry.Row entry) { - assert entry.columns().size() == 3 || entry.columns().size() == 4; - this.delete(session, entry); - } - } - - public static class RangeIntIndex extends RangeIndex { - - public static final String TABLE = HugeType.RANGE_INT_INDEX.string(); - - public RangeIntIndex(String store) { - super(store, TABLE); - } - - @Override - protected DataType fieldValuesType() { - return DataType.cint(); - } - } - - public static class RangeFloatIndex extends RangeIndex { - - public static final String TABLE = HugeType.RANGE_FLOAT_INDEX.string(); - - public RangeFloatIndex(String store) { - super(store, TABLE); - } - - @Override - protected DataType fieldValuesType() { - return DataType.cfloat(); - } - } - - public static class RangeLongIndex extends RangeIndex { - - public static final String TABLE = HugeType.RANGE_LONG_INDEX.string(); - - public RangeLongIndex(String store) { - super(store, TABLE); - } - - @Override - protected DataType fieldValuesType() { - // TODO: DataType.varint() - return DataType.bigint(); - } - } - - public static class RangeDoubleIndex extends RangeIndex { - - public static final String TABLE = HugeType.RANGE_DOUBLE_INDEX.string(); - - public RangeDoubleIndex(String store) { - super(store, TABLE); - } - - @Override - protected DataType fieldValuesType() { - return DataType.cdouble(); - } - } - - public static class ShardIndex extends RangeIndex { - - public static final String TABLE = HugeType.SHARD_INDEX.string(); - - public ShardIndex(String store) { - super(store, TABLE); - } - - @Override - protected DataType fieldValuesType() { - return DataType.text(); - } - - @Override - public void insert(CassandraSessionPool.Session session, - CassandraBackendEntry.Row entry) { - throw new BackendException("ShardIndex insertion is not supported."); - } - } - - public static class Olap extends CassandraTable { - - public static final String TABLE = HugeType.OLAP.string(); - - private Id pkId; - - public Olap(String store, Id id) { - super(joinTableName(store, joinTableName(TABLE, id.asString()))); - this.pkId = id; - } - - @Override - public void init(CassandraSessionPool.Session session) { - ImmutableMap pkeys = ImmutableMap.of( - HugeKeys.ID, TYPE_ID - ); - ImmutableMap ckeys = ImmutableMap.of(); - ImmutableMap columns = ImmutableMap.of( - HugeKeys.PROPERTY_VALUE, TYPE_PROP - ); - - this.createTable(session, pkeys, ckeys, columns); - } - - @Override - protected Iterator results2Entries(Query q, ResultSet r) { - return new CassandraEntryIterator(r, q, (e1, row) -> { - CassandraBackendEntry e2 = row2Entry(q.resultType(), row); - e2.subId(this.pkId); - return this.mergeEntries(e1, e2); - }); - } - - @Override - public boolean isOlap() { - return true; - } - } - - public static class OlapSecondaryIndex extends SecondaryIndex { - - public static final String TABLE = HugeType.OLAP.string(); - - public OlapSecondaryIndex(String store) { - this(store, TABLE); - } - - protected OlapSecondaryIndex(String store, String table) { - super(joinTableName(store, table)); - } - } - - public static class OlapRangeIntIndex extends RangeIntIndex { - - public static final String TABLE = HugeType.OLAP.string(); - - public OlapRangeIntIndex(String store) { - this(store, TABLE); - } - - protected OlapRangeIntIndex(String store, String table) { - super(joinTableName(store, table)); - } - } - - public static class OlapRangeLongIndex extends RangeLongIndex { - - public static final String TABLE = HugeType.OLAP.string(); - - public OlapRangeLongIndex(String store) { - this(store, TABLE); - } - - protected OlapRangeLongIndex(String store, String table) { - super(joinTableName(store, table)); - } - } - - public static class OlapRangeFloatIndex extends RangeFloatIndex { - - public static final String TABLE = HugeType.OLAP.string(); - - public OlapRangeFloatIndex(String store) { - this(store, TABLE); - } - - protected OlapRangeFloatIndex(String store, String table) { - super(joinTableName(store, table)); - } - } - - public static class OlapRangeDoubleIndex extends RangeDoubleIndex { - - public static final String TABLE = HugeType.OLAP.string(); - - public OlapRangeDoubleIndex(String store) { - this(store, TABLE); - } - - protected OlapRangeDoubleIndex(String store, String table) { - super(joinTableName(store, table)); - } - } - - private static Statement setTtl(BuiltStatement statement, - CassandraBackendEntry.Row entry) { - long ttl = entry.ttl(); - if (ttl != 0L) { - int calcTtl = (int) Math.ceil(ttl / 1000D); - Using usingTtl = QueryBuilder.ttl(calcTtl); - if (statement instanceof Insert) { - ((Insert) statement).using(usingTtl); - } else { - assert statement instanceof Update; - ((Update) statement).using(usingTtl); - } - } - return statement; - } -} diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/Condition.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/Condition.java index 8d9ecd4332..e77f2f0b1e 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/Condition.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/Condition.java @@ -131,8 +131,8 @@ public enum RelationType implements BiPredicate { SCAN("scan", (v1, v2) -> { assert v2 != null; /* - * TODO: we still have no way to determine accurately, since - * some backends may scan with token(column) like cassandra. + * TODO: we still have no way to determine accurately for all + * backend scan implementations. */ return true; }); diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/Shard.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/Shard.java index 57918cb667..3f1d2bf9e8 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/Shard.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/Shard.java @@ -18,7 +18,7 @@ package org.apache.hugegraph.backend.store; /** - * Shard is used for backend storage (like cassandra, hbase) scanning + * Shard is used for distributed backend storage scanning. * operations. Each shard represents a range of tokens for a node. * Reading data from a given shard does not cross multiple nodes. */ diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/GraphTransaction.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/GraphTransaction.java index a0792ee99e..0c962b11a2 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/GraphTransaction.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/GraphTransaction.java @@ -2275,8 +2275,7 @@ private void traverseByLabel(SchemaLabel label, while (iter.hasNext()) { consumer.accept(iter.next()); /* - * Commit per batch to avoid too much data in a single commit, - * especially for Cassandra backend + * Commit per batch to avoid too much data in a single commit. */ this.commitIfGtSize(GraphTransaction.COMMIT_BATCH); } @@ -2301,7 +2300,7 @@ private void traverseByLabel(SchemaLabel label, consumer.accept(e); /* * Commit per batch to avoid too much data in a single - * commit, especially for Cassandra backend + * commit. */ this.commitIfGtSize(GraphTransaction.COMMIT_BATCH); } diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/config/CoreOptions.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/config/CoreOptions.java index 9aa60e398a..c10de4bf43 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/config/CoreOptions.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/config/CoreOptions.java @@ -62,7 +62,7 @@ public class CoreOptions extends OptionHolder { public static final ConfigOption STORE = new ConfigOption<>( "store", - "The database name like Cassandra Keyspace.", + "The backend database namespace.", disallowEmpty(), "hugegraph" ); @@ -76,7 +76,7 @@ public class CoreOptions extends OptionHolder { public static final ConfigOption SERIALIZER = new ConfigOption<>( "serializer", - "The serializer for backend store, like: text/binary/cassandra.", + "The serializer for backend store, like: text/binary.", disallowEmpty(), "text" ); diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/security/HugeSecurityManager.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/security/HugeSecurityManager.java index 13ca801220..25fb7f88b1 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/security/HugeSecurityManager.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/security/HugeSecurityManager.java @@ -64,9 +64,7 @@ public class HugeSecurityManager extends SecurityManager { "file.separator", // Sofa "java.specification.version", - // MySQL "socksProxyHost", - // PostgreSQL "file.encoding" ); @@ -79,21 +77,6 @@ public class HugeSecurityManager extends SecurityManager { ImmutableSet.of("asyncRemoveIndexLeft") ); - private static final Map> BACKEND_SOCKET = ImmutableMap.of( - // Fixed #758 - "org.apache.hugegraph.backend.store.mysql.MysqlStore", - ImmutableSet.of("open", "init", "clear", "opened", "initialized") - ); - - private static final Map> BACKEND_THREAD = ImmutableMap.of( - // Fixed #758 - "org.apache.hugegraph.backend.store.cassandra.CassandraStore", - ImmutableSet.of("open", "opened", "init"), - // Fixed https://github.com/apache/hugegraph/pull/892#issuecomment-598545072 - "com.datastax.driver.core.AbstractSession", - ImmutableSet.of("execute") - ); - private static final Map> BACKEND_SNAPSHOT = ImmutableMap.of( "org.apache.hugegraph.backend.store.AbstractBackendStoreProvider", ImmutableSet.of("createSnapshot", "resumeSnapshot"), @@ -171,7 +154,7 @@ public void checkLink(String lib) { public void checkAccess(Thread thread) { if (callFromGremlin() && !callFromCaffeine() && !callFromAsyncTasks() && !callFromEventHubNotify() && - !callFromBackendThread() && !callFromBackendHbase() && + !callFromBackendHbase() && !callFromRaft() && !callFromSofaRpc() && !callFromIgnoreCheckedClass()) { throw newSecurityException("Not allowed to access thread via Gremlin"); } @@ -182,7 +165,7 @@ public void checkAccess(Thread thread) { public void checkAccess(ThreadGroup threadGroup) { if (callFromGremlin() && !callFromCaffeine() && !callFromAsyncTasks() && !callFromEventHubNotify() && - !callFromBackendThread() && !callFromBackendHbase() && + !callFromBackendHbase() && !callFromRaft() && !callFromSofaRpc() && !callFromIgnoreCheckedClass()) { throw newSecurityException("Not allowed to access thread group via Gremlin"); @@ -208,8 +191,7 @@ public void checkExec(String cmd) { @Override public void checkRead(FileDescriptor fd) { - if (callFromGremlin() && !callFromBackendSocket() && !callFromRaft() && - !callFromSofaRpc()) { + if (callFromGremlin() && !callFromRaft() && !callFromSofaRpc()) { throw newSecurityException("Not allowed to read fd via Gremlin"); } super.checkRead(fd); @@ -235,8 +217,7 @@ public void checkRead(String file, Object context) { @Override public void checkWrite(FileDescriptor fd) { - if (callFromGremlin() && !callFromBackendSocket() && !callFromRaft() && - !callFromSofaRpc()) { + if (callFromGremlin() && !callFromRaft() && !callFromSofaRpc()) { throw newSecurityException("Not allowed to write fd via Gremlin"); } super.checkWrite(fd); @@ -276,8 +257,8 @@ public void checkAccept(String host, int port) { @Override public void checkConnect(String host, int port) { - if (callFromGremlin() && !callFromBackendSocket() && - !callFromBackendHbase() && !callFromRaft() && !callFromSofaRpc()) { + if (callFromGremlin() && !callFromBackendHbase() && + !callFromRaft() && !callFromSofaRpc()) { throw newSecurityException("Not allowed to connect socket via Gremlin"); } super.checkConnect(host, port); @@ -399,16 +380,6 @@ private static boolean callFromCaffeine() { return callFromWorkerWithClass(CAFFEINE_CLASSES); } - private static boolean callFromBackendSocket() { - // Fixed issue #758 - return callFromMethods(BACKEND_SOCKET); - } - - private static boolean callFromBackendThread() { - // Fixed issue #758 - return callFromMethods(BACKEND_THREAD); - } - private static boolean callFromEventHubNotify() { // Fixed issue #758 // notify() will create thread when submit a task to executor diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/TaskCallable.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/TaskCallable.java index ec066fbc04..4e0550f5c9 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/TaskCallable.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/TaskCallable.java @@ -42,15 +42,7 @@ public abstract class TaskCallable implements Callable { * task input size exceeds TASK_INPUT_SIZE_LIMIT or task result size * exceeds TASK_RESULT_SIZE_LIMIT */ - "The max length of bytes is", - /* - * "Batch too large" exception message occurs when using - * cassandra store and task input size is in - * [batch_size_fail_threshold_in_kb, TASK_INPUT_SIZE_LIMIT) or - * task result size is in - * [batch_size_fail_threshold_in_kb, TASK_RESULT_SIZE_LIMIT) - */ - "Batch too large" + "The max length of bytes is" ); private HugeTask task = null; diff --git a/hugegraph-server/hugegraph-dist/docker/example/docker-compose-cassandra.yml b/hugegraph-server/hugegraph-dist/docker/example/docker-compose-cassandra.yml deleted file mode 100644 index 82b56fd288..0000000000 --- a/hugegraph-server/hugegraph-dist/docker/example/docker-compose-cassandra.yml +++ /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. -# - -version: "3" - -services: - graph: - image: hugegraph/hugegraph - container_name: cas-graph - ports: - - 8080:8080 - environment: - hugegraph.backend: cassandra - hugegraph.serializer: cassandra - hugegraph.cassandra.host: cas-cassandra - hugegraph.cassandra.port: 9042 - networks: - - ca-network - depends_on: - - cassandra - healthcheck: - test: ["CMD", "bin/gremlin-console.sh", "--" ,"-e", "scripts/remote-connect.groovy"] - interval: 10s - timeout: 30s - retries: 3 - - cassandra: - image: cassandra:4 - container_name: cas-cassandra - ports: - - 7000:7000 - - 9042:9042 - security_opt: - - seccomp:unconfined - networks: - - ca-network - healthcheck: - test: ["CMD", "cqlsh", "--execute", "describe keyspaces;"] - interval: 10s - timeout: 30s - retries: 5 - -networks: - ca-network: - -volumes: - hugegraph-data: diff --git a/hugegraph-server/hugegraph-dist/pom.xml b/hugegraph-server/hugegraph-dist/pom.xml index 430a213900..e18d416529 100644 --- a/hugegraph-server/hugegraph-dist/pom.xml +++ b/hugegraph-server/hugegraph-dist/pom.xml @@ -66,6 +66,17 @@ hugegraph-rocksdb ${revision} + + org.apache.hugegraph + hugegraph-hbase + ${revision} + + + org.apache.hugegraph + hugegraph-hstore + ${revision} + + org.apache.tinkerpop gremlin-console @@ -277,57 +288,6 @@ rocksdb - - all-backends - - - !rocksdb-only - - - - - org.apache.hugegraph - hugegraph-cassandra - ${revision} - - - metrics-core - io.dropwizard.metrics - - - - - org.apache.hugegraph - hugegraph-scylladb - ${revision} - - - org.apache.hugegraph - hugegraph-mysql - ${revision} - - - org.apache.hugegraph - hugegraph-palo - ${revision} - - - org.apache.hugegraph - hugegraph-hbase - ${revision} - - - org.apache.hugegraph - hugegraph-postgresql - ${revision} - - - org.apache.hugegraph - hugegraph-hstore - ${revision} - - - assembly-hugegraph diff --git a/hugegraph-server/hugegraph-dist/src/assembly/static/conf/log4j2.xml b/hugegraph-server/hugegraph-dist/src/assembly/static/conf/log4j2.xml index cd2d9da569..6286314d7b 100644 --- a/hugegraph-server/hugegraph-dist/src/assembly/static/conf/log4j2.xml +++ b/hugegraph-server/hugegraph-dist/src/assembly/static/conf/log4j2.xml @@ -107,18 +107,12 @@ - - - - - - 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 917fc742f1..ba1edb3234 100755 --- a/hugegraph-server/hugegraph-dist/src/assembly/travis/install-backend.sh +++ b/hugegraph-server/hugegraph-dist/src/assembly/travis/install-backend.sh @@ -30,27 +30,10 @@ if [ ! -d "$HOME"/downloads ]; then fi case $BACKEND in - cassandra) - # TODO: replace it with docker - echo "cassandra is not supported since 1.7.0" - exit 1 - ;; - scylladb) - echo "scylladb is not supported since 1.7.0" - exit 1 - ;; hbase) # TODO: replace it with hbase2.3+ to avoid java8 env "$TRAVIS_DIR"/install-hbase.sh ;; - mysql) - echo "mysql is not supported since 1.7.0" - exit 1 - ;; - postgresql) - echo "postgresql is not supported since 1.7.0" - exit 1 - ;; hstore) "$TRAVIS_DIR"/install-hstore.sh ;; diff --git a/hugegraph-server/hugegraph-dist/src/assembly/travis/install-cassandra.sh b/hugegraph-server/hugegraph-dist/src/assembly/travis/install-cassandra.sh deleted file mode 100755 index 86b22f2e0d..0000000000 --- a/hugegraph-server/hugegraph-dist/src/assembly/travis/install-cassandra.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/bash -# -# 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. -# -set -ev - -CASS_DOWNLOAD_ADDRESS="https://archive.apache.org/dist/cassandra" -CASS_VERSION="4.0.10" -CASS_PACKAGE="apache-cassandra-${CASS_VERSION}" -CASS_TAR="${CASS_PACKAGE}-bin.tar.gz" -CASS_CONF="${CASS_PACKAGE}/conf/cassandra.yaml" - -# download cassandra -if [ ! -f $HOME/downloads/${CASS_TAR} ]; then - wget -q -O $HOME/downloads/${CASS_TAR} ${CASS_DOWNLOAD_ADDRESS}/${CASS_VERSION}/${CASS_TAR} -fi - -# decompress cassandra -cp $HOME/downloads/${CASS_TAR} ${CASS_TAR} && tar -xzf ${CASS_TAR} - -# using tmpfs for the Cassandra data directory reduces travis test runtime -sudo mkdir /mnt/ramdisk -sudo mount -t tmpfs -o size=1024m tmpfs /mnt/ramdisk -sudo ln -s /mnt/ramdisk $CASS_PACKAGE/data - -# config cassandra -sed -i "s/batch_size_warn_threshold_in_kb:.*/batch_size_warn_threshold_in_kb: 10240/g" $CASS_CONF -sed -i "s/batch_size_fail_threshold_in_kb:.*/batch_size_fail_threshold_in_kb: 10240/g" $CASS_CONF - -# start cassandra service -sh ${CASS_PACKAGE}/bin/cassandra diff --git a/hugegraph-server/hugegraph-dist/src/assembly/travis/install-mysql-via-docker.sh b/hugegraph-server/hugegraph-dist/src/assembly/travis/install-mysql-via-docker.sh deleted file mode 100755 index 12431e69c4..0000000000 --- a/hugegraph-server/hugegraph-dist/src/assembly/travis/install-mysql-via-docker.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash -# -# 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. -# -set -ev - -TRAVIS_DIR=$(dirname "$0") - -# Need speed up it -CONF=hugegraph-server/hugegraph-test/src/main/resources/hugegraph.properties -MYSQL_USERNAME=root - -# Set MySQL configurations -sed -i "s/jdbc.username=.*/jdbc.username=$MYSQL_USERNAME/" $CONF -sed -i "s/jdbc.reconnect_max_times=.*/jdbc.reconnect_max_times=10/" $CONF -sed -i "s/jdbc.reconnect_interval=.*/jdbc.reconnect_interval=5/" $CONF - - -# Keep for upgrade in future -docker pull mysql:5.7 -docker run -p 3306:3306 --name mysql -e MYSQL_ROOT_PASSWORD="******" -d mysql:5.7 diff --git a/hugegraph-server/hugegraph-dist/src/assembly/travis/install-mysql.sh b/hugegraph-server/hugegraph-dist/src/assembly/travis/install-mysql.sh deleted file mode 100755 index c732896df1..0000000000 --- a/hugegraph-server/hugegraph-dist/src/assembly/travis/install-mysql.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash -# -# 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. -# -set -ev - -TRAVIS_DIR=$(dirname "$0") -#MYSQL_DOWNLOAD_ADDRESS="http://dev.MySQL.com/get/Downloads" -#MYSQL_VERSION="MySQL-5.7" -#MYSQL_PACKAGE="mysql-5.7.11-Linux-glibc2.5-x86_64" -#MYSQL_TAR="${MYSQL_PACKAGE}.tar.gz" - -if [ -d /var/lib/mysql ]; then - # Reference from https://github.com/mozilla/treeherder/blob/master/bin/travis-setup.sh - # Using tmpfs for the MySQL data directory reduces travis test runtime by 6x - sudo mkdir /mnt/ramdisk - sudo mount -t tmpfs -o size=1024m tmpfs /mnt/ramdisk - sudo mv /var/lib/mysql /mnt/ramdisk - sudo ln -s /mnt/ramdisk/mysql /var/lib/mysql - sudo cp "$TRAVIS_DIR"/mysql.cnf /etc/mysql/conf.d/mysql.cnf - sudo service mysql restart -else - echo "Please install mysql firstly." - exit 1 -fi diff --git a/hugegraph-server/hugegraph-dist/src/assembly/travis/install-postgresql-via-docker.sh b/hugegraph-server/hugegraph-dist/src/assembly/travis/install-postgresql-via-docker.sh deleted file mode 100755 index 3b3cd4ec29..0000000000 --- a/hugegraph-server/hugegraph-dist/src/assembly/travis/install-postgresql-via-docker.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash -# -# 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. -# -set -ev - -TRAVIS_DIR=$(dirname "$0") -CONF=hugegraph-server/hugegraph-test/src/main/resources/hugegraph.properties - -POSTGRESQL_DRIVER=org.postgresql.Driver -POSTGRESQL_URL=jdbc:postgresql://localhost:5432/ -POSTGRESQL_USERNAME=postgres - -# Set PostgreSQL configurations -sed -i "s/jdbc.driver=.*/jdbc.driver=$POSTGRESQL_DRIVER/" $CONF -sed -i "s?jdbc.url=.*?jdbc.url=$POSTGRESQL_URL?" $CONF -sed -i "s/jdbc.username=.*/jdbc.username=$POSTGRESQL_USERNAME/" $CONF - -sudo service postgresql stop 9.2 - -docker pull postgres:9.6 -docker volume create pgdata -docker run --rm -v pgdata:/var/lib/postgresql/data -p 5432:5432 -e POSTGRES_PASSWORD="******" -d postgres:9.6 diff --git a/hugegraph-server/hugegraph-dist/src/assembly/travis/install-postgresql.sh b/hugegraph-server/hugegraph-dist/src/assembly/travis/install-postgresql.sh deleted file mode 100755 index 95ec03ca57..0000000000 --- a/hugegraph-server/hugegraph-dist/src/assembly/travis/install-postgresql.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash -# -# 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. -# -set -ev - -TRAVIS_DIR=$(dirname "$0") -CONF=hugegraph-server/hugegraph-test/src/main/resources/hugegraph.properties - -POSTGRESQL_DRIVER=org.postgresql.Driver -POSTGRESQL_URL=jdbc:postgresql://localhost:5432/ -POSTGRESQL_USERNAME=postgres - -# Set PostgreSQL configurations -sed -i "s/jdbc.driver=.*/jdbc.driver=$POSTGRESQL_DRIVER/" $CONF -sed -i "s?jdbc.url=.*?jdbc.url=$POSTGRESQL_URL?" $CONF -sed -i "s/jdbc.username=.*/jdbc.username=$POSTGRESQL_USERNAME/" $CONF - -sudo service postgresql stop 9.2 -sudo service postgresql start 9.5 diff --git a/hugegraph-server/hugegraph-dist/src/assembly/travis/install-scylladb.sh b/hugegraph-server/hugegraph-dist/src/assembly/travis/install-scylladb.sh deleted file mode 100755 index 9b281b59f8..0000000000 --- a/hugegraph-server/hugegraph-dist/src/assembly/travis/install-scylladb.sh +++ /dev/null @@ -1,65 +0,0 @@ -#!/bin/bash -# -# 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. -# -set -ev - -TRAVIS_DIR=`dirname $0` -# reference: -# https://www.scylladb.com/download/?platform=ubuntu-16.04&version=scylla-4.4#open-source -# https://github.com/scylladb/gocqlx/commit/c7f0483dd30b1c7ad1972ea135528dc95cc4ce32 -DOWNLOAD_ADDRESS="http://downloads.scylladb.com/deb/ubuntu/scylla-4.4-$(lsb_release -s -c).list" -SCYLLA_PORT=9042 -SCYLLA_CONF="/etc/scylla/scylla.yaml" -SCYLLA_OPTS="--network-stack posix --enable-in-memory-data-store 1 --developer-mode 1" -SCYLLA_OPTS_LOG="--log-to-stdout 1 --default-log-level info" - -# download and install scylladb -sudo apt-get install apt-transport-https -sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 5e08fbd8b5d6ec9c -sudo curl -L --output /etc/apt/sources.list.d/scylla.list $DOWNLOAD_ADDRESS - -sudo apt-get update -sudo apt-get install scylla - -# config scylladb -sudo sed -i "s/batch_size_warn_threshold_in_kb:.*/batch_size_warn_threshold_in_kb: 10240/g" $SCYLLA_CONF -sudo sed -i "s/batch_size_fail_threshold_in_kb:.*/batch_size_fail_threshold_in_kb: 10240/g" $SCYLLA_CONF -cat $SCYLLA_CONF - -sudo scylla_dev_mode_setup --developer-mode 1 -cat /etc/scylla.d/dev-mode.conf - -# setup scylladb with scylla_setup by expect -sudo apt-get install expect -sudo expect < - - - - @@ -119,10 +115,6 @@ - - - - diff --git a/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/Example1.java b/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/Example1.java index b9ca383bd3..a6cda3932f 100644 --- a/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/Example1.java +++ b/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/Example1.java @@ -357,7 +357,7 @@ public static void testQuery(final HugeGraph graph) { LOG.info(">>>> queryEdges(id-condition): {}", edges2.next()); } - // NOTE: query edge by has-key just supported by Cassandra + // Query edge by property key when the backend supports it if (graph.backendStoreFeatures().supportsQueryWithContainsKey()) { PropertyKey contribution = graph.propertyKey("contribution"); q.key(HugeKeys.PROPERTIES, contribution.id()); diff --git a/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/PerfExample1.java b/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/PerfExample1.java index 7cf3edd769..d0c7f434eb 100644 --- a/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/PerfExample1.java +++ b/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/PerfExample1.java @@ -22,15 +22,12 @@ import java.util.Random; import org.apache.hugegraph.HugeFactory; -import org.apache.hugegraph.backend.BackendException; import org.apache.hugegraph.schema.SchemaManager; import org.apache.hugegraph.util.Log; import org.apache.tinkerpop.gremlin.structure.T; import org.apache.tinkerpop.gremlin.structure.Vertex; import org.slf4j.Logger; -import com.datastax.driver.core.exceptions.NoHostAvailableException; - /** * Perf test for: vertex with properties */ @@ -125,15 +122,7 @@ protected void testInsert(GraphManager graph, int times, int multiple) { graph.getVertex(p3).addEdge("created", graph.getVertex(s1)); } - try { - graph.tx().commit(); - } catch (BackendException e) { - if (e.getCause() instanceof NoHostAvailableException) { - LOG.warn("Failed to commit tx: {}", e.getMessage()); - } else { - throw e; - } - } + graph.tx().commit(); this.vertices.addAll(personIds); this.vertices.addAll(softwareIds); diff --git a/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/PerfExample2.java b/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/PerfExample2.java index c984ad3141..a502f7aa7e 100644 --- a/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/PerfExample2.java +++ b/hugegraph-server/hugegraph-example/src/main/java/org/apache/hugegraph/example/PerfExample2.java @@ -22,15 +22,12 @@ import java.util.Random; import org.apache.hugegraph.HugeFactory; -import org.apache.hugegraph.backend.BackendException; import org.apache.hugegraph.schema.SchemaManager; import org.apache.hugegraph.util.Log; import org.apache.tinkerpop.gremlin.structure.T; import org.apache.tinkerpop.gremlin.structure.Vertex; import org.slf4j.Logger; -import com.datastax.driver.core.exceptions.NoHostAvailableException; - /** * Perf test for: vertex without properties */ @@ -108,15 +105,7 @@ protected void testInsert(GraphManager graph, int times, int multiple) { graph.getVertex(p3).addEdge("created", graph.getVertex(s1)); } - try { - graph.tx().commit(); - } catch (BackendException e) { - if (e.getCause() instanceof NoHostAvailableException) { - LOG.warn("Failed to commit tx: {}", e.getMessage()); - } else { - throw e; - } - } + graph.tx().commit(); this.vertices.addAll(personIds); this.vertices.addAll(softwareIds); diff --git a/hugegraph-server/hugegraph-example/src/main/resources/log4j2.xml b/hugegraph-server/hugegraph-example/src/main/resources/log4j2.xml index ba2761f6c8..4e1f1ade10 100644 --- a/hugegraph-server/hugegraph-example/src/main/resources/log4j2.xml +++ b/hugegraph-server/hugegraph-example/src/main/resources/log4j2.xml @@ -83,10 +83,6 @@ - - - - @@ -95,10 +91,6 @@ - - - - diff --git a/hugegraph-server/hugegraph-mysql/pom.xml b/hugegraph-server/hugegraph-mysql/pom.xml deleted file mode 100644 index 8753f5fd5f..0000000000 --- a/hugegraph-server/hugegraph-mysql/pom.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - hugegraph-server - org.apache.hugegraph - ${revision} - ../pom.xml - - 4.0.0 - - hugegraph-mysql - - - - org.apache.hugegraph - hugegraph-core - ${revision} - - - mysql - mysql-connector-java - 8.0.28 - test - - - org.apache.httpcomponents - httpclient - - - - diff --git a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlBackendEntry.java b/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlBackendEntry.java deleted file mode 100644 index b86de0ed75..0000000000 --- a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlBackendEntry.java +++ /dev/null @@ -1,41 +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.hugegraph.backend.store.mysql; - -import org.apache.hugegraph.backend.id.Id; -import org.apache.hugegraph.backend.serializer.TableBackendEntry; -import org.apache.hugegraph.type.HugeType; - -public class MysqlBackendEntry extends TableBackendEntry { - - public MysqlBackendEntry(Id id) { - super(id); - } - - public MysqlBackendEntry(HugeType type) { - this(type, null); - } - - public MysqlBackendEntry(HugeType type, Id id) { - this(new Row(type, id)); - } - - public MysqlBackendEntry(TableBackendEntry.Row row) { - super(row); - } -} diff --git a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlEntryIterator.java b/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlEntryIterator.java deleted file mode 100644 index f4857165c1..0000000000 --- a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlEntryIterator.java +++ /dev/null @@ -1,197 +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.hugegraph.backend.store.mysql; - -import java.sql.ResultSet; -import java.sql.ResultSetMetaData; -import java.sql.SQLException; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.function.BiFunction; - -import org.apache.hugegraph.backend.BackendException; -import org.apache.hugegraph.backend.page.PageState; -import org.apache.hugegraph.backend.query.Query; -import org.apache.hugegraph.backend.store.BackendEntry; -import org.apache.hugegraph.backend.store.BackendEntryIterator; -import org.apache.hugegraph.type.HugeType; -import org.apache.hugegraph.type.define.HugeKeys; -import org.apache.hugegraph.util.E; -import org.apache.hugegraph.util.JsonUtil; -import org.apache.hugegraph.util.StringEncoding; - -public class MysqlEntryIterator extends BackendEntryIterator { - - private final ResultSetWrapper results; - private final BiFunction merger; - - private BackendEntry next; - private BackendEntry lastest; - private boolean exceedLimit; - - public MysqlEntryIterator(ResultSetWrapper rs, Query query, - BiFunction merger) { - super(query); - this.results = rs; - this.merger = merger; - this.next = null; - this.lastest = null; - this.exceedLimit = false; - } - - @Override - protected final boolean fetch() { - assert this.current == null; - if (this.next != null) { - this.current = this.next; - this.next = null; - } - - try { - while (this.results.next()) { - MysqlBackendEntry entry = this.row2Entry(this.results.resultSet()); - this.lastest = entry; - BackendEntry merged = this.merger.apply(this.current, entry); - if (this.current == null) { - // The first time to read - this.current = merged; - } else if (merged == this.current) { - // Does the next entry belongs to the current entry - assert merged != null; - } else { - // New entry - assert this.next == null; - this.next = merged; - break; - } - - // When limit exceed, stop fetching - if (this.reachLimit(this.fetched() - 1)) { - this.exceedLimit = true; - // Need remove last one because fetched limit + 1 records - this.removeLastRecord(); - this.results.close(); - break; - } - } - } catch (SQLException e) { - throw new BackendException("Fetch next error", e); - } - return this.current != null; - } - - @Override - protected PageState pageState() { - byte[] position; - // There is no latest or no next page - if (this.lastest == null || !this.exceedLimit && - this.fetched() <= this.query.limit() && this.next == null) { - position = PageState.EMPTY_BYTES; - } else { - MysqlBackendEntry entry = (MysqlBackendEntry) this.lastest; - position = new PagePosition(entry.columnsMap()).toBytes(); - } - return new PageState(position, 0, (int) this.count()); - } - - @Override - protected void skipOffset() { - // pass - } - - @Override - protected final long sizeOf(BackendEntry entry) { - MysqlBackendEntry e = (MysqlBackendEntry) entry; - int subRowsSize = e.subRows().size(); - return subRowsSize > 0 ? subRowsSize : 1L; - } - - @Override - protected final long skip(BackendEntry entry, long skip) { - MysqlBackendEntry e = (MysqlBackendEntry) entry; - E.checkState(e.subRows().size() > skip, "Invalid entry to skip"); - for (long i = 0; i < skip; i++) { - e.subRows().remove(0); - } - return e.subRows().size(); - } - - @Override - public void close() throws Exception { - this.results.close(); - } - - private MysqlBackendEntry row2Entry(ResultSet result) throws SQLException { - HugeType type = this.query.resultType(); - MysqlBackendEntry entry = new MysqlBackendEntry(type); - ResultSetMetaData metaData = result.getMetaData(); - for (int i = 1; i <= metaData.getColumnCount(); i++) { - String name = metaData.getColumnLabel(i); - HugeKeys key = MysqlTable.parseKey(name); - Object value = result.getObject(i); - if (value == null) { - assert key == HugeKeys.EXPIRED_TIME; - continue; - } - entry.column(key, value); - } - return entry; - } - - private void removeLastRecord() { - MysqlBackendEntry entry = (MysqlBackendEntry) this.current; - int lastOne = entry.subRows().size() - 1; - assert lastOne >= 0; - entry.subRows().remove(lastOne); - } - - public static class PagePosition { - - private final Map columns; - - public PagePosition(Map columns) { - this.columns = columns; - } - - public Map columns() { - return this.columns; - } - - @Override - public String toString() { - return JsonUtil.toJson(this.columns); - } - - public byte[] toBytes() { - String json = JsonUtil.toJson(this.columns); - return StringEncoding.encode(json); - } - - public static PagePosition fromBytes(byte[] bytes) { - String json = StringEncoding.decode(bytes); - @SuppressWarnings("unchecked") - Map columns = JsonUtil.fromJson(json, Map.class); - Map keyColumns = new LinkedHashMap<>(); - for (Map.Entry entry : columns.entrySet()) { - HugeKeys key = MysqlTable.parseKey(entry.getKey()); - keyColumns.put(key, entry.getValue()); - } - return new PagePosition(keyColumns); - } - } -} diff --git a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlFeatures.java b/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlFeatures.java deleted file mode 100644 index 55a1cfd968..0000000000 --- a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlFeatures.java +++ /dev/null @@ -1,131 +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.hugegraph.backend.store.mysql; - -import org.apache.hugegraph.backend.store.BackendFeatures; - -public class MysqlFeatures implements BackendFeatures { - - @Override - public boolean supportsScanToken() { - return true; - } - - @Override - public boolean supportsScanKeyPrefix() { - return false; - } - - @Override - public boolean supportsScanKeyRange() { - return true; - } - - @Override - public boolean supportsQuerySchemaByName() { - // MySQL support secondary index - return true; - } - - @Override - public boolean supportsQueryByLabel() { - // MySQL support secondary index - return true; - } - - @Override - public boolean supportsQueryWithInCondition() { - return true; - } - - @Override - public boolean supportsQueryWithRangeCondition() { - return true; - } - - @Override - public boolean supportsQueryWithOrderBy() { - return true; - } - - @Override - public boolean supportsQueryWithContains() { - return false; - } - - @Override - public boolean supportsQueryWithContainsKey() { - return false; - } - - @Override - public boolean supportsQueryByPage() { - return true; - } - - @Override - public boolean supportsQuerySortByInputIds() { - return false; - } - - @Override - public boolean supportsDeleteEdgeByLabel() { - return true; - } - - @Override - public boolean supportsUpdateVertexProperty() { - return false; - } - - @Override - public boolean supportsMergeVertexProperty() { - return false; - } - - @Override - public boolean supportsUpdateEdgeProperty() { - return false; - } - - @Override - public boolean supportsTransaction() { - // MySQL support tx - return true; - } - - @Override - public boolean supportsNumberType() { - return true; - } - - @Override - public boolean supportsAggregateProperty() { - return false; - } - - @Override - public boolean supportsTtl() { - return false; - } - - @Override - public boolean supportsOlapProperties() { - return false; - } -} diff --git a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlMetrics.java b/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlMetrics.java deleted file mode 100644 index 4d4019d9a7..0000000000 --- a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlMetrics.java +++ /dev/null @@ -1,32 +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.hugegraph.backend.store.mysql; - -import java.util.Map; - -import org.apache.hugegraph.backend.store.BackendMetrics; - -import com.google.common.collect.ImmutableMap; - -public class MysqlMetrics implements BackendMetrics { - - @Override - public Map metrics() { - return ImmutableMap.of(NODES, 1); - } -} diff --git a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlOptions.java b/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlOptions.java deleted file mode 100644 index dd46fdb5df..0000000000 --- a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlOptions.java +++ /dev/null @@ -1,117 +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.hugegraph.backend.store.mysql; - -import static org.apache.hugegraph.config.OptionChecker.disallowEmpty; -import static org.apache.hugegraph.config.OptionChecker.rangeInt; - -import org.apache.hugegraph.config.ConfigOption; -import org.apache.hugegraph.config.OptionHolder; - -public class MysqlOptions extends OptionHolder { - - protected MysqlOptions() { - super(); - } - - private static volatile MysqlOptions instance; - - public static synchronized MysqlOptions instance() { - if (instance == null) { - instance = new MysqlOptions(); - instance.registerOptions(); - } - return instance; - } - - public static final ConfigOption JDBC_DRIVER = - new ConfigOption<>( - "jdbc.driver", - "The JDBC driver class to connect database.", - disallowEmpty(), - "com.mysql.jdbc.Driver" - ); - - public static final ConfigOption JDBC_URL = - new ConfigOption<>( - "jdbc.url", - "The url of database in JDBC format.", - disallowEmpty(), - "jdbc:mysql://127.0.0.1:3306" - ); - - public static final ConfigOption JDBC_USERNAME = - new ConfigOption<>( - "jdbc.username", - "The username to login database.", - disallowEmpty(), - "root" - ); - - public static final ConfigOption JDBC_PASSWORD = - new ConfigOption<>( - "jdbc.password", - "The password corresponding to jdbc.username.", - null, - "******" - ); - - public static final ConfigOption JDBC_FORCED_AUTO_RECONNECT = - new ConfigOption<>( - "jdbc.forced_auto_reconnect", - "Whether to forced auto reconnect to the database even " + - "if the connection fails at the first time. Note that " + - "forced_auto_reconnect=true will disable fail-fast.", - disallowEmpty(), - false - ); - - public static final ConfigOption JDBC_RECONNECT_MAX_TIMES = - new ConfigOption<>( - "jdbc.reconnect_max_times", - "The reconnect times when the database connection fails.", - rangeInt(1, 10), - 3 - ); - - public static final ConfigOption JDBC_RECONNECT_INTERVAL = - new ConfigOption<>( - "jdbc.reconnect_interval", - "The interval(seconds) between reconnections when the " + - "database connection fails.", - rangeInt(1, 10), - 3 - ); - - public static final ConfigOption JDBC_SSL_MODE = - new ConfigOption<>( - "jdbc.ssl_mode", - "The SSL mode of connections with database.", - disallowEmpty(), - "false" - ); - - public static final ConfigOption JDBC_STORAGE_ENGINE = - new ConfigOption<>( - "jdbc.storage_engine", - "The storage engine of backend store database, " + - "like InnoDB/MyISAM/RocksDB for MySQL.", - disallowEmpty(), - "InnoDB" - ); -} diff --git a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlSerializer.java b/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlSerializer.java deleted file mode 100644 index 595ab609bd..0000000000 --- a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlSerializer.java +++ /dev/null @@ -1,175 +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.hugegraph.backend.store.mysql; - -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; - -import org.apache.commons.lang.NotImplementedException; -import org.apache.hugegraph.backend.BackendException; -import org.apache.hugegraph.backend.id.Id; -import org.apache.hugegraph.backend.id.IdGenerator; -import org.apache.hugegraph.backend.serializer.TableBackendEntry; -import org.apache.hugegraph.backend.serializer.TableSerializerV2; -import org.apache.hugegraph.backend.store.BackendEntry; -import org.apache.hugegraph.config.HugeConfig; -import org.apache.hugegraph.schema.SchemaElement; -import org.apache.hugegraph.structure.HugeElement; -import org.apache.hugegraph.structure.HugeProperty; -import org.apache.hugegraph.structure.HugeVertex; -import org.apache.hugegraph.type.HugeType; -import org.apache.hugegraph.type.define.HugeKeys; -import org.apache.hugegraph.util.InsertionOrderUtil; -import org.apache.hugegraph.util.JsonUtil; - -public class MysqlSerializer extends TableSerializerV2 { - - public MysqlSerializer(HugeConfig config) { - super(config); - } - - @Override - public MysqlBackendEntry newBackendEntry(HugeType type, Id id) { - return new MysqlBackendEntry(type, id); - } - - @Override - protected TableBackendEntry newBackendEntry(TableBackendEntry.Row row) { - return new MysqlBackendEntry(row); - } - - @Override - protected MysqlBackendEntry convertEntry(BackendEntry backendEntry) { - if (!(backendEntry instanceof MysqlBackendEntry)) { - throw new BackendException("Not supported by MysqlSerializer"); - } - return (MysqlBackendEntry) backendEntry; - } - - @Override - protected Set parseIndexElemIds(TableBackendEntry entry) { - Set elemIds = InsertionOrderUtil.newSet(); - elemIds.add(entry.column(HugeKeys.ELEMENT_IDS)); - for (TableBackendEntry.Row row : entry.subRows()) { - elemIds.add(row.column(HugeKeys.ELEMENT_IDS)); - } - return elemIds; - } - - @Override - protected Id toId(Number number) { - return IdGenerator.of(number.longValue()); - } - - @Override - protected Id[] toIdArray(Object object) { - assert object instanceof String; - String value = (String) object; - Number[] values = JsonUtil.fromJson(value, Number[].class); - Id[] ids = new Id[values.length]; - int i = 0; - for (Number number : values) { - ids[i++] = IdGenerator.of(number.longValue()); - } - return ids; - } - - @Override - protected Object toLongSet(Collection ids) { - return this.toLongList(ids); - } - - @Override - protected Object toLongList(Collection ids) { - long[] values = new long[ids.size()]; - int i = 0; - for (Id id : ids) { - values[i++] = id.asLong(); - } - return JsonUtil.toJson(values); - } - - @Override - protected void formatProperty(HugeProperty prop, - TableBackendEntry.Row row) { - throw new BackendException("Not support updating single property " + - "by MySQL"); - } - - @Override - protected void formatProperties(HugeElement element, - TableBackendEntry.Row row) { - Map properties = new HashMap<>(); - // Add all properties of a Vertex - for (HugeProperty prop : element.getProperties()) { - Number key = prop.propertyKey().id().asLong(); - Object val = prop.value(); - properties.put(key, val); - } - row.column(HugeKeys.PROPERTIES, JsonUtil.toJson(properties)); - } - - @Override - protected void parseProperties(HugeElement element, - TableBackendEntry.Row row) { - String properties = row.column(HugeKeys.PROPERTIES); - // Query edge will wrapped by a vertex, whose properties is empty - if (properties.isEmpty()) { - return; - } - - @SuppressWarnings("unchecked") - Map props = JsonUtil.fromJson(properties, Map.class); - for (Map.Entry prop : props.entrySet()) { - /* - * The key is string instead of int, because the key in json - * must be string - */ - Id pkeyId = this.toId(Long.valueOf(prop.getKey())); - String colJson = JsonUtil.toJson(prop.getValue()); - this.parseProperty(pkeyId, colJson, element); - } - } - - @Override - protected void writeUserdata(SchemaElement schema, - TableBackendEntry entry) { - assert entry instanceof MysqlBackendEntry; - entry.column(HugeKeys.USER_DATA, JsonUtil.toJson(schema.userdata())); - } - - @Override - protected void readUserdata(SchemaElement schema, - TableBackendEntry entry) { - assert entry instanceof MysqlBackendEntry; - // Parse all user data of a schema element - String json = entry.column(HugeKeys.USER_DATA); - @SuppressWarnings("unchecked") - Map userdata = JsonUtil.fromJson(json, Map.class); - for (Map.Entry e : userdata.entrySet()) { - schema.userdata(e.getKey(), e.getValue()); - } - } - - @Override - public BackendEntry writeOlapVertex(HugeVertex vertex) { - throw new NotImplementedException("Unsupported writeOlapVertex()"); - } -} diff --git a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlSessions.java b/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlSessions.java deleted file mode 100644 index 9124c3a4b9..0000000000 --- a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlSessions.java +++ /dev/null @@ -1,546 +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.hugegraph.backend.store.mysql; - -import java.net.SocketTimeoutException; -import java.net.URISyntaxException; -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.HashMap; -import java.util.Map; -import java.util.stream.IntStream; - -import org.apache.http.client.utils.URIBuilder; -import org.apache.hugegraph.backend.BackendException; -import org.apache.hugegraph.backend.store.BackendSession.AbstractBackendSession; -import org.apache.hugegraph.backend.store.BackendSessionPool; -import org.apache.hugegraph.config.HugeConfig; -import org.apache.hugegraph.util.E; -import org.apache.hugegraph.util.Log; -import org.apache.logging.log4j.util.Strings; -import org.slf4j.Logger; - -public class MysqlSessions extends BackendSessionPool { - - private static final Logger LOG = Log.logger(MysqlSessions.class); - - private static final String JDBC_PREFIX = "jdbc:"; - - private static final int DROP_DB_TIMEOUT = 10000; - - private HugeConfig config; - private String database; - private volatile boolean opened; - - public MysqlSessions(HugeConfig config, String database, String store) { - super(config, database + "/" + store); - this.config = config; - this.database = database; - this.opened = false; - } - - @Override - public HugeConfig config() { - return this.config; - } - - public String database() { - return this.database; - } - - public String escapedDatabase() { - return MysqlUtil.escapeString(this.database()); - } - - /** - * Try connect with specified database, will not reconnect if failed - * - * @throws SQLException if a database access error occurs - */ - @Override - public synchronized void open() throws Exception { - try (Connection conn = this.open(false)) { - this.opened = true; - } - } - - @Override - protected boolean opened() { - return this.opened; - } - - @Override - protected void doClose() { - // pass - } - - @Override - public Session session() { - return (Session) super.getOrNewSession(); - } - - @Override - protected Session newSession() { - return new Session(); - } - - public void createDatabase() { - // Create database with non-database-session - LOG.debug("Create database: {}", this.database()); - - String sql = this.buildCreateDatabase(this.database()); - try (Connection conn = this.openWithoutDB(0)) { - conn.createStatement().execute(sql); - } catch (SQLException e) { - if (!e.getMessage().endsWith("already exists")) { - throw new BackendException("Failed to create database '%s'", e, - this.database()); - } - // Ignore exception if database already exists - } - } - - public void dropDatabase() { - LOG.debug("Drop database: {}", this.database()); - - String sql = this.buildDropDatabase(this.database()); - try (Connection conn = this.openWithoutDB(DROP_DB_TIMEOUT)) { - conn.createStatement().execute(sql); - } catch (SQLException e) { - if (e.getCause() instanceof SocketTimeoutException) { - LOG.warn("Drop database '{}' timeout", this.database()); - } else { - throw new BackendException("Failed to drop database '%s'", e, - this.database()); - } - } - } - - public boolean existsDatabase() { - try (Connection conn = this.openWithoutDB(0); - ResultSet result = conn.getMetaData().getCatalogs()) { - while (result.next()) { - String dbName = result.getString(1); - if (dbName.equals(this.database())) { - return true; - } - } - } catch (Exception e) { - throw new BackendException("Failed to obtain database info", e); - } - return false; - } - - public boolean existsTable(String table) { - String sql = this.buildExistsTable(table); - try (Connection conn = this.openWithDB(0); - ResultSet result = conn.createStatement().executeQuery(sql)) { - return result.next(); - } catch (Exception e) { - throw new BackendException("Failed to obtain table info", e); - } - } - - public void resetConnections() { - // Close the under layer connections owned by each thread - this.forceResetSessions(); - } - - protected String buildCreateDatabase(String database) { - return String.format("CREATE DATABASE IF NOT EXISTS %s " + - "DEFAULT CHARSET utf8 COLLATE utf8_bin;", - database); - } - - protected String buildDropDatabase(String database) { - return String.format("DROP DATABASE IF EXISTS %s;", database); - } - - protected String buildExistsTable(String table) { - return String.format("SELECT * FROM information_schema.tables " + - "WHERE table_schema = '%s' " + - "AND table_name = '%s' LIMIT 1;", - this.escapedDatabase(), - MysqlUtil.escapeString(table)); - } - - /** - * Connect DB without specified database - */ - protected Connection openWithoutDB(int timeout) { - String url = this.buildUri(false, false, false, timeout); - try { - return this.connect(url); - } catch (SQLException e) { - throw new BackendException("Failed to access %s", e, url); - } - } - - /** - * Connect DB with specified database, but won't auto reconnect - */ - protected Connection openWithDB(int timeout) { - String url = this.buildUri(false, true, false, timeout); - try { - return this.connect(url); - } catch (SQLException e) { - throw new BackendException("Failed to access %s", e, url); - } - } - - /** - * Connect DB with specified database - */ - private Connection open(boolean autoReconnect) throws SQLException { - String url = this.buildUri(true, true, autoReconnect, null); - return this.connect(url); - } - - protected String buildUri(boolean withConnParams, boolean withDB, - boolean autoReconnect, Integer timeout) { - String url = this.buildUrlPrefix(withDB); - - boolean forcedAutoReconnect = this.config.get( - MysqlOptions.JDBC_FORCED_AUTO_RECONNECT); - int maxTimes = this.config.get(MysqlOptions.JDBC_RECONNECT_MAX_TIMES); - int interval = this.config.get(MysqlOptions.JDBC_RECONNECT_INTERVAL); - String sslMode = this.config.get(MysqlOptions.JDBC_SSL_MODE); - - E.checkArgument(url.startsWith(JDBC_PREFIX), - "The url must start with '%s': '%s'", - JDBC_PREFIX, url); - String urlWithoutJdbc = url.substring(JDBC_PREFIX.length()); - URIBuilder builder; - try { - builder = this.newConnectionURIBuilder(urlWithoutJdbc); - } catch (URISyntaxException e) { - throw new BackendException("Invalid url '%s'", e, url); - } - - if (forcedAutoReconnect) { - autoReconnect = true; - } - if (withConnParams || forcedAutoReconnect) { - builder.setParameter("characterEncoding", "utf-8") - .setParameter("rewriteBatchedStatements", "true") - .setParameter("useServerPrepStmts", "false") - .setParameter("autoReconnect", String.valueOf(autoReconnect)) - .setParameter("maxReconnects", String.valueOf(maxTimes)) - .setParameter("initialTimeout", String.valueOf(interval)); - } - if (timeout != null) { - builder.setParameter("socketTimeout", String.valueOf(timeout)); - } - - builder.setParameter("useSSL", sslMode); - - return JDBC_PREFIX + builder; - } - - protected String buildUrlPrefix(boolean withDB) { - String url = this.config.get(MysqlOptions.JDBC_URL); - if (!url.endsWith("/")) { - url = String.format("%s/", url); - } - String database = withDB ? this.database() : this.connectDatabase(); - return String.format("%s%s", url, database); - } - - protected String connectDatabase() { - return Strings.EMPTY; - } - - protected URIBuilder newConnectionURIBuilder(String url) - throws URISyntaxException { - return new URIBuilder(url); - } - - private Connection connect(String url) throws SQLException { - LOG.info("Connect to the jdbc url: '{}'", url); - String driverName = this.config.get(MysqlOptions.JDBC_DRIVER); - String username = this.config.get(MysqlOptions.JDBC_USERNAME); - String password = this.config.get(MysqlOptions.JDBC_PASSWORD); - try { - // Register JDBC driver - Class.forName(driverName); - } catch (ClassNotFoundException e) { - throw new BackendException( - "Failed to register JDBC driver. Class '%s' not found. Please check if the " + - "MySQL driver package is available.", - driverName); - } - return DriverManager.getConnection(url, username, password); - } - - public class Session extends AbstractBackendSession { - - private Connection conn; - private Map statements; - private int count; - - public Session() { - this.conn = null; - this.statements = new HashMap<>(); - this.count = 0; - } - - public HugeConfig config() { - return MysqlSessions.this.config(); - } - - @Override - public void open() { - try { - this.doOpen(); - } catch (SQLException e) { - throw new BackendException("Failed to open connection", e); - } - } - - private void tryOpen() { - try { - this.doOpen(); - } catch (SQLException ignored) { - // Ignore - } - } - - private void doOpen() throws SQLException { - this.opened = true; - if (this.conn != null && !this.conn.isClosed()) { - return; - } - this.conn = MysqlSessions.this.open(true); - } - - @Override - public void close() { - assert this.closeable(); - if (this.conn == null) { - return; - } - - this.opened = false; - this.doClose(); - } - - private void doClose() { - SQLException exception = null; - for (PreparedStatement statement : this.statements.values()) { - try { - statement.close(); - } catch (SQLException e) { - exception = e; - } - } - this.statements.clear(); - - try { - this.conn.close(); - } catch (SQLException e) { - exception = e; - } finally { - this.conn = null; - } - - if (exception != null) { - throw new BackendException("Failed to close connection", - exception); - } - } - - @Override - public boolean opened() { - if (this.opened && this.conn == null) { - // Reconnect if the connection is reset - tryOpen(); - } - return this.opened && this.conn != null; - } - - @Override - public boolean closed() { - if (!this.opened || this.conn == null) { - return true; - } - try { - return this.conn.isClosed(); - } catch (SQLException ignored) { - // Assume closed here - return true; - } - } - - public void clear() { - this.count = 0; - SQLException exception = null; - for (PreparedStatement statement : this.statements.values()) { - try { - statement.clearBatch(); - } catch (SQLException e) { - exception = e; - } - } - if (exception != null) { - /* - * Will throw exception when the database connection error, - * we clear statements because clearBatch() failed - */ - this.statements = new HashMap<>(); - } - } - - public void begin() throws SQLException { - this.conn.setAutoCommit(false); - } - - public void end() throws SQLException { - this.conn.setAutoCommit(true); - } - - public void endAndLog() { - try { - this.conn.setAutoCommit(true); - } catch (SQLException e) { - LOG.warn("Failed to set connection to auto-commit status", e); - } - } - - @Override - public Integer commit() { - int updated = 0; - try { - for (PreparedStatement statement : this.statements.values()) { - updated += IntStream.of(statement.executeBatch()).sum(); - } - this.conn.commit(); - this.clear(); - } catch (SQLException e) { - throw new BackendException("Failed to commit", e); - } - /* - * Can't call endAndLog() in `finally` block here. - * Because If commit already failed with an exception, - * then rollback() should be called. Besides rollback() can only - * be called when autocommit=false and rollback() will always set - * autocommit=true. Therefore only commit successfully should set - * autocommit=true here - */ - this.endAndLog(); - return updated; - } - - @Override - public void rollback() { - this.clear(); - try { - this.conn.rollback(); - } catch (SQLException e) { - throw new BackendException("Failed to rollback", e); - } finally { - this.endAndLog(); - } - } - - @Override - public boolean hasChanges() { - return this.count > 0; - } - - @Override - public void reconnectIfNeeded() { - if (!this.opened) { - return; - } - - if (this.conn == null) { - tryOpen(); - } - - try { - this.execute("SELECT 1;"); - } catch (SQLException ignored) { - // pass - } - } - - @Override - public void reset() { - // NOTE: this method may be called by other threads - if (this.conn == null) { - return; - } - try { - this.doClose(); - } catch (Throwable e) { - LOG.warn("Failed to reset connection", e); - } - } - - public ResultSetWrapper select(String sql) throws SQLException { - assert this.conn.getAutoCommit(); - Statement statement = this.conn.createStatement(); - try { - ResultSet rs = statement.executeQuery(sql); - return new ResultSetWrapper(rs, statement); - } catch (SQLException e) { - statement.close(); - throw e; - } - } - - public boolean execute(String sql) throws SQLException { - /* - * commit() or rollback() failed to set connection to auto-commit - * status in prior transaction. Manually set to auto-commit here. - */ - if (!this.conn.getAutoCommit()) { - this.end(); - } - - try (Statement statement = this.conn.createStatement()) { - return statement.execute(sql); - } - } - - public void add(PreparedStatement statement) { - try { - // Add a row to statement - statement.addBatch(); - this.count++; - } catch (SQLException e) { - throw new BackendException("Failed to add statement '%s' " + - "to batch", e, statement); - } - } - - public PreparedStatement prepareStatement(String sqlTemplate) - throws SQLException { - PreparedStatement statement = this.statements.get(sqlTemplate); - if (statement == null) { - statement = this.conn.prepareStatement(sqlTemplate); - this.statements.putIfAbsent(sqlTemplate, statement); - } - return statement; - } - } -} diff --git a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlStore.java b/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlStore.java deleted file mode 100644 index c5d983feff..0000000000 --- a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlStore.java +++ /dev/null @@ -1,513 +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.hugegraph.backend.store.mysql; - -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - -import org.apache.hugegraph.backend.BackendException; -import org.apache.hugegraph.backend.id.Id; -import org.apache.hugegraph.backend.query.Query; -import org.apache.hugegraph.backend.store.AbstractBackendStore; -import org.apache.hugegraph.backend.store.BackendAction; -import org.apache.hugegraph.backend.store.BackendEntry; -import org.apache.hugegraph.backend.store.BackendFeatures; -import org.apache.hugegraph.backend.store.BackendMutation; -import org.apache.hugegraph.backend.store.BackendStoreProvider; -import org.apache.hugegraph.backend.store.mysql.MysqlSessions.Session; -import org.apache.hugegraph.config.HugeConfig; -import org.apache.hugegraph.exception.ConnectionException; -import org.apache.hugegraph.type.HugeType; -import org.apache.hugegraph.util.E; -import org.apache.hugegraph.util.Log; -import org.slf4j.Logger; - -public abstract class MysqlStore extends AbstractBackendStore { - - private static final Logger LOG = Log.logger(MysqlStore.class); - - private static final BackendFeatures FEATURES = new MysqlFeatures(); - - private final String store; - private final String database; - - private final BackendStoreProvider provider; - - private final Map tables; - - private MysqlSessions sessions; - - public MysqlStore(final BackendStoreProvider provider, - final String database, final String store) { - E.checkNotNull(database, "database"); - E.checkNotNull(store, "store"); - this.provider = provider; - this.database = database; - this.store = store; - - this.sessions = null; - this.tables = new ConcurrentHashMap<>(); - - this.registerMetaHandlers(); - LOG.debug("Store loaded: {}", store); - } - - private void registerMetaHandlers() { - this.registerMetaHandler("metrics", (session, meta, args) -> { - MysqlMetrics metrics = new MysqlMetrics(); - return metrics.metrics(); - }); - } - - protected void registerTableManager(HugeType type, MysqlTable table) { - this.tables.put(type, table); - } - - protected MysqlSessions openSessionPool(HugeConfig config) { - return new MysqlSessions(config, this.database, this.store); - } - - @Override - public String store() { - return this.store; - } - - @Override - public String database() { - return this.database; - } - - @Override - public BackendStoreProvider provider() { - return this.provider; - } - - @Override - public synchronized void open(HugeConfig config) { - LOG.debug("Store open: {}", this.store); - - E.checkNotNull(config, "config"); - - if (this.sessions != null && !this.sessions.closed()) { - LOG.debug("Store {} has been opened before", this.store); - this.sessions.useSession(); - return; - } - - this.sessions = this.openSessionPool(config); - - if (this.sessions.existsDatabase()) { - LOG.debug("Store connect with database: {}", this.database); - try { - this.sessions.open(); - } catch (Throwable e) { - throw new ConnectionException("Failed to connect to MySQL", e); - } - - try { - this.sessions.session().open(); - } catch (Throwable e) { - try { - this.sessions.close(); - } catch (Throwable e2) { - LOG.warn("Failed to close connection after an error", e2); - } - throw new BackendException("Failed to open database", e); - } - } else { - if (this.isSchemaStore()) { - LOG.info("Failed to open database '{}', " + - "try to init database later", this.database); - } - this.sessions.session(); - } - - LOG.debug("Store opened: {}", this.store); - } - - @Override - public void close() { - LOG.debug("Store close: {}", this.store); - this.checkClusterConnected(); - this.sessions.close(); - } - - @Override - public boolean opened() { - this.checkClusterConnected(); - return this.sessions.session().opened(); - } - - @Override - public void init() { - this.checkClusterConnected(); - this.sessions.createDatabase(); - try { - // Open a new session connected with specified database - this.sessions.session().open(); - } catch (Exception e) { - throw new BackendException("Failed to connect database '%s'", - this.database); - } - this.checkOpened(); - this.initTables(); - - LOG.debug("Store initialized: {}", this.store); - } - - @Override - public void clear(boolean clearSpace) { - // Check connected - this.checkClusterConnected(); - - if (this.sessions.existsDatabase()) { - if (!clearSpace) { - this.checkOpened(); - this.clearTables(); - /* - * Disconnect connections for following database drop. - * Connections will be auto reconnected if not drop database - * in next step, but never do this operation because database - * might be blocked in mysql or throw 'terminating' exception. - * we can't resetConnections() when dropDatabase(), because - * there are 3 stores(schema,system,graph), which are shared - * one database, other stores may keep connected with the - * database when one store doing clear(clearSpace=false). - */ - this.sessions.resetConnections(); - } else { - this.sessions.dropDatabase(); - } - } - - LOG.debug("Store cleared: {}", this.store); - } - - @Override - public boolean initialized() { - this.checkClusterConnected(); - - if (!this.sessions.existsDatabase()) { - return false; - } - for (MysqlTable table : this.tables()) { - if (!this.sessions.existsTable(table.table())) { - return false; - } - } - return true; - } - - @Override - public void truncate() { - this.checkOpened(); - - this.truncateTables(); - LOG.debug("Store truncated: {}", this.store); - } - - @Override - public void mutate(BackendMutation mutation) { - if (LOG.isDebugEnabled()) { - LOG.debug("Store {} mutation: {}", this.store, mutation); - } - - this.checkOpened(); - Session session = this.sessions.session(); - - for (Iterator it = mutation.mutation(); it.hasNext(); ) { - this.mutate(session, it.next()); - } - } - - private void mutate(Session session, BackendAction item) { - MysqlBackendEntry entry = castBackendEntry(item.entry()); - MysqlTable table = this.table(entry.type()); - - switch (item.action()) { - case INSERT: - table.insert(session, entry.row()); - break; - case DELETE: - table.delete(session, entry.row()); - break; - case APPEND: - table.append(session, entry.row()); - break; - case ELIMINATE: - table.eliminate(session, entry.row()); - break; - case UPDATE_IF_PRESENT: - table.updateIfPresent(session, entry.row()); - break; - case UPDATE_IF_ABSENT: - table.updateIfAbsent(session, entry.row()); - break; - default: - throw new AssertionError(String.format( - "Unsupported mutate action: %s", item.action())); - } - } - - @Override - public Iterator query(Query query) { - this.checkOpened(); - - MysqlTable table = this.table(MysqlTable.tableType(query)); - return table.query(this.sessions.session(), query); - } - - @Override - public Number queryNumber(Query query) { - this.checkOpened(); - - MysqlTable table = this.table(MysqlTable.tableType(query)); - return table.queryNumber(this.sessions.session(), query); - } - - @Override - public void beginTx() { - this.checkOpened(); - - Session session = this.sessions.session(); - try { - session.begin(); - } catch (SQLException e) { - throw new BackendException("Failed to open transaction", e); - } - } - - @Override - public void commitTx() { - this.checkOpened(); - - Session session = this.sessions.session(); - int count = session.commit(); - if (LOG.isDebugEnabled()) { - LOG.debug("Store {} committed {} items", this.store, count); - } - } - - @Override - public void rollbackTx() { - this.checkOpened(); - Session session = this.sessions.session(); - session.rollback(); - } - - @Override - public BackendFeatures features() { - return FEATURES; - } - - protected void initTables() { - Session session = this.sessions.session(); - for (MysqlTable table : this.tables()) { - table.init(session); - } - } - - protected void clearTables() { - Session session = this.sessions.session(); - for (MysqlTable table : this.tables()) { - table.clear(session); - } - } - - protected void truncateTables() { - Session session = this.sessions.session(); - for (MysqlTable table : this.tables()) { - table.truncate(session); - } - } - - protected Collection tables() { - return this.tables.values(); - } - - @Override - protected final MysqlTable table(HugeType type) { - assert type != null; - MysqlTable table = this.tables.get(convertTaskOrServerToVertex(type)); - if (table == null) { - throw new BackendException("Unsupported table type: %s", type); - } - return table; - } - - @Override - protected Session session(HugeType type) { - this.checkOpened(); - return this.sessions.session(); - } - - protected final void checkClusterConnected() { - E.checkState(this.sessions != null, - "MySQL store has not been initialized"); - } - - protected static MysqlBackendEntry castBackendEntry(BackendEntry entry) { - if (!(entry instanceof MysqlBackendEntry)) { - throw new BackendException( - "MySQL store only supports MysqlBackendEntry"); - } - return (MysqlBackendEntry) entry; - } - - public static class MysqlSchemaStore extends MysqlStore { - - private final MysqlTables.Counters counters; - - public MysqlSchemaStore(BackendStoreProvider provider, - String database, String store) { - super(provider, database, store); - - this.counters = new MysqlTables.Counters(); - - registerTableManager(HugeType.VERTEX_LABEL, - new MysqlTables.VertexLabel()); - registerTableManager(HugeType.EDGE_LABEL, - new MysqlTables.EdgeLabel()); - registerTableManager(HugeType.PROPERTY_KEY, - new MysqlTables.PropertyKey()); - registerTableManager(HugeType.INDEX_LABEL, - new MysqlTables.IndexLabel()); - } - - @Override - protected Collection tables() { - List tables = new ArrayList<>(super.tables()); - tables.add(this.counters); - return tables; - } - - @Override - public void increaseCounter(HugeType type, long increment) { - this.checkOpened(); - Session session = super.sessions.session(); - this.counters.increaseCounter(session, type, increment); - } - - @Override - public long getCounter(HugeType type) { - this.checkOpened(); - Session session = super.sessions.session(); - return this.counters.getCounter(session, type); - } - - @Override - public boolean isSchemaStore() { - return true; - } - } - - public static class MysqlGraphStore extends MysqlStore { - - public MysqlGraphStore(BackendStoreProvider provider, - String database, String store) { - super(provider, database, store); - - registerTableManager(HugeType.VERTEX, - new MysqlTables.Vertex(store)); - - registerTableManager(HugeType.EDGE_OUT, - MysqlTables.Edge.out(store)); - registerTableManager(HugeType.EDGE_IN, - MysqlTables.Edge.in(store)); - - registerTableManager(HugeType.SECONDARY_INDEX, - new MysqlTables.SecondaryIndex(store)); - registerTableManager(HugeType.RANGE_INT_INDEX, - new MysqlTables.RangeIntIndex(store)); - registerTableManager(HugeType.RANGE_FLOAT_INDEX, - new MysqlTables.RangeFloatIndex(store)); - registerTableManager(HugeType.RANGE_LONG_INDEX, - new MysqlTables.RangeLongIndex(store)); - registerTableManager(HugeType.RANGE_DOUBLE_INDEX, - new MysqlTables.RangeDoubleIndex(store)); - registerTableManager(HugeType.SEARCH_INDEX, - new MysqlTables.SearchIndex(store)); - registerTableManager(HugeType.SHARD_INDEX, - new MysqlTables.ShardIndex(store)); - registerTableManager(HugeType.UNIQUE_INDEX, - new MysqlTables.UniqueIndex(store)); - } - - @Override - public boolean isSchemaStore() { - return false; - } - - @Override - public Id nextId(HugeType type) { - throw new UnsupportedOperationException("MysqlGraphStore.nextId()"); - } - - @Override - public void increaseCounter(HugeType type, long num) { - throw new UnsupportedOperationException( - "MysqlGraphStore.increaseCounter()"); - } - - @Override - public long getCounter(HugeType type) { - throw new UnsupportedOperationException( - "MysqlGraphStore.getCounter()"); - } - } - - public static class MysqlSystemStore extends MysqlGraphStore { - - private final MysqlTables.Meta meta; - - public MysqlSystemStore(BackendStoreProvider provider, - String database, String store) { - super(provider, database, store); - - this.meta = new MysqlTables.Meta(); - } - - @Override - public void init() { - super.init(); - Session session = super.session(null); - String driverVersion = this.provider().driverVersion(); - this.meta.writeVersion(session, driverVersion); - LOG.info("Write down the backend version: {}", driverVersion); - } - - @Override - public String storedVersion() { - super.init(); - Session session = super.session(null); - return this.meta.readVersion(session); - } - - @Override - protected Collection tables() { - List tables = new ArrayList<>(super.tables()); - tables.add(this.meta); - return tables; - } - } -} diff --git a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlStoreProvider.java b/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlStoreProvider.java deleted file mode 100644 index ead148158c..0000000000 --- a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlStoreProvider.java +++ /dev/null @@ -1,76 +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.hugegraph.backend.store.mysql; - -import org.apache.hugegraph.backend.store.AbstractBackendStoreProvider; -import org.apache.hugegraph.backend.store.BackendStore; -import org.apache.hugegraph.backend.store.mysql.MysqlStore.MysqlGraphStore; -import org.apache.hugegraph.backend.store.mysql.MysqlStore.MysqlSchemaStore; -import org.apache.hugegraph.backend.store.mysql.MysqlStore.MysqlSystemStore; -import org.apache.hugegraph.config.HugeConfig; - -public class MysqlStoreProvider extends AbstractBackendStoreProvider { - - protected String database() { - return this.graph().toLowerCase(); - } - - @Override - protected BackendStore newSchemaStore(HugeConfig config, String store) { - return new MysqlSchemaStore(this, this.database(), store); - } - - @Override - protected BackendStore newGraphStore(HugeConfig config, String store) { - return new MysqlGraphStore(this, this.database(), store); - } - - @Override - protected BackendStore newSystemStore(HugeConfig config, String store) { - return new MysqlSystemStore(this, this.database(), store); - } - - @Override - public String type() { - return "mysql"; - } - - @Override - public String driverVersion() { - /* - * Versions history: - * [1.0] HugeGraph-1328: supports backend table version checking - * [1.1] HugeGraph-1322: add support for full-text search - * [1.2] #296: support range sortKey feature - * [1.3] #270 & #398: support shard-index and vertex + sortkey prefix, - * also split range table to rangeInt, rangeFloat, - * rangeLong and rangeDouble - * [1.4] #633: support unique index - * [1.5] #661: reduce the storage of vertex/edge id - * [1.6] #691: support aggregate property - * [1.7] #746: support userdata for indexlabel - * [1.8] #894: asStoredString() encoding is changed to signed B64 - * instead of sortable B64 - * [1.9] #295: support ttl for vertex and edge - * [1.10] #1333: support read frequency for property key - * [1.11] #1506: rename read frequency to write type - * [1.11] #1533: add meta table in system store - */ - return "1.11"; - } -} diff --git a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlTable.java b/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlTable.java deleted file mode 100644 index c000033611..0000000000 --- a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlTable.java +++ /dev/null @@ -1,847 +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.hugegraph.backend.store.mysql; - -import java.math.BigDecimal; -import java.sql.PreparedStatement; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.function.BiFunction; - -import org.apache.hugegraph.backend.BackendException; -import org.apache.hugegraph.backend.id.Id; -import org.apache.hugegraph.backend.page.PageState; -import org.apache.hugegraph.backend.query.Aggregate; -import org.apache.hugegraph.backend.query.Condition; -import org.apache.hugegraph.backend.query.ConditionQuery; -import org.apache.hugegraph.backend.query.IdQuery; -import org.apache.hugegraph.backend.query.Query; -import org.apache.hugegraph.backend.store.BackendEntry; -import org.apache.hugegraph.backend.store.BackendTable; -import org.apache.hugegraph.backend.store.Shard; -import org.apache.hugegraph.backend.store.TableDefine; -import org.apache.hugegraph.exception.NotFoundException; -import org.apache.hugegraph.iterator.ExtendableIterator; -import org.apache.hugegraph.iterator.WrappedIterator; -import org.apache.hugegraph.type.HugeType; -import org.apache.hugegraph.type.define.HugeKeys; -import org.apache.hugegraph.util.E; -import org.apache.hugegraph.util.Log; -import org.apache.logging.log4j.util.Strings; -import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils; -import org.slf4j.Logger; - -import com.google.common.collect.ImmutableList; - -public abstract class MysqlTable - extends BackendTable { - - private static final Logger LOG = Log.logger(MysqlTable.class); - - private static final String DECIMAL = "DECIMAL"; - - // The template cache for insert and delete statements - private String insertTemplate; - private String insertTemplateTtl; - private String deleteTemplate; - private String updateIfPresentTemplate; - private String updateIfAbsentTemplate; - - private final MysqlShardSplitter shardSplitter; - - public MysqlTable(String table) { - super(table); - this.insertTemplate = null; - this.insertTemplateTtl = null; - this.deleteTemplate = null; - this.updateIfPresentTemplate = null; - this.updateIfAbsentTemplate = null; - - this.shardSplitter = new MysqlShardSplitter(this.table()); - } - - @Override - protected void registerMetaHandlers() { - this.registerMetaHandler("splits", (session, meta, args) -> { - E.checkArgument(args.length == 1, - "The args count of %s must be 1", meta); - long splitSize = (long) args[0]; - return this.shardSplitter.getSplits(session, splitSize); - }); - } - - public abstract TableDefine tableDefine(); - - @Override - public void init(MysqlSessions.Session session) { - this.createTable(session, this.tableDefine()); - } - - @Override - public void clear(MysqlSessions.Session session) { - this.dropTable(session); - } - - public void truncate(MysqlSessions.Session session) { - this.truncateTable(session); - } - - protected void createTable(MysqlSessions.Session session, TableDefine tableDefine) { - StringBuilder sql = new StringBuilder(); - sql.append("CREATE TABLE IF NOT EXISTS "); - sql.append(this.table()).append(" ("); - // Add columns - for (Map.Entry entry : - tableDefine.columns().entrySet()) { - sql.append(formatKey(entry.getKey())); - sql.append(" "); - sql.append(entry.getValue()); - sql.append(", "); - } - // Specified primary keys - sql.append(" PRIMARY KEY ("); - int i = 0; - int size = tableDefine.keys().size(); - for (HugeKeys key : tableDefine.keys()) { - sql.append(formatKey(key)); - if (++i != size) { - sql.append(", "); - } - } - sql.append("))"); - sql.append(this.engine(session)); - sql.append(";"); - - LOG.debug("Create table: {}", sql); - try { - session.execute(sql.toString()); - } catch (SQLException e) { - throw new BackendException("Failed to create table with '%s'", - e, sql); - } - } - - protected String engine(MysqlSessions.Session session) { - String engine = session.config().get(MysqlOptions.JDBC_STORAGE_ENGINE); - return " ENGINE=" + engine; - } - - protected void dropTable(MysqlSessions.Session session) { - LOG.debug("Drop table: {}", this.table()); - String sql = this.buildDropTemplate(); - try { - session.execute(sql); - } catch (SQLException e) { - throw new BackendException("Failed to drop table with '%s'", - e, sql); - } - } - - protected void truncateTable(MysqlSessions.Session session) { - LOG.debug("Truncate table: {}", this.table()); - String sql = this.buildTruncateTemplate(); - try { - session.execute(sql); - } catch (SQLException e) { - throw new BackendException("Failed to truncate table with '%s'", - e, sql); - } - } - - protected List idColumnName() { - return this.tableDefine().keys(); - } - - protected List idColumnValue(MysqlBackendEntry.Row entry) { - return ImmutableList.of(entry.id().asLong()); - } - - protected List idColumnValue(Id id) { - return ImmutableList.of(id.asObject()); - } - - protected void insertOrUpdate(MysqlSessions.Session session, String template, - List params) { - PreparedStatement insertStmt; - try { - // Create or get insert prepare statement - insertStmt = session.prepareStatement(template); - int i = 1; - for (Object param : params) { - insertStmt.setObject(i++, param); - } - } catch (SQLException e) { - throw new BackendException("Failed to prepare statement '%s' " + - "with params: %s", template, params); - } - session.add(insertStmt); - } - - protected final String buildUpdateTemplate(MysqlBackendEntry.Row entry) { - if (entry.ttl() != 0L) { - if (this.insertTemplateTtl != null) { - return this.insertTemplateTtl; - } - - this.insertTemplateTtl = this.buildUpdateForcedTemplate(entry); - return this.insertTemplateTtl; - } else { - if (this.insertTemplate != null) { - return this.insertTemplate; - } - - this.insertTemplate = this.buildUpdateForcedTemplate(entry); - return this.insertTemplate; - } - } - - protected String buildUpdateForcedTemplate(MysqlBackendEntry.Row entry) { - StringBuilder insert = new StringBuilder(); - insert.append("REPLACE INTO ").append(this.table()); - return this.buildInsertKeys(insert, entry); - } - - protected String buildUpdateIfAbsentTemplate(MysqlBackendEntry.Row entry) { - StringBuilder insert = new StringBuilder(); - insert.append("INSERT IGNORE INTO ").append(this.table()); - return this.buildInsertKeys(insert, entry); - } - - protected String buildInsertKeys(StringBuilder insert, - MysqlBackendEntry.Row entry) { - insert.append(" ("); - - int i = 0; - int size = entry.columns().size(); - for (HugeKeys key : entry.columns().keySet()) { - insert.append(formatKey(key)); - if (++i != size) { - insert.append(", "); - } - } - insert.append(") VALUES ("); - // Fill with '?' as a placeholder - for (i = 0; i < size; i++) { - insert.append("?"); - if (i != size - 1) { - insert.append(", "); - } - } - insert.append(")"); - - return insert.toString(); - } - - protected List buildUpdateForcedParams(MysqlBackendEntry.Row entry) { - return this.buildColumnsParams(entry); - } - - protected List buildUpdateIfAbsentParams(MysqlBackendEntry.Row entry) { - return this.buildColumnsParams(entry); - } - - protected List buildColumnsParams(MysqlBackendEntry.Row entry) { - return this.buildColumnsParams(entry, null); - } - - protected List buildColumnsParams(MysqlBackendEntry.Row entry, - List skipKeys) { - List objects = new ArrayList<>(); - for (Map.Entry e : entry.columns().entrySet()) { - HugeKeys key = e.getKey(); - Object value = e.getValue(); - if (skipKeys != null && skipKeys.contains(key)) { - continue; - } - String type = this.tableDefine().columns().get(key); - if (type.startsWith(DECIMAL)) { - value = new BigDecimal(value.toString()); - } - objects.add(value); - } - return objects; - } - - protected String buildUpdateIfPresentTemplate(MysqlBackendEntry.Row entry) { - StringBuilder update = new StringBuilder(); - update.append("UPDATE ").append(this.table()); - update.append(" SET "); - - List idNames = this.idColumnName(); - - int i = 0; - for (HugeKeys key : entry.columns().keySet()) { - if (idNames.contains(key)) { - continue; - } - if (i++ > 0) { - update.append(", "); - } - update.append(formatKey(key)); - update.append("=?"); - } - - WhereBuilder where = this.newWhereBuilder(); - where.and(formatKeys(idNames), "="); - update.append(where.build()); - - return update.toString(); - } - - protected List buildUpdateIfPresentParams(MysqlBackendEntry.Row entry) { - List idNames = this.idColumnName(); - List params = this.buildColumnsParams(entry, idNames); - - List idValues = this.idColumnValue(entry); - params.addAll(idValues); - - return params; - } - - protected String buildDeleteTemplate(List idNames) { - StringBuilder delete = new StringBuilder(); - delete.append("DELETE FROM ").append(this.table()); - this.appendPartition(delete); - - WhereBuilder where = this.newWhereBuilder(); - where.and(formatKeys(idNames), "="); - delete.append(where.build()); - - return delete.toString(); - } - - protected String buildDropTemplate() { - return String.format("DROP TABLE IF EXISTS %s;", this.table()); - } - - protected String buildTruncateTemplate() { - return String.format("TRUNCATE TABLE %s;", this.table()); - } - - protected void appendPartition(StringBuilder sb) { - // pass - } - - /** - * Insert an entire row - */ - @Override - public void insert(MysqlSessions.Session session, MysqlBackendEntry.Row entry) { - String template = this.buildUpdateTemplate(entry); - List params = this.buildUpdateForcedParams(entry); - this.insertOrUpdate(session, template, params); - } - - @Override - public void delete(MysqlSessions.Session session, MysqlBackendEntry.Row entry) { - List idNames = this.idColumnName(); - - String template = this.deleteTemplate; - if (template == null) { - template = this.buildDeleteTemplate(idNames); - this.deleteTemplate = template; - } - - PreparedStatement deleteStmt; - try { - deleteStmt = session.prepareStatement(template); - if (entry.columns().isEmpty()) { - // Delete just by id - List idValues = this.idColumnValue(entry); - assert idNames.size() == idValues.size(); - - for (int i = 0, n = idNames.size(); i < n; i++) { - deleteStmt.setObject(i + 1, idValues.get(i)); - } - } else { - // Delete just by column keys(must be id columns) - for (int i = 0, n = idNames.size(); i < n; i++) { - HugeKeys key = idNames.get(i); - Object value = entry.column(key); - - deleteStmt.setObject(i + 1, value); - } - } - } catch (SQLException e) { - throw new BackendException("Failed to prepare statement '%s'" + - "with entry columns %s", - template, entry.columns().values()); - } - session.add(deleteStmt); - } - - @Override - public void append(MysqlSessions.Session session, MysqlBackendEntry.Row entry) { - this.insert(session, entry); - } - - @Override - public void eliminate(MysqlSessions.Session session, MysqlBackendEntry.Row entry) { - this.delete(session, entry); - } - - @Override - public void updateIfPresent(MysqlSessions.Session session, MysqlBackendEntry.Row entry) { - String template = this.updateIfPresentTemplate; - if (template == null) { - template = this.buildUpdateIfPresentTemplate(entry); - this.updateIfPresentTemplate = template; - } - List params = this.buildUpdateIfPresentParams(entry); - this.insertOrUpdate(session, template, params); - } - - @Override - public void updateIfAbsent(MysqlSessions.Session session, MysqlBackendEntry.Row entry) { - String template = this.updateIfAbsentTemplate; - if (template == null) { - template = this.buildUpdateIfAbsentTemplate(entry); - this.updateIfAbsentTemplate = template; - } - List params = this.buildUpdateIfAbsentParams(entry); - this.insertOrUpdate(session, template, params); - } - - @Override - public boolean queryExist(MysqlSessions.Session session, MysqlBackendEntry.Row entry) { - Query query = new IdQuery.OneIdQuery(HugeType.UNKNOWN, entry.id()); - Iterator iter = this.query(session, query); - try { - return iter.hasNext(); - } finally { - WrappedIterator.close(iter); - } - } - - @Override - public Number queryNumber(MysqlSessions.Session session, Query query) { - Aggregate aggregate = query.aggregateNotNull(); - - Iterator results = this.query(session, query, (q, rs) -> { - try { - if (!rs.resultSet().next()) { - return IteratorUtils.of(aggregate.defaultValue()); - } - return IteratorUtils.of(rs.resultSet().getLong(1)); - } catch (SQLException e) { - throw new BackendException(e); - } finally { - rs.close(); - } - }); - return aggregate.reduce(results); - } - - @Override - public Iterator query(MysqlSessions.Session session, Query query) { - return this.query(session, query, this::results2Entries); - } - - protected Iterator query(MysqlSessions.Session session, Query query, - BiFunction> parser) { - ExtendableIterator rs = new ExtendableIterator<>(); - - if (query.limit() == 0L && !query.noLimit()) { - LOG.debug("Return empty result(limit=0) for query {}", query); - return rs; - } - - List selections = this.query2Select(this.table(), query); - try { - for (StringBuilder selection : selections) { - ResultSetWrapper results = session.select(selection.toString()); - rs.extend(parser.apply(query, results)); - } - } catch (SQLException e) { - // Closing the iterator - try { - rs.close(); - } catch (Exception e2) { - LOG.error("Got error {} when closing iterator for query {}", e2, query); - } - throw new BackendException("Failed to query [%s]", e, query); - } - - LOG.debug("Return {} for query {}", rs, query); - return rs; - } - - protected List query2Select(String table, Query query) { - // Build query - StringBuilder select = new StringBuilder(64); - select.append("SELECT "); - - // Set aggregate - Aggregate aggregate = query.aggregate(); - if (aggregate != null) { - select.append(aggregate); - } else { - select.append("*"); - } - - // Set table - select.append(" FROM ").append(table); - - // Is query by id? - List ids = this.queryId2Select(query, select); - - List selections; - - if (query.conditionsSize() == 0) { - // Query only by id - LOG.debug("Query only by id(s): {}", ids); - selections = ids; - } else { - ConditionQuery condQuery = (ConditionQuery) query; - if (condQuery.containsScanRelation()) { - assert ids.size() == 1; - return ImmutableList.of(queryByRange(condQuery, ids.get(0))); - } - - selections = new ArrayList<>(ids.size()); - for (StringBuilder selection : ids) { - // Query by condition - selections.addAll(this.queryCondition2Select(query, selection)); - } - LOG.debug("Query by conditions: {}", selections); - } - // Set page, order-by and limit - for (StringBuilder selection : selections) { - boolean hasOrder = !query.orders().isEmpty(); - if (hasOrder) { - this.wrapOrderBy(selection, query); - } - if (query.paging()) { - this.wrapPage(selection, query, false); - wrapLimit(selection, query); - } else { - if (aggregate == null && !hasOrder) { - select.append(this.orderByKeys()); - } - if (!query.noLimit() || query.offset() > 0L) { - this.wrapOffset(selection, query); - } - } - } - - return selections; - } - - protected StringBuilder queryByRange(ConditionQuery query, - StringBuilder select) { - E.checkArgument(query.relations().size() == 1, - "Invalid scan with multi conditions: %s", query); - Condition.Relation scan = query.relations().iterator().next(); - Shard shard = (Shard) scan.value(); - - String page = query.page(); - if (MysqlShardSplitter.START.equals(shard.start()) && - MysqlShardSplitter.END.equals(shard.end()) && - (page == null || page.isEmpty())) { - this.wrapLimit(select, query); - return select; - } - - HugeKeys partitionKey = this.idColumnName().get(0); - - if (page != null && !page.isEmpty()) { - // >= page - this.wrapPage(select, query, true); - // < end - WhereBuilder where = this.newWhereBuilder(false); - if (!MysqlShardSplitter.END.equals(shard.end())) { - where.and(); - where.lt(formatKey(partitionKey), shard.end()); - } - select.append(where.build()); - } else { - // >= start - WhereBuilder where = this.newWhereBuilder(); - boolean hasStart = false; - if (!MysqlShardSplitter.START.equals(shard.start())) { - where.gte(formatKey(partitionKey), shard.start()); - hasStart = true; - } - // < end - if (!MysqlShardSplitter.END.equals(shard.end())) { - if (hasStart) { - where.and(); - } - where.lt(formatKey(partitionKey), shard.end()); - } - select.append(where.build()); - } - this.wrapLimit(select, query); - - return select; - } - - protected List queryId2Select(Query query, - StringBuilder select) { - // Query by id(s) - if (query.idsSize() == 0) { - return ImmutableList.of(select); - } - - List nameParts = this.idColumnName(); - - List> ids = new ArrayList<>(query.idsSize()); - for (Id id : query.ids()) { - List idParts = this.idColumnValue(id); - if (nameParts.size() != idParts.size()) { - throw new NotFoundException( - "Unsupported ID format: '%s' (should contain %s)", - id, nameParts); - } - ids.add(idParts); - } - - // Query only by partition-key - if (nameParts.size() == 1) { - List values = new ArrayList<>(ids.size()); - for (List objects : ids) { - assert objects.size() == 1; - values.add(objects.get(0)); - } - - WhereBuilder where = this.newWhereBuilder(); - where.in(formatKey(nameParts.get(0)), values); - select.append(where.build()); - return ImmutableList.of(select); - } - - /* - * Query by partition-key + clustering-key - * NOTE: Error if multi-column IN clause include partition key: - * error: multi-column relations can only be applied to clustering - * columns when using: select.where(QueryBuilder.in(names, idList)); - * So we use multi-query instead of IN - */ - List selections = new ArrayList<>(ids.size()); - for (List objects : ids) { - assert nameParts.size() == objects.size(); - StringBuilder idSelection = new StringBuilder(select); - /* - * NOTE: concat with AND relation, like: - * "pk = id and ck1 = v1 and ck2 = v2" - */ - WhereBuilder where = this.newWhereBuilder(); - where.and(formatKeys(nameParts), objects); - - idSelection.append(where.build()); - selections.add(idSelection); - } - return selections; - } - - protected List queryCondition2Select(Query query, - StringBuilder select) { - // Query by conditions - Collection conditions = query.conditions(); - List clauses = new ArrayList<>(conditions.size()); - for (Condition condition : conditions) { - clauses.add(this.condition2Sql(condition)); - } - WhereBuilder where = this.newWhereBuilder(); - where.and(clauses); - select.append(where.build()); - return ImmutableList.of(select); - } - - protected StringBuilder condition2Sql(Condition condition) { - switch (condition.type()) { - case AND: - Condition.And and = (Condition.And) condition; - StringBuilder left = this.condition2Sql(and.left()); - StringBuilder right = this.condition2Sql(and.right()); - int size = left.length() + right.length() + " AND ".length(); - StringBuilder sql = new StringBuilder(size); - sql.append(left).append(" AND ").append(right); - return sql; - case OR: - throw new BackendException("Not support OR currently"); - case RELATION: - Condition.Relation r = (Condition.Relation) condition; - return this.relation2Sql(r); - default: - final String msg = "Unsupported condition: " + condition; - throw new AssertionError(msg); - } - } - - protected StringBuilder relation2Sql(Condition.Relation relation) { - String key = relation.serialKey().toString(); - Object value = relation.serialValue(); - - WhereBuilder sql = this.newWhereBuilder(false); - sql.relation(key, relation.relation(), value); - return sql.build(); - } - - protected WhereBuilder newWhereBuilder() { - return this.newWhereBuilder(true); - } - - protected WhereBuilder newWhereBuilder(boolean startWithWhere) { - return new WhereBuilder(startWithWhere); - } - - protected void wrapOrderBy(StringBuilder select, Query query) { - int size = query.orders().size(); - assert size > 0; - - int i = 0; - // Set order-by - select.append(" ORDER BY "); - for (Map.Entry order : - query.orders().entrySet()) { - String key = formatKey(order.getKey()); - Query.Order value = order.getValue(); - select.append(key).append(" "); - if (value == Query.Order.ASC) { - select.append("ASC"); - } else { - assert value == Query.Order.DESC; - select.append("DESC"); - } - if (++i != size) { - select.append(", "); - } - } - } - - protected void wrapPage(StringBuilder select, Query query, boolean scan) { - String page = query.page(); - // It's the first time if page is empty - if (!page.isEmpty()) { - byte[] position = PageState.fromString(page).position(); - Map columns = MysqlEntryIterator.PagePosition.fromBytes(position) - .columns(); - - List idColumnNames = this.idColumnName(); - List values = new ArrayList<>(idColumnNames.size()); - for (HugeKeys key : idColumnNames) { - values.add(columns.get(key)); - } - - // Need add `where` to `select` when query is IdQuery - boolean expectWhere = scan || query.conditionsSize() == 0; - WhereBuilder where = this.newWhereBuilder(expectWhere); - if (!expectWhere) { - where.and(); - } - where.gte(formatKeys(idColumnNames), values); - select.append(where.build()); - } - } - - private void wrapLimit(StringBuilder select, Query query) { - select.append(this.orderByKeys()); - if (!query.noLimit()) { - // Fetch `limit + 1` rows for judging whether reached the last page - select.append(" limit "); - select.append(query.limit() + 1); - } - select.append(";"); - } - - protected String orderByKeys() { - return Strings.EMPTY; - } - - protected void wrapOffset(StringBuilder select, Query query) { - assert query.limit() >= 0; - assert query.offset() >= 0; - // Set limit and offset - select.append(" limit "); - select.append(query.limit()); - select.append(" offset "); - select.append(query.offset()); - select.append(";"); - - query.goOffset(query.offset()); - } - - protected Iterator results2Entries(Query query, - ResultSetWrapper results) { - return new MysqlEntryIterator(results, query, this::mergeEntries); - } - - protected BackendEntry mergeEntries(BackendEntry e1, BackendEntry e2) { - // Return the next entry (not merged) - return e2; - } - - public static String formatKey(HugeKeys key) { - return key.name(); - } - - public static HugeKeys parseKey(String name) { - return HugeKeys.valueOf(name.toUpperCase()); - } - - public static List formatKeys(List keys) { - List names = new ArrayList<>(keys.size()); - for (HugeKeys key : keys) { - names.add(formatKey(key)); - } - return names; - } - - private static class MysqlShardSplitter extends ShardSplitter { - - private static final String BASE64 = - "0123456789=?ABCDEFGHIJKLMNOPQRSTUVWXYZ" + - "abcdefghijklmnopqrstuvwxyz"; - private static final int COUNT = 64; - - public MysqlShardSplitter(String table) { - super(table); - } - - @Override - public List getSplits(MysqlSessions.Session session, long splitSize) { - E.checkArgument(splitSize >= MIN_SHARD_SIZE, - "The split-size must be >= %s bytes, but got %s", - MIN_SHARD_SIZE, splitSize); - List splits = new ArrayList<>(COUNT); - splits.add(new Shard(START, BASE64.substring(0, 1), 0)); - for (int i = 0; i < COUNT - 1; i++) { - splits.add(new Shard(BASE64.substring(i, i + 1), - BASE64.substring(i + 1, i + 2), 0)); - } - splits.add(new Shard(BASE64.substring(COUNT - 1, COUNT), END, 0)); - return splits; - } - - @Override - protected long estimateDataSize(MysqlSessions.Session session) { - return 0L; - } - - @Override - protected long estimateNumKeys(MysqlSessions.Session session) { - return 0L; - } - } -} diff --git a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlTables.java b/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlTables.java deleted file mode 100644 index 981369f56d..0000000000 --- a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlTables.java +++ /dev/null @@ -1,667 +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.hugegraph.backend.store.mysql; - -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; - -import org.apache.hugegraph.backend.BackendException; -import org.apache.hugegraph.backend.id.EdgeId; -import org.apache.hugegraph.backend.id.Id; -import org.apache.hugegraph.backend.id.IdGenerator; -import org.apache.hugegraph.backend.id.IdUtil; -import org.apache.hugegraph.backend.id.SplicingIdGenerator; -import org.apache.hugegraph.backend.store.BackendEntry; -import org.apache.hugegraph.backend.store.BackendEntryIterator; -import org.apache.hugegraph.backend.store.TableDefine; -import org.apache.hugegraph.type.HugeType; -import org.apache.hugegraph.type.define.Directions; -import org.apache.hugegraph.type.define.HugeKeys; -import org.apache.hugegraph.util.E; - -import com.google.common.collect.ImmutableMap; - -public class MysqlTables { - - public static final String BOOLEAN = "BOOLEAN"; - public static final String TINYINT = "TINYINT"; - public static final String INT = "INT"; - public static final String BIGINT = "BIGINT"; - public static final String NUMERIC = "DOUBLE"; - public static final String SMALL_TEXT = "SMALL_TEXT"; - public static final String MID_TEXT = "MID_TEXT"; - public static final String LARGE_TEXT = "LARGE_TEXT"; - // Just used for task input and result - public static final String HUGE_TEXT = "HUGE_TEXT"; - - private static final String DATATYPE_PK = INT; - private static final String DATATYPE_SL = INT; // VL/EL - private static final String DATATYPE_IL = INT; - - private static final String SMALL_JSON = MID_TEXT; - private static final String LARGE_JSON = LARGE_TEXT; - - private static final Map TYPES_MAPPING = ImmutableMap.of( - SMALL_TEXT, "VARCHAR(255)", - MID_TEXT, "VARCHAR(1024)", - LARGE_TEXT, "TEXT", - HUGE_TEXT, "MEDIUMTEXT" - ); - - public static class MysqlTableTemplate extends MysqlTable { - - protected TableDefine define; - - public MysqlTableTemplate(String table) { - super(table); - } - - @Override - public TableDefine tableDefine() { - return this.define; - } - } - - public static class Meta extends MysqlTableTemplate { - - public static final String TABLE = HugeType.META.string(); - - public Meta() { - this(TYPES_MAPPING); - } - - public Meta(Map typesMapping) { - super(TABLE); - - this.define = new TableDefine(typesMapping); - this.define.column(HugeKeys.NAME, SMALL_TEXT); - this.define.column(HugeKeys.VALUE, MID_TEXT); - this.define.keys(HugeKeys.NAME); - } - - public void writeVersion(MysqlSessions.Session session, String driverVersion) { - String versionColumn = formatKey(HugeKeys.VERSION); - String insert = String.format("INSERT IGNORE INTO %s VALUES " + - "('%s', '%s')", this.table(), - versionColumn, driverVersion); - try { - session.execute(insert); - } catch (SQLException e) { - throw new BackendException("Failed to insert driver version " + - "with '%s'", e, insert); - } - } - - public String readVersion(MysqlSessions.Session session) { - String select = String.format("SELECT %s FROM %s WHERE %s = '%s'", - formatKey(HugeKeys.VALUE), - this.table(), formatKey(HugeKeys.NAME), - formatKey(HugeKeys.VERSION)); - try (ResultSetWrapper results = session.select(select)) { - ResultSet rs = results.resultSet(); - if (!rs.next()) { - return null; - } - return rs.getString(formatKey(HugeKeys.VALUE)); - } catch (SQLException e) { - throw new BackendException( - "Failed to get stored version with '%s'", e, select); - } - } - } - - public static class Counters extends MysqlTableTemplate { - - public static final String TABLE = HugeType.COUNTER.string(); - - public Counters() { - this(TYPES_MAPPING); - } - - public Counters(Map typesMapping) { - super(TABLE); - - this.define = new TableDefine(typesMapping); - this.define.column(HugeKeys.SCHEMA_TYPE, SMALL_TEXT); - this.define.column(HugeKeys.ID, INT); - this.define.keys(HugeKeys.SCHEMA_TYPE); - } - - public long getCounter(MysqlSessions.Session session, HugeType type) { - String schemaCol = formatKey(HugeKeys.SCHEMA_TYPE); - String idCol = formatKey(HugeKeys.ID); - - String select = String.format("SELECT ID FROM %s WHERE %s = '%s';", - this.table(), schemaCol, type.name()); - try (ResultSetWrapper results = session.select(select)) { - ResultSet rs = results.resultSet(); - if (rs.next()) { - return rs.getLong(idCol); - } else { - return 0L; - } - } catch (SQLException e) { - throw new BackendException( - "Failed to get id from counters with type '%s'", - e, type); - } - } - - public void increaseCounter(MysqlSessions.Session session, - HugeType type, long increment) { - String update = String.format( - "INSERT INTO %s VALUES ('%s', %s) " + - "ON DUPLICATE KEY UPDATE ID = ID + %s;", - this.table(), type.name(), increment, increment); - try { - session.execute(update); - } catch (SQLException e) { - throw new BackendException("Failed to update counters " + - "with '%s'", e, update); - } - } - } - - public static class VertexLabel extends MysqlTableTemplate { - - public static final String TABLE = HugeType.VERTEX_LABEL.string(); - - public VertexLabel() { - this(TYPES_MAPPING); - } - - public VertexLabel(Map typesMapping) { - super(TABLE); - - this.define = new TableDefine(typesMapping); - this.define.column(HugeKeys.ID, DATATYPE_SL); - this.define.column(HugeKeys.NAME, SMALL_TEXT); - this.define.column(HugeKeys.ID_STRATEGY, TINYINT); - this.define.column(HugeKeys.PRIMARY_KEYS, SMALL_JSON); - this.define.column(HugeKeys.PROPERTIES, SMALL_JSON); - this.define.column(HugeKeys.NULLABLE_KEYS, SMALL_JSON); - this.define.column(HugeKeys.INDEX_LABELS, SMALL_JSON); - this.define.column(HugeKeys.ENABLE_LABEL_INDEX, BOOLEAN); - this.define.column(HugeKeys.USER_DATA, LARGE_JSON); - this.define.column(HugeKeys.STATUS, TINYINT); - this.define.column(HugeKeys.TTL, INT); - this.define.column(HugeKeys.TTL_START_TIME, DATATYPE_PK); - this.define.keys(HugeKeys.ID); - } - } - - public static class EdgeLabel extends MysqlTableTemplate { - - public static final String TABLE = HugeType.EDGE_LABEL.string(); - - public EdgeLabel() { - this(TYPES_MAPPING); - } - - public EdgeLabel(Map typesMapping) { - super(TABLE); - - this.define = new TableDefine(typesMapping); - this.define.column(HugeKeys.ID, DATATYPE_SL); - this.define.column(HugeKeys.NAME, SMALL_TEXT); - this.define.column(HugeKeys.FREQUENCY, TINYINT); - this.define.column(HugeKeys.SOURCE_LABEL, DATATYPE_SL); - this.define.column(HugeKeys.TARGET_LABEL, DATATYPE_SL); - this.define.column(HugeKeys.SORT_KEYS, SMALL_JSON); - this.define.column(HugeKeys.PROPERTIES, SMALL_JSON); - this.define.column(HugeKeys.NULLABLE_KEYS, SMALL_JSON); - this.define.column(HugeKeys.INDEX_LABELS, SMALL_JSON); - this.define.column(HugeKeys.ENABLE_LABEL_INDEX, BOOLEAN); - this.define.column(HugeKeys.USER_DATA, LARGE_JSON); - this.define.column(HugeKeys.STATUS, TINYINT); - this.define.column(HugeKeys.TTL, INT); - this.define.column(HugeKeys.TTL_START_TIME, DATATYPE_PK); - this.define.keys(HugeKeys.ID); - } - } - - public static class PropertyKey extends MysqlTableTemplate { - - public static final String TABLE = HugeType.PROPERTY_KEY.string(); - - public PropertyKey() { - this(TYPES_MAPPING); - } - - public PropertyKey(Map typesMapping) { - super(TABLE); - - this.define = new TableDefine(typesMapping); - this.define.column(HugeKeys.ID, DATATYPE_PK); - this.define.column(HugeKeys.NAME, SMALL_TEXT); - this.define.column(HugeKeys.DATA_TYPE, TINYINT); - this.define.column(HugeKeys.CARDINALITY, TINYINT); - this.define.column(HugeKeys.AGGREGATE_TYPE, TINYINT); - this.define.column(HugeKeys.WRITE_TYPE, TINYINT); - this.define.column(HugeKeys.PROPERTIES, SMALL_JSON); - this.define.column(HugeKeys.USER_DATA, LARGE_JSON); - this.define.column(HugeKeys.STATUS, TINYINT); - this.define.keys(HugeKeys.ID); - } - } - - public static class IndexLabel extends MysqlTableTemplate { - - public static final String TABLE = HugeType.INDEX_LABEL.string(); - - public IndexLabel() { - this(TYPES_MAPPING); - } - - public IndexLabel(Map typesMapping) { - super(TABLE); - - this.define = new TableDefine(typesMapping); - this.define.column(HugeKeys.ID, DATATYPE_IL); - this.define.column(HugeKeys.NAME, SMALL_TEXT); - this.define.column(HugeKeys.BASE_TYPE, TINYINT); - this.define.column(HugeKeys.BASE_VALUE, DATATYPE_SL); - this.define.column(HugeKeys.INDEX_TYPE, TINYINT); - this.define.column(HugeKeys.FIELDS, SMALL_JSON); - this.define.column(HugeKeys.USER_DATA, LARGE_JSON); - this.define.column(HugeKeys.STATUS, TINYINT); - this.define.keys(HugeKeys.ID); - } - } - - public static class Vertex extends MysqlTableTemplate { - - public static final String TABLE = HugeType.VERTEX.string(); - - public Vertex(String store) { - this(store, TYPES_MAPPING); - } - - public Vertex(String store, Map typesMapping) { - super(joinTableName(store, TABLE)); - - this.define = new TableDefine(typesMapping); - this.define.column(HugeKeys.ID, SMALL_TEXT); - this.define.column(HugeKeys.LABEL, DATATYPE_SL); - this.define.column(HugeKeys.PROPERTIES, HUGE_TEXT); - this.define.column(HugeKeys.EXPIRED_TIME, BIGINT); - this.define.keys(HugeKeys.ID); - } - } - - public static class Edge extends MysqlTableTemplate { - - public static final String TABLE_SUFFIX = HugeType.EDGE.string(); - - private final Directions direction; - private final String delByLabelTemplate; - - public Edge(String store, Directions direction) { - this(store, direction, TYPES_MAPPING); - } - - public Edge(String store, Directions direction, - Map typesMapping) { - super(joinTableName(store, table(direction))); - - this.direction = direction; - this.delByLabelTemplate = String.format( - "DELETE FROM %s WHERE %s = ?;", - this.table(), formatKey(HugeKeys.LABEL)); - - this.define = new TableDefine(typesMapping); - this.define.column(HugeKeys.OWNER_VERTEX, SMALL_TEXT); - this.define.column(HugeKeys.DIRECTION, TINYINT); - this.define.column(HugeKeys.LABEL, DATATYPE_SL); - this.define.column(HugeKeys.SUB_LABEL, DATATYPE_SL); - this.define.column(HugeKeys.SORT_VALUES, SMALL_TEXT); - this.define.column(HugeKeys.OTHER_VERTEX, SMALL_TEXT); - this.define.column(HugeKeys.PROPERTIES, LARGE_JSON); - this.define.column(HugeKeys.EXPIRED_TIME, BIGINT); - this.define.keys(HugeKeys.OWNER_VERTEX, HugeKeys.DIRECTION, - HugeKeys.LABEL, HugeKeys.SUB_LABEL, HugeKeys.SORT_VALUES, - HugeKeys.OTHER_VERTEX); - } - - @Override - public List idColumnValue(Id id) { - EdgeId edgeId; - if (id instanceof EdgeId) { - edgeId = (EdgeId) id; - } else { - String[] idParts = EdgeId.split(id); - if (idParts.length == 1) { - // Delete edge by label - return Arrays.asList(idParts); - } - id = IdUtil.readString(id.asString()); - edgeId = EdgeId.parse(id.asString()); - } - - E.checkState(edgeId.direction() == this.direction, - "Can't query %s edges from %s edges table", - edgeId.direction(), this.direction); - - List list = new ArrayList<>(5); - list.add(IdUtil.writeStoredString(edgeId.ownerVertexId())); - list.add(edgeId.directionCode()); - list.add(edgeId.edgeLabelId().asLong()); - list.add(edgeId.subLabelId().asLong()); - list.add(edgeId.sortValues()); - list.add(IdUtil.writeStoredString(edgeId.otherVertexId())); - return list; - } - - @Override - public void delete(MysqlSessions.Session session, MysqlBackendEntry.Row entry) { - // Let super class do delete if not deleting edge by label - List idParts = this.idColumnValue(entry.id()); - if (idParts.size() > 1 || !entry.columns().isEmpty()) { - super.delete(session, entry); - return; - } - - // The only element is label - this.deleteEdgesByLabel(session, entry.id()); - } - - private void deleteEdgesByLabel(MysqlSessions.Session session, Id label) { - PreparedStatement deleteStmt; - try { - // Create or get delete prepare statement - deleteStmt = session.prepareStatement(this.delByLabelTemplate); - // Delete edges - deleteStmt.setObject(1, label.asLong()); - } catch (SQLException e) { - throw new BackendException("Failed to prepare statement '%s'", - this.delByLabelTemplate); - } - session.add(deleteStmt); - } - - @Override - public BackendEntry mergeEntries(BackendEntry e1, BackendEntry e2) { - // Merge edges into vertex - // TODO: merge rows before calling row2Entry() - - MysqlBackendEntry current = (MysqlBackendEntry) e1; - MysqlBackendEntry next = (MysqlBackendEntry) e2; - - E.checkState(current == null || current.type().isVertex(), - "The current entry must be null or VERTEX"); - E.checkState(next != null && next.type().isEdge(), - "The next entry must be EDGE"); - - long maxSize = BackendEntryIterator.INLINE_BATCH_SIZE; - if (current != null && current.subRows().size() < maxSize) { - Id nextVertexId = IdGenerator.of( - next.column(HugeKeys.OWNER_VERTEX)); - if (current.id().equals(nextVertexId)) { - current.subRow(next.row()); - return current; - } - } - - return this.wrapByVertex(next); - } - - private MysqlBackendEntry wrapByVertex(MysqlBackendEntry edge) { - assert edge.type().isEdge(); - String ownerVertex = edge.column(HugeKeys.OWNER_VERTEX); - E.checkState(ownerVertex != null, "Invalid backend entry"); - Id vertexId = IdGenerator.of(ownerVertex); - MysqlBackendEntry vertex = new MysqlBackendEntry(HugeType.VERTEX, - vertexId); - - vertex.column(HugeKeys.ID, ownerVertex); - vertex.column(HugeKeys.PROPERTIES, ""); - - vertex.subRow(edge.row()); - return vertex; - } - - public static String table(Directions direction) { - assert direction == Directions.OUT || direction == Directions.IN; - return direction.type().string() + TABLE_SUFFIX; - } - - public static MysqlTable out(String store) { - return new Edge(store, Directions.OUT); - } - - public static MysqlTable in(String store) { - return new Edge(store, Directions.IN); - } - } - - public abstract static class Index extends MysqlTableTemplate { - - public Index(String table) { - super(table); - } - - protected abstract String entryId(MysqlBackendEntry entry); - } - - public static class SecondaryIndex extends Index { - - public static final String TABLE = HugeType.SECONDARY_INDEX.string(); - - public SecondaryIndex(String store) { - this(store, TABLE, TYPES_MAPPING); - } - - public SecondaryIndex(String store, String table, - Map typesMapping) { - super(joinTableName(store, table)); - - this.define = new TableDefine(typesMapping); - this.define.column(HugeKeys.FIELD_VALUES, SMALL_TEXT); - this.define.column(HugeKeys.INDEX_LABEL_ID, DATATYPE_IL); - this.define.column(HugeKeys.ELEMENT_IDS, SMALL_TEXT); - this.define.column(HugeKeys.EXPIRED_TIME, BIGINT); - this.define.keys(HugeKeys.FIELD_VALUES, - HugeKeys.INDEX_LABEL_ID, - HugeKeys.ELEMENT_IDS); - } - - @Override - public final String entryId(MysqlBackendEntry entry) { - String fieldValues = entry.column(HugeKeys.FIELD_VALUES); - Integer labelId = entry.column(HugeKeys.INDEX_LABEL_ID); - return SplicingIdGenerator.concat(fieldValues, labelId.toString()); - } - } - - public static class SearchIndex extends SecondaryIndex { - - public static final String TABLE = HugeType.SEARCH_INDEX.string(); - - public SearchIndex(String store) { - super(store, TABLE, TYPES_MAPPING); - } - } - - /** - * TODO: set field value as key and set element id as value - */ - public static class UniqueIndex extends SecondaryIndex { - - public static final String TABLE = HugeType.UNIQUE_INDEX.string(); - - public UniqueIndex(String store) { - super(store, TABLE, TYPES_MAPPING); - } - } - - public static class RangeIndex extends Index { - - public RangeIndex(String store, String table) { - this(store, table, TYPES_MAPPING); - } - - public RangeIndex(String store, String table, - Map typesMapping) { - super(joinTableName(store, table)); - - this.define = new TableDefine(typesMapping); - this.define.column(HugeKeys.INDEX_LABEL_ID, DATATYPE_IL); - this.define.column(HugeKeys.FIELD_VALUES, NUMERIC); - this.define.column(HugeKeys.ELEMENT_IDS, SMALL_TEXT); - this.define.column(HugeKeys.EXPIRED_TIME, BIGINT); - this.define.keys(HugeKeys.INDEX_LABEL_ID, - HugeKeys.FIELD_VALUES, - HugeKeys.ELEMENT_IDS); - } - - @Override - public final String entryId(MysqlBackendEntry entry) { - Double fieldValue = entry.column(HugeKeys.FIELD_VALUES); - Integer labelId = entry.column(HugeKeys.INDEX_LABEL_ID); - return SplicingIdGenerator.concat(labelId.toString(), - fieldValue.toString()); - } - } - - public static class RangeIntIndex extends RangeIndex { - - public static final String TABLE = HugeType.RANGE_INT_INDEX.string(); - - public RangeIntIndex(String store) { - this(store, TABLE, TYPES_MAPPING); - } - - public RangeIntIndex(String store, String table, - Map typesMapping) { - super(store, table); - - this.define = new TableDefine(typesMapping); - this.define.column(HugeKeys.INDEX_LABEL_ID, DATATYPE_IL); - this.define.column(HugeKeys.FIELD_VALUES, INT); - this.define.column(HugeKeys.ELEMENT_IDS, SMALL_TEXT); - this.define.column(HugeKeys.EXPIRED_TIME, BIGINT); - this.define.keys(HugeKeys.INDEX_LABEL_ID, - HugeKeys.FIELD_VALUES, - HugeKeys.ELEMENT_IDS); - } - } - - public static class RangeFloatIndex extends RangeIndex { - - public static final String TABLE = HugeType.RANGE_FLOAT_INDEX.string(); - - public RangeFloatIndex(String store) { - this(store, TABLE, TYPES_MAPPING); - } - - public RangeFloatIndex(String store, String table, - Map typesMapping) { - super(store, table); - - this.define = new TableDefine(typesMapping); - this.define.column(HugeKeys.INDEX_LABEL_ID, DATATYPE_IL); - this.define.column(HugeKeys.FIELD_VALUES, NUMERIC); - this.define.column(HugeKeys.ELEMENT_IDS, SMALL_TEXT); - this.define.column(HugeKeys.EXPIRED_TIME, BIGINT); - this.define.keys(HugeKeys.INDEX_LABEL_ID, - HugeKeys.FIELD_VALUES, - HugeKeys.ELEMENT_IDS); - } - } - - public static class RangeLongIndex extends RangeIndex { - - public static final String TABLE = HugeType.RANGE_LONG_INDEX.string(); - - public RangeLongIndex(String store) { - this(store, TABLE, TYPES_MAPPING); - } - - public RangeLongIndex(String store, String table, - Map typesMapping) { - super(store, table); - - this.define = new TableDefine(typesMapping); - this.define.column(HugeKeys.INDEX_LABEL_ID, DATATYPE_IL); - this.define.column(HugeKeys.FIELD_VALUES, BIGINT); - this.define.column(HugeKeys.ELEMENT_IDS, SMALL_TEXT); - this.define.column(HugeKeys.EXPIRED_TIME, BIGINT); - this.define.keys(HugeKeys.INDEX_LABEL_ID, - HugeKeys.FIELD_VALUES, - HugeKeys.ELEMENT_IDS); - } - } - - public static class RangeDoubleIndex extends RangeIndex { - - public static final String TABLE = HugeType.RANGE_DOUBLE_INDEX.string(); - - public RangeDoubleIndex(String store) { - this(store, TABLE, TYPES_MAPPING); - } - - public RangeDoubleIndex(String store, String table, - Map typesMapping) { - super(store, table); - - this.define = new TableDefine(typesMapping); - this.define.column(HugeKeys.INDEX_LABEL_ID, DATATYPE_IL); - this.define.column(HugeKeys.FIELD_VALUES, NUMERIC); - this.define.column(HugeKeys.ELEMENT_IDS, SMALL_TEXT); - this.define.column(HugeKeys.EXPIRED_TIME, BIGINT); - this.define.keys(HugeKeys.INDEX_LABEL_ID, - HugeKeys.FIELD_VALUES, - HugeKeys.ELEMENT_IDS); - } - } - - public static class ShardIndex extends Index { - - public static final String TABLE = HugeType.SHARD_INDEX.string(); - - public ShardIndex(String store) { - this(store, TYPES_MAPPING); - } - - public ShardIndex(String store, Map typesMapping) { - super(joinTableName(store, TABLE)); - - this.define = new TableDefine(typesMapping); - this.define.column(HugeKeys.INDEX_LABEL_ID, DATATYPE_IL); - this.define.column(HugeKeys.FIELD_VALUES, SMALL_TEXT); - this.define.column(HugeKeys.ELEMENT_IDS, SMALL_TEXT); - this.define.column(HugeKeys.EXPIRED_TIME, BIGINT); - this.define.keys(HugeKeys.INDEX_LABEL_ID, - HugeKeys.FIELD_VALUES, - HugeKeys.ELEMENT_IDS); - } - - @Override - public final String entryId(MysqlBackendEntry entry) { - Double fieldValue = entry.column(HugeKeys.FIELD_VALUES); - Integer labelId = entry.column(HugeKeys.INDEX_LABEL_ID); - return SplicingIdGenerator.concat(labelId.toString(), - fieldValue.toString()); - } - } -} diff --git a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlUtil.java b/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlUtil.java deleted file mode 100644 index 4a53b7b752..0000000000 --- a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlUtil.java +++ /dev/null @@ -1,129 +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.hugegraph.backend.store.mysql; - -public class MysqlUtil { - - public static String escapeAndWrapString(String value) { - return escapeString(value, true); - } - - public static String escapeString(String value) { - return escapeString(value, false); - } - - private static String escapeString(String value, boolean wrap) { - int length = value.length(); - if (!isEscapeNeededForString(value, length)) { - if (!wrap) { - return value; - } - StringBuilder buf = new StringBuilder(length + 2); - buf.append('\'').append(value).append('\''); - return buf.toString(); - } - - StringBuilder buffer = new StringBuilder((int) (length * 1.1d)); - - if (wrap) { - buffer.append('\''); - } - - for (int i = 0; i < length; ++i) { - char c = value.charAt(i); - switch (c) { - case '\u0000': - buffer.append('\\'); - buffer.append('0'); - break; - case '\n': - buffer.append('\\'); - buffer.append('n'); - break; - case '\r': - buffer.append('\\'); - buffer.append('r'); - break; - case '\u001a': - buffer.append('\\'); - buffer.append('Z'); - break; - case '"': - /* - * Doesn't need to add '\', because we wrap string with "'" - * Assume that we don't use Ansi Mode - */ - buffer.append('"'); - break; - case '\'': - buffer.append('\\'); - buffer.append('\''); - break; - case '\\': - buffer.append('\\'); - buffer.append('\\'); - break; - default: - buffer.append(c); - break; - } - } - - if (wrap) { - buffer.append('\''); - } - - return buffer.toString(); - } - - public static boolean isEscapeNeededForString(String sql, int length) { - boolean needsEscape = false; - - for (int i = 0; i < length; ++i) { - char c = sql.charAt(i); - switch (c) { - case '\u0000': - needsEscape = true; - break; - case '\n': - needsEscape = true; - break; - case '\r': - needsEscape = true; - break; - case '\u001a': - needsEscape = true; - break; - case '\'': - needsEscape = true; - break; - case '\\': - needsEscape = true; - break; - default: - break; - } - - if (needsEscape) { - break; - } - } - - return needsEscape; - } -} diff --git a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/ResultSetWrapper.java b/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/ResultSetWrapper.java deleted file mode 100644 index f41a4c72e3..0000000000 --- a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/ResultSetWrapper.java +++ /dev/null @@ -1,62 +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.hugegraph.backend.store.mysql; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; - -import org.apache.hugegraph.backend.BackendException; - -public class ResultSetWrapper implements AutoCloseable { - - private final ResultSet resultSet; - private final Statement statement; - - public ResultSetWrapper(ResultSet resultSet, Statement statement) { - this.resultSet = resultSet; - this.statement = statement; - } - - public boolean next() throws SQLException { - return !this.resultSet.isClosed() && this.resultSet.next(); - } - - @Override - public void close() { - try { - if (this.resultSet != null) { - this.resultSet.close(); - } - } catch (SQLException e) { - throw new BackendException("Failed to close ResultSet", e); - } finally { - try { - if (this.statement != null) { - this.statement.close(); - } - } catch (SQLException e) { - throw new BackendException("Failed to close Statement", e); - } - } - } - - public ResultSet resultSet() { - return resultSet; - } -} diff --git a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/WhereBuilder.java b/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/WhereBuilder.java deleted file mode 100644 index 5eb0fb44a3..0000000000 --- a/hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/WhereBuilder.java +++ /dev/null @@ -1,295 +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.hugegraph.backend.store.mysql; - -import java.util.List; - -import org.apache.hugegraph.backend.query.Condition.RelationType; -import org.apache.hugegraph.exception.NotSupportException; -import org.apache.hugegraph.util.E; - -public class WhereBuilder { - - private StringBuilder builder; - - public WhereBuilder() { - this(true); - } - - public WhereBuilder(boolean startWithWhere) { - if (startWithWhere) { - this.builder = new StringBuilder(" WHERE "); - } else { - this.builder = new StringBuilder(" "); - } - } - - public WhereBuilder relation(String key, RelationType type, Object value) { - String operator = null; - switch (type) { - case EQ: - operator = "="; - break; - case NEQ: - operator = "!="; - break; - case GT: - operator = ">"; - break; - case GTE: - operator = ">="; - break; - case LT: - operator = "<"; - break; - case LTE: - operator = "<="; - break; - case IN: - @SuppressWarnings("unchecked") - List values = (List) value; - this.in(key, values); - break; - case CONTAINS_VALUE: - case CONTAINS_KEY: - case SCAN: - default: - throw new NotSupportException("relation '%s'", type); - } - if (operator != null) { - this.builder.append(key); - this.builder.append(operator); - this.builder.append(wrapStringIfNeeded(value)); - } - return this; - } - - /** - * Concat as: cond1 and cond2... - * - * @return WhereBuilder - */ - public WhereBuilder and() { - this.builder.append(" AND "); - return this; - } - - /** - * Concat as: key1 op ? and key2 op ?... - * - * @param keys the keys to be concatted with value - * @param operator the operator to link every key and value pair - * @return WhereBuilder - */ - public WhereBuilder and(List keys, String operator) { - for (int i = 0, n = keys.size(); i < n; i++) { - this.builder.append(keys.get(i)); - this.builder.append(operator); - this.builder.append("?"); - if (i != n - 1) { - this.builder.append(" AND "); - } - } - return this; - } - - /** - * Concat as: key1 = value1 and key2 = value2... - * - * @param keys the keys to be concatted with values according to the - * same index - * @param values the values to be concatted with every keys according to - * the same index - * @return WhereBuilder - */ - public WhereBuilder and(List keys, List values) { - return this.and(keys, "=", values); - } - - /** - * Concat as: key1 op value1 and key2 op value2... - * - * @param keys the keys to be concatted with values according to the - * same index - * @param operator the operator to link every key and value pair - * @param values the values to be concatted with every keys according to - * the same index - * @return WhereBuilder - */ - public WhereBuilder and(List keys, - String operator, - List values) { - E.checkArgument(keys.size() == values.size(), - "The size of keys '%s' is not equal with " + - "values size '%s'", - keys.size(), values.size()); - - for (int i = 0, n = keys.size(); i < n; i++) { - this.builder.append(keys.get(i)); - this.builder.append(operator); - this.builder.append(wrapStringIfNeeded(values.get(i))); - if (i != n - 1) { - this.builder.append(" AND "); - } - } - return this; - } - - /** - * Concat as: key1 op1 value1 and key2 op2 value2... - * - * @param keys the keys to be concatted with values according to the - * same index - * @param operators the operators to link every key and value pair - * according to the same index - * @param values the values to be concatted with every keys according to - * the same index - * @return WhereBuilder - */ - public WhereBuilder and(List keys, - List operators, - List values) { - E.checkArgument(keys.size() == operators.size(), - "The size of keys '%s' is not equal with " + - "operators size '%s'", - keys.size(), operators.size()); - E.checkArgument(keys.size() == values.size(), - "The size of keys '%s' is not equal with " + - "values size '%s'", - keys.size(), values.size()); - - for (int i = 0, n = keys.size(); i < n; i++) { - this.builder.append(keys.get(i)); - this.builder.append(operators.get(i)); - this.builder.append(wrapStringIfNeeded(values.get(i))); - if (i != n - 1) { - this.builder.append(" AND "); - } - } - return this; - } - - /** - * Concat as: clause1 and clause2... - * - * @param clauses the clauses to be concatted with 'AND' operator - * @return WhereBuilder - */ - public WhereBuilder and(List clauses) { - E.checkArgument(clauses != null && !clauses.isEmpty(), - "The clauses can't be empty"); - - int size = clauses.size(); - int i = 0; - for (StringBuilder clause : clauses) { - this.builder.append(clause); - if (++i != size) { - this.builder.append(" AND "); - } - } - return this; - } - - /** - * Concat as: key in (value1, value2...) - * - * @param key the key to be concatted with 'IN' operator - * @param values the values to be concated with ',' and wrapped by '()' - * @return WhereBuilder - */ - public WhereBuilder in(String key, List values) { - this.builder.append(key).append(" IN ("); - for (int i = 0, n = values.size(); i < n; i++) { - this.builder.append(wrapStringIfNeeded(values.get(i))); - if (i != n - 1) { - this.builder.append(", "); - } - } - this.builder.append(")"); - return this; - } - - /** - * Concat as: (key1, key2...keyn) {@code >=} (val1, val2...valn) - * - * @param keys the keys to be concatted with {@code >=} operator - * @param values the values to be concatted with {@code >=} operator - * @return WhereBuilder - */ - public WhereBuilder gte(List keys, List values) { - E.checkArgument(keys.size() == values.size(), - "The size of keys '%s' is not equal with " + - "values size '%s'", - keys.size(), values.size()); - this.builder.append("("); - for (int i = 0, n = keys.size(); i < n; i++) { - this.builder.append(keys.get(i)); - if (i != n - 1) { - this.builder.append(", "); - } - } - this.builder.append(") >= ("); - for (int i = 0, n = values.size(); i < n; i++) { - this.builder.append(wrapStringIfNeeded(values.get(i))); - if (i != n - 1) { - this.builder.append(", "); - } - } - this.builder.append(")"); - return this; - } - - public WhereBuilder gte(String key, Object value) { - this.builder.append(" ") - .append(key) - .append(" >= ") - .append(wrapStringIfNeeded(value)) - .append(" "); - return this; - } - - public WhereBuilder lt(String key, Object value) { - this.builder.append(" ") - .append(key) - .append(" < ") - .append(wrapStringIfNeeded(value)) - .append(" "); - return this; - } - - public StringBuilder build() { - return this.builder; - } - - @Override - public String toString() { - return this.builder.toString(); - } - - protected String wrapStringIfNeeded(Object value) { - if (value instanceof String) { - return this.escapeAndWrapString((String) value); - } else { - return String.valueOf(value); - } - } - - protected String escapeAndWrapString(String value) { - return MysqlUtil.escapeAndWrapString(value); - } -} diff --git a/hugegraph-server/hugegraph-palo/pom.xml b/hugegraph-server/hugegraph-palo/pom.xml deleted file mode 100644 index 5b81e829da..0000000000 --- a/hugegraph-server/hugegraph-palo/pom.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - - - hugegraph-server - org.apache.hugegraph - ${revision} - ../pom.xml - - 4.0.0 - - hugegraph-palo - - - - org.apache.hugegraph - hugegraph-core - ${revision} - - - org.apache.hugegraph - hugegraph-mysql - ${revision} - - - - org.glassfish.jersey.core - jersey-client - ${jersey.version} - - - - diff --git a/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloFeatures.java b/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloFeatures.java deleted file mode 100644 index ee3d2ed20f..0000000000 --- a/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloFeatures.java +++ /dev/null @@ -1,134 +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.hugegraph.backend.store.palo; - -import org.apache.hugegraph.backend.store.BackendFeatures; - -public class PaloFeatures implements BackendFeatures { - - @Override - public boolean supportsScanToken() { - return false; - } - - @Override - public boolean supportsScanKeyPrefix() { - return false; - } - - @Override - public boolean supportsScanKeyRange() { - return false; - } - - @Override - public boolean supportsQuerySchemaByName() { - return true; - } - - @Override - public boolean supportsQueryByLabel() { - /* - * Create a rollup table on vertices/edges can speed up query by label, - * but it will store data in vertices/edges again. - * See: https://github.com/baidu/palo/wiki/Data-Model%2C-Rollup-%26 - * -Prefix-Index - */ - return false; - } - - @Override - public boolean supportsQueryWithInCondition() { - return false; - } - - @Override - public boolean supportsQueryWithRangeCondition() { - return true; - } - - @Override - public boolean supportsQuerySortByInputIds() { - return false; - } - - @Override - public boolean supportsQueryWithContains() { - return false; - } - - @Override - public boolean supportsQueryWithContainsKey() { - return false; - } - - @Override - public boolean supportsQueryWithOrderBy() { - return true; - } - - @Override - public boolean supportsQueryByPage() { - return true; - } - - @Override - public boolean supportsDeleteEdgeByLabel() { - return true; - } - - @Override - public boolean supportsUpdateVertexProperty() { - return false; - } - - @Override - public boolean supportsMergeVertexProperty() { - return false; - } - - @Override - public boolean supportsUpdateEdgeProperty() { - return false; - } - - @Override - public boolean supportsTransaction() { - return false; - } - - @Override - public boolean supportsNumberType() { - return true; - } - - @Override - public boolean supportsAggregateProperty() { - return false; - } - - @Override - public boolean supportsTtl() { - return false; - } - - @Override - public boolean supportsOlapProperties() { - return false; - } -} diff --git a/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloFile.java b/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloFile.java deleted file mode 100644 index d9aed31c01..0000000000 --- a/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloFile.java +++ /dev/null @@ -1,192 +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.hugegraph.backend.store.palo; - -import java.io.File; -import java.io.IOException; -import java.nio.file.Paths; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.apache.commons.io.FileUtils; -import org.apache.hugegraph.backend.BackendException; -import org.apache.hugegraph.config.HugeConfig; -import org.apache.hugegraph.util.E; - -import com.google.common.base.Charsets; -import com.google.common.collect.ImmutableList; - -public class PaloFile extends File { - - private static final long serialVersionUID = -1918775445693598353L; - - public PaloFile(String dir, String subDir, String fileName) { - this(Paths.get(dir, subDir, fileName).toString()); - } - - public PaloFile(String path, int id, int part) { - this(Paths.get(path, formatFileName(id, part)).toString()); - } - - public PaloFile(String path) { - super(path); - } - - public String table() { - return this.getParentFile().getName(); - } - - public int sessionId() { - String[] parts = this.getName().split("-"); - E.checkState(parts.length == 2, - "Invalid file name format '%s' for palo temp file, " + - "the legal format is session{m}-part{n}", this.getName()); - return Integer.parseInt(parts[0].substring("session".length())); - } - - public int sessionPart() { - String[] parts = this.getName().split("-"); - E.checkState(parts.length == 2, - "Invalid file name format '%s' for palo temp file, " + - "the legal format is session{m}-part{n}", this.getName()); - return Integer.parseInt(parts[1].substring("part".length())); - } - - public int writeLines(Collection lines) { - try { - FileUtils.writeLines(this, Charsets.UTF_8.name(), lines, true); - } catch (IOException e) { - throw new BackendException(e); - } - return lines.size(); - } - - public String readAsString() { - try { - return FileUtils.readFileToString(this); - } catch (IOException e) { - throw new BackendException(e); - } - } - - public void forceDelete() { - if (this.exists()) { - try { - FileUtils.forceDelete(this); - } catch (IOException e) { - throw new BackendException(e); - } - } - } - - public static void clearDir(String tempDir) { - File file = FileUtils.getFile(tempDir); - if (!file.exists()) { - return; - } - try { - FileUtils.forceDelete(file); - } catch (IOException e) { - throw new BackendException(e); - } - } - - public static List scan(String path, List tableDirs) { - File directory = FileUtils.getFile(path); - if (!directory.exists()) { - return ImmutableList.of(); - } - - File[] subDirs = directory.listFiles((dir, name) -> { - return tableDirs.contains(name); - }); - if (subDirs == null || subDirs.length == 0) { - return ImmutableList.of(); - } - - List paloFiles = new ArrayList<>(subDirs.length); - for (File subDir : subDirs) { - String[] fileNames = subDir.list(); - if (fileNames == null) { - continue; - } - for (String fileName : fileNames) { - paloFiles.add(new PaloFile(path, subDir.getName(), fileName)); - } - } - - /* - * Sort palo file by updated time in asc order, - * let old files to be processed in priority - */ - paloFiles.sort((file1, file2) -> { - return (int) (file1.lastModified() - file2.lastModified()); - }); - return paloFiles; - } - - private static String formatFileName(int id, int part) { - return String.format("session%s-part%s", id, part); - } - - private static int[] parseFileName(String fileName) { - String[] nameParts = fileName.split("-"); - E.checkArgument(nameParts.length == 2, - "Invalid file name format '%s' for palo temp file, " + - "the legal format is session{m}-part{n}", fileName); - int[] rs = new int[2]; - rs[0] = Integer.parseInt(nameParts[0].substring("session".length())); - rs[1] = Integer.parseInt(nameParts[1].substring("part".length())); - return rs; - } - - public static long limitSize(HugeConfig config) { - long limitSize = config.get(PaloOptions.PALO_FILE_LIMIT_SIZE); - return limitSize * 1024 * 1024; - } - - public static Set scanSessionIds(HugeConfig config, - List tableDirs) { - Set sessionIds = new HashSet<>(); - - String path = config.get(PaloOptions.PALO_TEMP_DIR); - File pathDir = Paths.get(path).toFile(); - if (!pathDir.exists()) { - return sessionIds; - } - for (String table : tableDirs) { - File tableDir = Paths.get(path, table).toFile(); - if (!tableDir.exists()) { - continue; - } - String[] fileNames = tableDir.list(); - if (fileNames == null || fileNames.length == 0) { - continue; - } - for (String fileName : fileNames) { - int[] parts = PaloFile.parseFileName(fileName); - int sessionId = parts[0]; - sessionIds.add(sessionId); - } - } - return sessionIds; - } -} 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 deleted file mode 100644 index c59b7d89b9..0000000000 --- a/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloHttpClient.java +++ /dev/null @@ -1,75 +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.hugegraph.backend.store.palo; - -import java.util.Map; - -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; - - public PaloHttpClient(HugeConfig config, String database) { - String url = this.buildUrl(config, database); - String username = config.get(PaloOptions.PALO_USERNAME); - String password = config.get(PaloOptions.PALO_PASSWORD); - Integer timeout = config.get(PaloOptions.PALO_HTTP_TIMEOUT); - - this.client = new Client(url, username, password, timeout); - } - - private String buildUrl(HugeConfig config, String database) { - String host = config.get(PaloOptions.PALO_HOST); - Integer port = config.get(PaloOptions.PALO_HTTP_PORT); - return String.format("http://%s:%s/api/%s/", host, port, database); - } - - public void bulkLoadAsync(String table, String body, String label) { - // Format path - String path = table + "/_load"; - // Format headers - RestHeaders headers = new RestHeaders(); - headers.add("Expect", "100-continue"); - // Format params - Map params = ImmutableMap.of("label", label); - // Send request - this.client.put(path, body, headers, params); - } - - private static class Client extends AbstractRestClient { - - private static final int SECOND = 1000; - - public Client(String url, String user, String password, int timeout) { - super(url, user, password, timeout * SECOND); - } - - @Override - protected void checkStatus(Response response, int... statuses) { - // pass - } - } -} diff --git a/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloLoadInfo.java b/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloLoadInfo.java deleted file mode 100644 index 91be869910..0000000000 --- a/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloLoadInfo.java +++ /dev/null @@ -1,190 +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.hugegraph.backend.store.palo; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.Date; - -public class PaloLoadInfo { - - private long jobId; - private String label; - private State state; - private String progress; - private String etlInfo; - private String taskInfo; - private String errorMsg; - private Date createTime; - private Date etlStartTime; - private Date etlFinishTime; - private Date loadStartTime; - private Date loadFinishTime; - private String url; - - public PaloLoadInfo(ResultSet result) throws SQLException { - this.jobId = result.getLong("JobId"); - this.label = result.getString("Label"); - this.state = PaloLoadInfo.State.valueOf(result.getString("State")); - this.progress = result.getString("Progress"); - this.etlInfo = result.getString("EtlInfo"); - this.taskInfo = result.getString("TaskInfo"); - this.errorMsg = result.getString("ErrorMsg"); - this.createTime = result.getDate("CreateTime"); - this.etlStartTime = result.getDate("EtlStartTime"); - this.etlFinishTime = result.getDate("EtlFinishTime"); - this.loadStartTime = result.getDate("LoadStartTime"); - this.loadFinishTime = result.getDate("LoadFinishTime"); - this.url = result.getString("URL"); - } - - public long getJobId() { - return this.jobId; - } - - public void setJobId(long jobId) { - this.jobId = jobId; - } - - public String getLabel() { - return this.label; - } - - public void setLabel(String label) { - this.label = label; - } - - public State getState() { - return this.state; - } - - public void setState(State state) { - this.state = state; - } - - public void setState(String state) { - this.state = PaloLoadInfo.State.valueOf(state); - } - - public String getProgress() { - return this.progress; - } - - public void setProgress(String progress) { - this.progress = progress; - } - - public String getEtlInfo() { - return this.etlInfo; - } - - public void setEtlInfo(String etlInfo) { - this.etlInfo = etlInfo; - } - - public String getTaskInfo() { - return this.taskInfo; - } - - public void setTaskInfo(String taskInfo) { - this.taskInfo = taskInfo; - } - - public String getErrorMsg() { - return this.errorMsg; - } - - public void setErrorMsg(String errorMsg) { - this.errorMsg = errorMsg; - } - - public Date getCreateTime() { - return this.createTime; - } - - public void setCreateTime(Date createTime) { - this.createTime = createTime; - } - - public Date getEtlStartTime() { - return this.etlStartTime; - } - - public void setEtlStartTime(Date etlStartTime) { - this.etlStartTime = etlStartTime; - } - - public Date getEtlFinishTime() { - return this.etlFinishTime; - } - - public void setEtlFinishTime(Date etlFinishTime) { - this.etlFinishTime = etlFinishTime; - } - - public Date getLoadStartTime() { - return this.loadStartTime; - } - - public void setLoadStartTime(Date loadStartTime) { - this.loadStartTime = loadStartTime; - } - - public Date getLoadFinishTime() { - return this.loadFinishTime; - } - - public void setLoadFinishTime(Date loadFinishTime) { - this.loadFinishTime = loadFinishTime; - } - - public String getUrl() { - return this.url; - } - - public void setUrl(String url) { - this.url = url; - } - - public enum State { - - UNKNOWN(0, "UNKNOWN"), - PENDING(1, "PENDING"), - ETL(2, "ETL"), - LOADING(3, "LOADING"), - FINISHED(4, "FINISHED"), - CANCELLED(5, "CANCELLED"); - - private byte code; - private String name; - - private State(int code, String name) { - assert code >= 0 && code < 256; - this.code = (byte) code; - this.name = name; - } - - public byte code() { - return this.code; - } - - public String string() { - return this.name; - } - } -} diff --git a/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloOptions.java b/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloOptions.java deleted file mode 100644 index f8faf75027..0000000000 --- a/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloOptions.java +++ /dev/null @@ -1,108 +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.hugegraph.backend.store.palo; - -import static org.apache.hugegraph.config.OptionChecker.disallowEmpty; -import static org.apache.hugegraph.config.OptionChecker.nonNegativeInt; -import static org.apache.hugegraph.config.OptionChecker.positiveInt; -import static org.apache.hugegraph.config.OptionChecker.rangeInt; - -import org.apache.hugegraph.config.ConfigOption; -import org.apache.hugegraph.config.OptionHolder; - -public class PaloOptions extends OptionHolder { - - private PaloOptions() { - super(); - } - - private static volatile PaloOptions instance; - - public static synchronized PaloOptions instance() { - if (instance == null) { - instance = new PaloOptions(); - instance.registerOptions(); - } - return instance; - } - - public static final ConfigOption PALO_HOST = - new ConfigOption<>( - "palo.host", - "The host/ip of Palo cluster.", - disallowEmpty(), - "127.0.0.1" - ); - - public static final ConfigOption PALO_HTTP_PORT = - new ConfigOption<>( - "palo.http_port", - "The http port of Palo cluster.", - positiveInt(), - 8030 - ); - - public static final ConfigOption PALO_HTTP_TIMEOUT = - new ConfigOption<>( - "palo.http_timeout", - "Timeout(second) for connecting and reading Palo.", - nonNegativeInt(), - 20 - ); - - public static final ConfigOption PALO_USERNAME = - new ConfigOption<>( - "palo.username", - "The username to login Palo.", - disallowEmpty(), - "root" - ); - - public static final ConfigOption PALO_PASSWORD = - new ConfigOption<>( - "palo.password", - "The password corresponding to palo.username.", - null, - "" - ); - - public static final ConfigOption PALO_POLL_INTERVAL = - new ConfigOption<>( - "palo.poll_interval", - "The execution period of the background thread that " + - "check whether need to load file data into Palo.", - rangeInt(5, Integer.MAX_VALUE), - 5 - ); - - public static final ConfigOption PALO_TEMP_DIR = - new ConfigOption<>( - "palo.temp_dir", - "The temporary directory to store table files.", - null, - "palo-data" - ); - - public static final ConfigOption PALO_FILE_LIMIT_SIZE = - new ConfigOption<>( - "palo.file_limit_size", - "The maximum size(MB) of each file for loading into Palo.", - rangeInt(10, 1000), - 50 - ); -} diff --git a/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloSerializer.java b/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloSerializer.java deleted file mode 100644 index 3ab941bbd3..0000000000 --- a/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloSerializer.java +++ /dev/null @@ -1,45 +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.hugegraph.backend.store.palo; - -import org.apache.hugegraph.backend.serializer.TableBackendEntry; -import org.apache.hugegraph.backend.store.mysql.MysqlSerializer; -import org.apache.hugegraph.config.HugeConfig; -import org.apache.hugegraph.schema.SchemaLabel; -import org.apache.hugegraph.type.define.HugeKeys; - -public class PaloSerializer extends MysqlSerializer { - - public PaloSerializer(HugeConfig config) { - super(config); - } - - @Override - protected void writeEnableLabelIndex(SchemaLabel schema, - TableBackendEntry entry) { - Byte enable = (byte) (schema.enableLabelIndex() ? 1 : 0); - entry.column(HugeKeys.ENABLE_LABEL_INDEX, enable); - } - - @Override - protected void readEnableLabelIndex(SchemaLabel schema, - TableBackendEntry entry) { - Number enable = entry.column(HugeKeys.ENABLE_LABEL_INDEX); - schema.enableLabelIndex(enable.byteValue() != 0); - } -} diff --git a/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloSessions.java b/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloSessions.java deleted file mode 100644 index 735645eab8..0000000000 --- a/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloSessions.java +++ /dev/null @@ -1,317 +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.hugegraph.backend.store.palo; - -import java.nio.file.Paths; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.Timer; -import java.util.TimerTask; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.concurrent.locks.Lock; -import java.util.concurrent.locks.ReadWriteLock; -import java.util.concurrent.locks.ReentrantReadWriteLock; - -import org.apache.hugegraph.backend.BackendException; -import org.apache.hugegraph.backend.store.mysql.MysqlSessions; -import org.apache.hugegraph.backend.store.mysql.ResultSetWrapper; -import org.apache.hugegraph.config.HugeConfig; -import org.apache.hugegraph.date.SafeDateFormat; -import org.apache.hugegraph.util.Log; -import org.slf4j.Logger; - -import com.google.common.collect.LinkedListMultimap; -import com.google.common.collect.Multimap; - -public class PaloSessions extends MysqlSessions { - - private static final Logger LOG = Log.logger(PaloSessions.class); - - private final AtomicInteger counter; - private final Map locks; - - private final Timer timer; - private final PaloLoadTask loadTask; - - public PaloSessions(HugeConfig config, String database, String store, - List tableDirs) { - super(config, database, store); - this.counter = new AtomicInteger(); - this.locks = new ConcurrentHashMap<>(); - // Scan disk files and restore session information - this.restoreSessionInfo(config, tableDirs); - - this.timer = new Timer(true); - long interval = config.get(PaloOptions.PALO_POLL_INTERVAL); - this.loadTask = new PaloLoadTask(tableDirs); - this.timer.schedule(this.loadTask, 0, interval * 1000); - } - - private void restoreSessionInfo(HugeConfig config, List tableDirs) { - Set sessionIds = PaloFile.scanSessionIds(config, tableDirs); - for (Integer sessionId : sessionIds) { - if (!this.locks.containsKey(sessionId)) { - // Create a read write lock for every session - this.locks.put(sessionId, new ReentrantReadWriteLock()); - } - } - // Update counter value to avoid new session has duplicate id with old - int maxSessionId = 0; - for (int sessionId : sessionIds) { - if (sessionId > maxSessionId) { - maxSessionId = sessionId; - } - } - this.counter.addAndGet(maxSessionId); - } - - @Override - protected String buildCreateDatabase(String database) { - return String.format("CREATE DATABASE IF NOT EXISTS %s;", database); - } - - @Override - public final Session session() { - return (Session) super.getOrNewSession(); - } - - @Override - protected final Session newSession() { - int id = this.counter.incrementAndGet(); - this.locks.put(id, new ReentrantReadWriteLock()); - return new Session(id); - } - - @Override - public boolean close() { - this.loadTask.join(); - this.timer.cancel(); - super.close(); - return true; - } - - public final class Session extends MysqlSessions.Session { - - private final int id; - /** - * Stores the number of the file for each table that has been recorded - * table1 -> session-part{n} - */ - private final Map parts; - /** - * Store data rows for each table - * table -> [row-1, row-2, ...row-n] - */ - private final Multimap batch; - - public Session(int id) { - super(); - this.id = id; - this.parts = new HashMap<>(); - this.batch = LinkedListMultimap.create(); - } - - public void add(String table, String row) { - this.batch.put(table, row); - this.parts.putIfAbsent(table, 0); - } - - @Override - public Integer commit() { - int updated = 0; - if (!this.batch.isEmpty()) { - updated += this.writeBatch(); - } - updated += super.commit(); - this.clear(); - return updated; - } - - @Override - public void rollback() { - super.rollback(); - this.clear(); - } - - @Override - public void clear() { - super.clear(); - this.batch.clear(); - } - - private int writeBatch() { - int updated = 0; - PaloSessions.this.locks.get(this.id).writeLock().lock(); - try { - for (String table : this.batch.keySet()) { - PaloFile file = this.getOrCreate(table); - updated += file.writeLines(this.batch.get(table)); - } - } finally { - PaloSessions.this.locks.get(this.id).writeLock().unlock(); - } - return updated; - } - - private PaloFile getOrCreate(String table) { - String tempDir = config().get(PaloOptions.PALO_TEMP_DIR); - long limitSize = PaloFile.limitSize(config()); - - // The table data path: 'palo-data/property_keys' - String path = Paths.get(tempDir, table).toString(); - int part = this.parts.get(table); - // The full file name: 'palo-data/property_keys/session1-part0' - PaloFile file = new PaloFile(path, this.id, part); - // Increase part number when file size exceed limit size - if (file.length() >= limitSize) { - this.parts.put(table, ++part); - file = new PaloFile(path, this.id, part); - } - return file; - } - - @SuppressWarnings("unused") - private PaloLoadInfo getLoadInfoByLabel(String label) { - String sql = String.format("SHOW LOAD WHERE LABEL = '%s'", label); - try (ResultSetWrapper results = this.select(sql)) { - ResultSet rs = results.resultSet(); - if (rs.next()) { - return new PaloLoadInfo(rs); - } - throw new BackendException("Non-exist load label '%s'", label); - } catch (SQLException e) { - throw new BackendException("Failed to fetch load info " + - "for label '%s'", e, label); - } - } - } - - public final class PaloLoadTask extends TimerTask { - - private static final String DF = "yyyy-MM-dd-HH-mm-ss"; - private final SafeDateFormat dateFormat = new SafeDateFormat(DF); - - /** - * There exist two running palo load task corresponds to two stores, - * `SchemaStore -> SchemaLoadTask` and `GraphStore -> GraphLoadTask`, - * the load task just handle with it's own subdirectory files, - * like: `property_keys, vertex_labels ...` for SchemaLoadTask, - * and: `vertices, edges ...` for GraphLoadTask - * these subdirectory called validSubDirs. - */ - private final List tableDirs; - /** - * session1-part1.txt session2-part1.txt ... - * vertices 128m 125m ... - * edges 256m 250m ... - * ... ... ... ... - */ - private List lastPaloFiles; - private final PaloHttpClient client; - - public PaloLoadTask(List tableDirs) { - this.tableDirs = tableDirs; - this.lastPaloFiles = null; - this.client = new PaloHttpClient(config(), database()); - } - - /** - * TODO: Need to be optimized - */ - public void join() { - Integer interval = config().get(PaloOptions.PALO_POLL_INTERVAL); - while (this.lastPaloFiles != null && - !this.lastPaloFiles.isEmpty()) { - try { - TimeUnit.SECONDS.sleep(interval); - } catch (InterruptedException e) { - throw new BackendException(e); - } - } - } - - @Override - public void run() { - LOG.debug("The Load task:{} ready to run", PaloSessions.this); - // Scan the directory to get all file size - String path = config().get(PaloOptions.PALO_TEMP_DIR); - List paloFiles = PaloFile.scan(path, this.tableDirs); - // Do nothing if there is no file at present - if (paloFiles.isEmpty()) { - return; - } - // Try to load one batch if last time and this time have some files - if (this.lastPaloFiles != null) { - this.tryLoadBatch(paloFiles); - } - // Update the last palo files - this.lastPaloFiles = paloFiles; - } - - private void tryLoadBatch(List files) { - PaloFile file = this.peekFile(files); - // Load the first file when stopped inserting data - this.loadThenDelete(file); - files.remove(file); - } - - private PaloFile peekFile(List files) { - assert !files.isEmpty(); - long limitSize = PaloFile.limitSize(config()); - // Load the file which exceed limit size in priority - for (PaloFile file : files) { - long fileSize = file.length(); - if (fileSize >= limitSize) { - return file; - } - } - // Load the oldest file(files are sorted by updated time) - return files.get(0); - } - - private void loadThenDelete(PaloFile file) { - // Parse session id from file name - int sessionId = file.sessionId(); - LOG.info("Ready to load one batch from file: {}", file); - // Get write lock because will delete file - Lock lock = PaloSessions.this.locks.get(sessionId).writeLock(); - lock.lock(); - try { - String table = file.table(); - String data = file.readAsString(); - String label = this.formatLabel(table); - this.client.bulkLoadAsync(table, data, label); - // Force delete file - file.forceDelete(); - } finally { - lock.unlock(); - } - } - - private String formatLabel(String table) { - return table + "-" + this.dateFormat.format(new Date()); - } - } -} diff --git a/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloStore.java b/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloStore.java deleted file mode 100644 index 344800868b..0000000000 --- a/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloStore.java +++ /dev/null @@ -1,50 +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.hugegraph.backend.store.palo; - -import java.util.List; -import java.util.stream.Collectors; - -import org.apache.hugegraph.backend.store.BackendStoreProvider; -import org.apache.hugegraph.backend.store.BackendTable; -import org.apache.hugegraph.backend.store.mysql.MysqlStore; -import org.apache.hugegraph.config.HugeConfig; -import org.apache.hugegraph.util.Log; -import org.slf4j.Logger; - -public abstract class PaloStore extends MysqlStore { - - private static final Logger LOG = Log.logger(PaloStore.class); - - public PaloStore(BackendStoreProvider provider, - String database, String name) { - super(provider, database, name); - } - - @Override - protected PaloSessions openSessionPool(HugeConfig config) { - LOG.info("Open palo session pool for {}", this); - return new PaloSessions(config, this.database(), this.store(), - this.tableNames()); - } - - private List tableNames() { - return this.tables().stream().map(BackendTable::table) - .collect(Collectors.toList()); - } -} diff --git a/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloStoreProvider.java b/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloStoreProvider.java deleted file mode 100644 index bde8d264ed..0000000000 --- a/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloStoreProvider.java +++ /dev/null @@ -1,175 +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.hugegraph.backend.store.palo; - -import org.apache.hugegraph.backend.LocalCounter; -import org.apache.hugegraph.backend.id.Id; -import org.apache.hugegraph.backend.store.BackendFeatures; -import org.apache.hugegraph.backend.store.BackendStore; -import org.apache.hugegraph.backend.store.BackendStoreProvider; -import org.apache.hugegraph.backend.store.mysql.MysqlStoreProvider; -import org.apache.hugegraph.config.HugeConfig; -import org.apache.hugegraph.type.HugeType; -import org.apache.hugegraph.type.define.Directions; - -public class PaloStoreProvider extends MysqlStoreProvider { - - private static final BackendFeatures FEATURES = new PaloFeatures(); - - @Override - protected BackendStore newSchemaStore(HugeConfig config, String store) { - return new PaloSchemaStore(this, this.database(), store); - } - - @Override - protected BackendStore newGraphStore(HugeConfig config, String store) { - return new PaloGraphStore(this, this.database(), store); - } - - @Override - public String type() { - return "palo"; - } - - @Override - public String driverVersion() { - /* - * Versions history: - * [1.0] HugeGraph-1328: supports backend table version checking - * [1.1] HugeGraph-1322: add support for full-text search - * [1.2] #296: support range sortKey feature - * [1.3] #270 & #398: support shard-index and vertex + sortkey prefix, - * also split range table to rangeInt, rangeFloat, - * rangeLong and rangeDouble - * [1.4] #633: support unique index - * [1.5] #661: reduce the storage of vertex/edge id - * [1.6] #746: support userdata for indexlabel - * [1.7] #894: asStoredString() encoding is changed to signed B64 - * instead of sortable B64 - * [1.8] #295: support ttl for vertex and edge - * [1.9] #1333: support read frequency for property key - * [1.10] #1506: rename read frequency to write type - * [1.10] #1533: add meta table in system store - */ - return "1.10"; - } - - public static class PaloSchemaStore extends PaloStore { - - private final LocalCounter counter; - - public PaloSchemaStore(BackendStoreProvider provider, - String database, String store) { - super(provider, database, store); - - this.counter = new LocalCounter(); - - registerTableManager(HugeType.VERTEX_LABEL, - new PaloTables.VertexLabel()); - registerTableManager(HugeType.EDGE_LABEL, - new PaloTables.EdgeLabel()); - registerTableManager(HugeType.PROPERTY_KEY, - new PaloTables.PropertyKey()); - registerTableManager(HugeType.INDEX_LABEL, - new PaloTables.IndexLabel()); - } - - @Override - public BackendFeatures features() { - return FEATURES; - } - - @Override - public Id nextId(HugeType type) { - return this.counter.nextId(type); - } - - @Override - public void increaseCounter(HugeType type, long increment) { - this.counter.increaseCounter(type, increment); - } - - @Override - public long getCounter(HugeType type) { - return this.counter.getCounter(type); - } - - @Override - public boolean isSchemaStore() { - return true; - } - } - - public static class PaloGraphStore extends PaloStore { - - public PaloGraphStore(BackendStoreProvider provider, - String database, String store) { - super(provider, database, store); - - registerTableManager(HugeType.VERTEX, - new PaloTables.Vertex(store)); - registerTableManager(HugeType.EDGE_OUT, - new PaloTables.Edge(store, Directions.OUT)); - registerTableManager(HugeType.EDGE_IN, - new PaloTables.Edge(store, Directions.IN)); - registerTableManager(HugeType.SECONDARY_INDEX, - new PaloTables.SecondaryIndex(store)); - registerTableManager(HugeType.RANGE_INT_INDEX, - new PaloTables.RangeIntIndex(store)); - registerTableManager(HugeType.RANGE_FLOAT_INDEX, - new PaloTables.RangeFloatIndex(store)); - registerTableManager(HugeType.RANGE_LONG_INDEX, - new PaloTables.RangeLongIndex(store)); - registerTableManager(HugeType.RANGE_DOUBLE_INDEX, - new PaloTables.RangeDoubleIndex(store)); - registerTableManager(HugeType.SEARCH_INDEX, - new PaloTables.SearchIndex(store)); - registerTableManager(HugeType.SHARD_INDEX, - new PaloTables.ShardIndex(store)); - registerTableManager(HugeType.UNIQUE_INDEX, - new PaloTables.UniqueIndex(store)); - } - - @Override - public BackendFeatures features() { - return FEATURES; - } - - @Override - public boolean isSchemaStore() { - return false; - } - - @Override - public Id nextId(HugeType type) { - throw new UnsupportedOperationException("PaloGraphStore.nextId()"); - } - - @Override - public void increaseCounter(HugeType type, long num) { - throw new UnsupportedOperationException( - "PaloGraphStore.increaseCounter()"); - } - - @Override - public long getCounter(HugeType type) { - throw new UnsupportedOperationException( - "PaloGraphStore.getCounter()"); - } - } -} diff --git a/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloTable.java b/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloTable.java deleted file mode 100644 index f40eef2144..0000000000 --- a/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloTable.java +++ /dev/null @@ -1,113 +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.hugegraph.backend.store.palo; - -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.apache.commons.lang3.StringUtils; -import org.apache.hugegraph.backend.BackendException; -import org.apache.hugegraph.backend.store.TableDefine; -import org.apache.hugegraph.backend.store.mysql.MysqlBackendEntry; -import org.apache.hugegraph.backend.store.mysql.MysqlSessions; -import org.apache.hugegraph.backend.store.mysql.MysqlTable; -import org.apache.hugegraph.type.define.HugeKeys; -import org.apache.hugegraph.util.Log; -import org.slf4j.Logger; - -public abstract class PaloTable extends MysqlTable { - - private static final Logger LOG = Log.logger(PaloTable.class); - - public PaloTable(String table) { - super(table); - } - - @Override - public void createTable(MysqlSessions.Session session, - TableDefine tableDefine) { - StringBuilder sql = new StringBuilder(); - sql.append("CREATE TABLE IF NOT EXISTS "); - sql.append(this.table()).append(" ("); - // Add columns - int i = 0; - for (Map.Entry entry : - tableDefine.columns().entrySet()) { - sql.append(formatKey(entry.getKey())); - sql.append(" "); - sql.append(entry.getValue()); - if (++i != tableDefine.columns().size()) { - sql.append(", "); - } - } - sql.append(")"); - // Unique keys - sql.append(" UNIQUE KEY("); - i = 0; - for (HugeKeys key : tableDefine.keys()) { - sql.append(formatKey(key)); - if (++i != tableDefine.keys().size()) { - sql.append(", "); - } - } - sql.append(")"); - // Hash keys - sql.append(" DISTRIBUTED BY HASH("); - i = 0; - for (HugeKeys key : tableDefine.keys()) { - sql.append(formatKey(key)); - if (++i != tableDefine.keys().size()) { - sql.append(", "); - } - } - sql.append(");"); - // TODO: 'replication_num(default=3)’ can be a configuration - - LOG.debug("Create table: {}", sql); - try { - session.execute(sql.toString()); - } catch (SQLException e) { - throw new BackendException("Failed to create table with '%s'", - e, sql); - } - } - - @Override - protected void appendPartition(StringBuilder delete) { - delete.append(" PARTITION ").append(this.table()); - } - - @Override - public void insert(MysqlSessions.Session session, - MysqlBackendEntry.Row entry) { - assert session instanceof PaloSessions.Session; - PaloSessions.Session paloSession = (PaloSessions.Session) session; - - Set columnNames = this.tableDefine().columnNames(); - // Ensure column order match with table define - List columnValues = new ArrayList<>(columnNames.size()); - for (HugeKeys key : columnNames) { - columnValues.add(entry.column(key)); - } - String insert = StringUtils.join(columnValues, "\t"); - paloSession.add(this.table(), insert); - } -} diff --git a/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloTables.java b/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloTables.java deleted file mode 100644 index 268c0d232f..0000000000 --- a/hugegraph-server/hugegraph-palo/src/main/java/org/apache/hugegraph/backend/store/palo/PaloTables.java +++ /dev/null @@ -1,472 +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.hugegraph.backend.store.palo; - -import java.sql.PreparedStatement; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.apache.hugegraph.backend.BackendException; -import org.apache.hugegraph.backend.id.EdgeId; -import org.apache.hugegraph.backend.id.Id; -import org.apache.hugegraph.backend.id.IdGenerator; -import org.apache.hugegraph.backend.id.IdUtil; -import org.apache.hugegraph.backend.id.SplicingIdGenerator; -import org.apache.hugegraph.backend.store.BackendEntry; -import org.apache.hugegraph.backend.store.BackendEntryIterator; -import org.apache.hugegraph.backend.store.TableDefine; -import org.apache.hugegraph.backend.store.mysql.MysqlBackendEntry; -import org.apache.hugegraph.backend.store.mysql.MysqlSessions; -import org.apache.hugegraph.backend.store.mysql.MysqlTables; -import org.apache.hugegraph.type.HugeType; -import org.apache.hugegraph.type.define.Directions; -import org.apache.hugegraph.type.define.HugeKeys; -import org.apache.hugegraph.util.E; - -public class PaloTables { - - private static final String NOT_NULL = "NOT NULL"; - private static final String DEFAULT_EMPTY = "DEFAULT ''"; - - private static final String DATATYPE_PK = "INT"; - private static final String DATATYPE_SL = "INT"; // VL/EL - private static final String DATATYPE_IL = "INT"; - - private static final String TINYINT = "TINYINT"; - private static final String INT = "INT"; - private static final String DECIMAL = "DECIMAL(27, 9)"; - private static final String VARCHAR = "VARCHAR(255)"; - private static final String TEXT = "VARCHAR(65533)"; - - public static class PaloTableTemplate extends PaloTable { - - protected TableDefine define; - - public PaloTableTemplate(String table) { - super(table); - } - - @Override - public TableDefine tableDefine() { - return this.define; - } - } - - public static class VertexLabel extends PaloTableTemplate { - - public static final String TABLE = HugeType.VERTEX_LABEL.string(); - - public VertexLabel() { - super(TABLE); - this.define = new TableDefine(); - this.define.column(HugeKeys.ID, DATATYPE_SL, NOT_NULL); - this.define.column(HugeKeys.NAME, VARCHAR, NOT_NULL); - this.define.column(HugeKeys.ID_STRATEGY, TINYINT, NOT_NULL); - this.define.column(HugeKeys.PRIMARY_KEYS, VARCHAR, DEFAULT_EMPTY); - this.define.column(HugeKeys.PROPERTIES, VARCHAR, DEFAULT_EMPTY); - this.define.column(HugeKeys.NULLABLE_KEYS, VARCHAR, DEFAULT_EMPTY); - this.define.column(HugeKeys.INDEX_LABELS, VARCHAR, DEFAULT_EMPTY); - this.define.column(HugeKeys.ENABLE_LABEL_INDEX, TINYINT, NOT_NULL); - this.define.column(HugeKeys.USER_DATA, VARCHAR, DEFAULT_EMPTY); - this.define.column(HugeKeys.STATUS, TINYINT, NOT_NULL); - this.define.column(HugeKeys.TTL, INT, NOT_NULL); - this.define.column(HugeKeys.TTL_START_TIME, INT); - // Unique keys/hash keys - this.define.keys(HugeKeys.ID); - } - } - - public static class EdgeLabel extends PaloTableTemplate { - - public static final String TABLE = HugeType.EDGE_LABEL.string(); - - public EdgeLabel() { - super(TABLE); - this.define = new TableDefine(); - this.define.column(HugeKeys.ID, DATATYPE_SL, NOT_NULL); - this.define.column(HugeKeys.NAME, VARCHAR, NOT_NULL); - this.define.column(HugeKeys.FREQUENCY, TINYINT, NOT_NULL); - this.define.column(HugeKeys.SOURCE_LABEL, INT, NOT_NULL); - this.define.column(HugeKeys.TARGET_LABEL, INT, NOT_NULL); - this.define.column(HugeKeys.SORT_KEYS, VARCHAR, DEFAULT_EMPTY); - this.define.column(HugeKeys.PROPERTIES, VARCHAR, DEFAULT_EMPTY); - this.define.column(HugeKeys.NULLABLE_KEYS, VARCHAR, DEFAULT_EMPTY); - this.define.column(HugeKeys.INDEX_LABELS, VARCHAR, DEFAULT_EMPTY); - this.define.column(HugeKeys.ENABLE_LABEL_INDEX, TINYINT, NOT_NULL); - this.define.column(HugeKeys.USER_DATA, VARCHAR, DEFAULT_EMPTY); - this.define.column(HugeKeys.STATUS, TINYINT, NOT_NULL); - this.define.column(HugeKeys.TTL, INT, NOT_NULL); - this.define.column(HugeKeys.TTL_START_TIME, INT); - // Unique keys/hash keys - this.define.keys(HugeKeys.ID); - } - } - - public static class PropertyKey extends PaloTableTemplate { - - public static final String TABLE = HugeType.PROPERTY_KEY.string(); - - public PropertyKey() { - super(TABLE); - this.define = new TableDefine(); - this.define.column(HugeKeys.ID, DATATYPE_PK, NOT_NULL); - this.define.column(HugeKeys.NAME, VARCHAR, NOT_NULL); - this.define.column(HugeKeys.DATA_TYPE, TINYINT, NOT_NULL); - this.define.column(HugeKeys.CARDINALITY, TINYINT, NOT_NULL); - this.define.column(HugeKeys.PROPERTIES, VARCHAR, DEFAULT_EMPTY); - this.define.column(HugeKeys.USER_DATA, VARCHAR, DEFAULT_EMPTY); - this.define.column(HugeKeys.STATUS, TINYINT, NOT_NULL); - // Unique keys/hash keys - this.define.keys(HugeKeys.ID); - } - } - - public static class IndexLabel extends PaloTableTemplate { - - public static final String TABLE = HugeType.INDEX_LABEL.string(); - - public IndexLabel() { - super(TABLE); - this.define = new TableDefine(); - this.define.column(HugeKeys.ID, DATATYPE_IL, NOT_NULL); - this.define.column(HugeKeys.NAME, VARCHAR, NOT_NULL); - this.define.column(HugeKeys.BASE_TYPE, TINYINT, NOT_NULL); - this.define.column(HugeKeys.BASE_VALUE, INT, NOT_NULL); - this.define.column(HugeKeys.INDEX_TYPE, TINYINT, NOT_NULL); - this.define.column(HugeKeys.FIELDS, VARCHAR, NOT_NULL); - this.define.column(HugeKeys.USER_DATA, VARCHAR, DEFAULT_EMPTY); - this.define.column(HugeKeys.STATUS, TINYINT, NOT_NULL); - // Unique keys/hash keys - this.define.keys(HugeKeys.ID); - } - } - - public static class Vertex extends PaloTableTemplate { - - public static final String TABLE = HugeType.VERTEX.string(); - - public Vertex(String store) { - super(joinTableName(store, TABLE)); - - this.define = new TableDefine(); - this.define.column(HugeKeys.ID, VARCHAR, NOT_NULL); - this.define.column(HugeKeys.LABEL, INT, NOT_NULL); - this.define.column(HugeKeys.PROPERTIES, TEXT, DEFAULT_EMPTY); - this.define.column(HugeKeys.EXPIRED_TIME, DECIMAL, NOT_NULL); - // Unique keys/hash keys - this.define.keys(HugeKeys.ID); - } - } - - /** - * TODO: How to let Edge extends from PaloTable and MysqlTables.Edge? - */ - public static class Edge extends PaloTableTemplate { - - private final Directions direction; - private final String delByLabelTemplate; - - public Edge(String store, Directions direction) { - super(joinTableName(store, MysqlTables.Edge.table(direction))); - - this.direction = direction; - this.delByLabelTemplate = String.format( - "DELETE FROM %s PARTITION %s WHERE %s = ?;", - this.table(), this.table(), - formatKey(HugeKeys.LABEL)); - - this.define = new TableDefine(); - this.define.column(HugeKeys.OWNER_VERTEX, VARCHAR, NOT_NULL); - this.define.column(HugeKeys.DIRECTION, TINYINT, NOT_NULL); - this.define.column(HugeKeys.LABEL, INT, NOT_NULL); - this.define.column(HugeKeys.SORT_VALUES, VARCHAR, NOT_NULL, - DEFAULT_EMPTY); - this.define.column(HugeKeys.OTHER_VERTEX, VARCHAR, NOT_NULL); - this.define.column(HugeKeys.PROPERTIES, TEXT, DEFAULT_EMPTY); - this.define.column(HugeKeys.EXPIRED_TIME, DECIMAL, NOT_NULL); - // Unique keys/hash keys - this.define.keys(HugeKeys.OWNER_VERTEX, HugeKeys.DIRECTION, - HugeKeys.LABEL, HugeKeys.SORT_VALUES, - HugeKeys.OTHER_VERTEX); - } - - @Override - protected List idColumnValue(Id id) { - EdgeId edgeId; - if (!(id instanceof EdgeId)) { - String[] idParts = EdgeId.split(id); - if (idParts.length == 1) { - // Delete edge by label - return Arrays.asList(idParts); - } - id = IdUtil.readString(id.asString()); - edgeId = EdgeId.parse(id.asString()); - } else { - edgeId = (EdgeId) id; - } - - E.checkState(edgeId.direction() == this.direction, - "Can't query %s edges from %s edges table", - edgeId.direction(), this.direction); - - List list = new ArrayList<>(5); - list.add(IdUtil.writeStoredString(edgeId.ownerVertexId())); - list.add(edgeId.direction().code()); - list.add(edgeId.edgeLabelId().asLong()); - list.add(edgeId.sortValues()); - list.add(IdUtil.writeStoredString(edgeId.otherVertexId())); - return list; - } - - @Override - public void delete(MysqlSessions.Session session, - MysqlBackendEntry.Row entry) { - // Let super class do delete if not deleting edge by label - List idParts = this.idColumnValue(entry.id()); - if (idParts.size() > 1 || !entry.columns().isEmpty()) { - super.delete(session, entry); - return; - } - - // The only element is label - this.deleteEdgesByLabel(session, entry.id()); - } - - private void deleteEdgesByLabel(MysqlSessions.Session session, - Id label) { - PreparedStatement deleteStmt; - try { - // Create or get delete prepare statement - deleteStmt = session.prepareStatement(this.delByLabelTemplate); - // Delete edges - deleteStmt.setObject(1, label.asLong()); - } catch (SQLException e) { - throw new BackendException("Failed to prepare statement '%s'", - this.delByLabelTemplate); - } - session.add(deleteStmt); - } - - @Override - protected BackendEntry mergeEntries(BackendEntry e1, BackendEntry e2) { - // Merge edges into vertex - // TODO: merge rows before calling row2Entry() - - MysqlBackendEntry current = (MysqlBackendEntry) e1; - MysqlBackendEntry next = (MysqlBackendEntry) e2; - - E.checkState(current == null || current.type().isVertex(), - "The current entry must be null or VERTEX"); - E.checkState(next != null && next.type().isEdge(), - "The next entry must be EDGE"); - - long maxSize = BackendEntryIterator.INLINE_BATCH_SIZE; - if (current != null && current.subRows().size() < maxSize) { - Id nextVertexId = IdGenerator.of( - next.column(HugeKeys.OWNER_VERTEX)); - if (current.id().equals(nextVertexId)) { - current.subRow(next.row()); - return current; - } - } - - return this.wrapByVertex(next); - } - - private MysqlBackendEntry wrapByVertex(MysqlBackendEntry edge) { - assert edge.type().isEdge(); - String ownerVertex = edge.column(HugeKeys.OWNER_VERTEX); - E.checkState(ownerVertex != null, "Invalid backend entry"); - Id vertexId = IdGenerator.of(ownerVertex); - MysqlBackendEntry vertex = new MysqlBackendEntry(HugeType.VERTEX, - vertexId); - - vertex.column(HugeKeys.ID, ownerVertex); - vertex.column(HugeKeys.PROPERTIES, ""); - - vertex.subRow(edge.row()); - return vertex; - } - } - - public abstract static class Index extends PaloTableTemplate { - - public Index(String table) { - super(table); - } - - @Override - protected BackendEntry mergeEntries(BackendEntry e1, BackendEntry e2) { - MysqlBackendEntry current = (MysqlBackendEntry) e1; - MysqlBackendEntry next = (MysqlBackendEntry) e2; - - E.checkState(current == null || current.type().isIndex(), - "The current entry must be null or INDEX"); - E.checkState(next != null && next.type().isIndex(), - "The next entry must be INDEX"); - - long maxSize = BackendEntryIterator.INLINE_BATCH_SIZE; - if (current != null && current.subRows().size() < maxSize) { - String currentId = this.entryId(current); - String nextId = this.entryId(next); - if (currentId.equals(nextId)) { - current.subRow(next.row()); - return current; - } - } - return next; - } - - protected abstract String entryId(MysqlBackendEntry entry); - } - - public static class SecondaryIndex extends Index { - - public static final String TABLE = HugeType.SECONDARY_INDEX.string(); - - public SecondaryIndex(String store) { - this(store, TABLE); - } - - protected SecondaryIndex(String store, String table) { - super(joinTableName(store, table)); - - this.define = new TableDefine(); - this.define.column(HugeKeys.FIELD_VALUES, VARCHAR, NOT_NULL); - this.define.column(HugeKeys.INDEX_LABEL_ID, INT, NOT_NULL); - this.define.column(HugeKeys.ELEMENT_IDS, VARCHAR, NOT_NULL); - // Unique keys/hash keys - this.define.keys(HugeKeys.FIELD_VALUES, - HugeKeys.INDEX_LABEL_ID, - HugeKeys.ELEMENT_IDS); - } - - @Override - protected final String entryId(MysqlBackendEntry entry) { - String fieldValues = entry.column(HugeKeys.FIELD_VALUES); - Integer labelId = entry.column(HugeKeys.INDEX_LABEL_ID); - return SplicingIdGenerator.concat(fieldValues, labelId.toString()); - } - } - - public static class SearchIndex extends SecondaryIndex { - - public static final String TABLE = HugeType.SEARCH_INDEX.string(); - - public SearchIndex(String store) { - super(store, TABLE); - } - } - - public static class UniqueIndex extends SecondaryIndex { - - public static final String TABLE = HugeType.UNIQUE_INDEX.string(); - - public UniqueIndex(String store) { - super(store, TABLE); - } - } - - public abstract static class RangeIndex extends Index { - - public RangeIndex(String store, String table) { - super(joinTableName(store, table)); - - this.define = new TableDefine(); - this.define.column(HugeKeys.INDEX_LABEL_ID, INT, NOT_NULL); - this.define.column(HugeKeys.FIELD_VALUES, DECIMAL, NOT_NULL); - this.define.column(HugeKeys.ELEMENT_IDS, VARCHAR, NOT_NULL); - // Unique keys/hash keys - this.define.keys(HugeKeys.INDEX_LABEL_ID, - HugeKeys.FIELD_VALUES, - HugeKeys.ELEMENT_IDS); - } - - @Override - protected final String entryId(MysqlBackendEntry entry) { - Double fieldValue = entry.column(HugeKeys.FIELD_VALUES); - Integer labelId = entry.column(HugeKeys.INDEX_LABEL_ID); - return SplicingIdGenerator.concat(labelId.toString(), - fieldValue.toString()); - } - } - - public static class RangeIntIndex extends RangeIndex { - - public static final String TABLE = HugeType.RANGE_INT_INDEX.string(); - - public RangeIntIndex(String store) { - super(store, TABLE); - } - } - - public static class RangeFloatIndex extends RangeIndex { - - public static final String TABLE = HugeType.RANGE_FLOAT_INDEX.string(); - - public RangeFloatIndex(String store) { - super(store, TABLE); - } - } - - public static class RangeLongIndex extends RangeIndex { - - public static final String TABLE = HugeType.RANGE_LONG_INDEX.string(); - - public RangeLongIndex(String store) { - super(store, TABLE); - } - } - - public static class RangeDoubleIndex extends RangeIndex { - - public static final String TABLE = HugeType.RANGE_DOUBLE_INDEX.string(); - - public RangeDoubleIndex(String store) { - super(store, TABLE); - } - } - - public static class ShardIndex extends Index { - - public static final String TABLE = HugeType.SHARD_INDEX.string(); - - public ShardIndex(String store) { - super(joinTableName(store, TABLE)); - - this.define = new TableDefine(); - this.define.column(HugeKeys.INDEX_LABEL_ID, INT, NOT_NULL); - this.define.column(HugeKeys.FIELD_VALUES, VARCHAR, NOT_NULL); - this.define.column(HugeKeys.ELEMENT_IDS, VARCHAR, NOT_NULL); - // Unique keys/hash keys - this.define.keys(HugeKeys.INDEX_LABEL_ID, - HugeKeys.FIELD_VALUES, - HugeKeys.ELEMENT_IDS); - } - - @Override - protected final String entryId(MysqlBackendEntry entry) { - Double fieldValue = entry.column(HugeKeys.FIELD_VALUES); - Integer labelId = entry.column(HugeKeys.INDEX_LABEL_ID); - return SplicingIdGenerator.concat(labelId.toString(), - fieldValue.toString()); - } - } -} diff --git a/hugegraph-server/hugegraph-postgresql/pom.xml b/hugegraph-server/hugegraph-postgresql/pom.xml deleted file mode 100644 index f907f0e3fd..0000000000 --- a/hugegraph-server/hugegraph-postgresql/pom.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - - hugegraph-server - org.apache.hugegraph - ${revision} - ../pom.xml - - 4.0.0 - - hugegraph-postgresql - - - - org.apache.hugegraph - hugegraph-core - ${revision} - - - org.apache.hugegraph - hugegraph-mysql - ${revision} - - - org.postgresql - postgresql - 42.4.3 - - - diff --git a/hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlOptions.java b/hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlOptions.java deleted file mode 100644 index 86ebccefe1..0000000000 --- a/hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlOptions.java +++ /dev/null @@ -1,49 +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.hugegraph.backend.store.postgresql; - -import static org.apache.hugegraph.config.OptionChecker.disallowEmpty; - -import org.apache.hugegraph.backend.store.mysql.MysqlOptions; -import org.apache.hugegraph.config.ConfigOption; - -public class PostgresqlOptions extends MysqlOptions { - - private PostgresqlOptions() { - super(); - } - - private static volatile PostgresqlOptions instance; - - public static synchronized PostgresqlOptions instance() { - if (instance == null) { - instance = new PostgresqlOptions(); - instance.registerOptions(); - } - return instance; - } - - public static final ConfigOption POSTGRESQL_CONNECT_DATABASE = - new ConfigOption<>( - "jdbc.postgresql.connect_database", - "The database used to connect when init store, " + - "drop store or check store exist.", - disallowEmpty(), - "template1" - ); -} diff --git a/hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlSerializer.java b/hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlSerializer.java deleted file mode 100644 index 918c32caa6..0000000000 --- a/hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlSerializer.java +++ /dev/null @@ -1,58 +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.hugegraph.backend.store.postgresql; - -import org.apache.hugegraph.backend.id.IdUtil; -import org.apache.hugegraph.backend.serializer.TableBackendEntry; -import org.apache.hugegraph.backend.store.BackendEntry; -import org.apache.hugegraph.backend.store.mysql.MysqlSerializer; -import org.apache.hugegraph.config.HugeConfig; -import org.apache.hugegraph.structure.HugeIndex; -import org.apache.hugegraph.type.define.HugeKeys; -import org.apache.logging.log4j.util.Strings; - -public class PostgresqlSerializer extends MysqlSerializer { - - public PostgresqlSerializer(HugeConfig config) { - super(config); - } - - @Override - public BackendEntry writeIndex(HugeIndex index) { - TableBackendEntry entry = newBackendEntry(index); - /* - * When field-values is null and elementIds size is 0, it is - * meaningful for deletion of index data in secondary/range index. - */ - if (index.fieldValues() == null && index.elementIds().isEmpty()) { - entry.column(HugeKeys.INDEX_LABEL_ID, index.indexLabel().longId()); - } else { - Object value = index.fieldValues(); - if ("\u0000".equals(value)) { - value = Strings.EMPTY; - } - entry.column(HugeKeys.FIELD_VALUES, value); - entry.column(HugeKeys.INDEX_LABEL_ID, index.indexLabel().longId()); - entry.column(HugeKeys.ELEMENT_IDS, - IdUtil.writeStoredString(index.elementId())); - entry.column(HugeKeys.EXPIRED_TIME, index.expiredTime()); - entry.subId(index.elementId()); - } - return entry; - } -} diff --git a/hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlSessions.java b/hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlSessions.java deleted file mode 100644 index cccbb69453..0000000000 --- a/hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlSessions.java +++ /dev/null @@ -1,135 +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.hugegraph.backend.store.postgresql; - -import java.net.URISyntaxException; -import java.sql.Connection; -import java.sql.ResultSet; -import java.sql.SQLException; - -import org.apache.http.client.utils.URIBuilder; -import org.apache.hugegraph.backend.BackendException; -import org.apache.hugegraph.backend.store.mysql.MysqlSessions; -import org.apache.hugegraph.backend.store.mysql.MysqlUtil; -import org.apache.hugegraph.config.HugeConfig; -import org.apache.hugegraph.util.Log; -import org.postgresql.core.Utils; -import org.postgresql.util.PSQLException; -import org.slf4j.Logger; - -public class PostgresqlSessions extends MysqlSessions { - - private static final Logger LOG = Log.logger(PostgresqlSessions.class); - - private static final String COCKROACH_DB_CREATE = - "CREATE DATABASE %s ENCODING='UTF-8'"; - private static final String POSTGRESQL_DB_CREATE = COCKROACH_DB_CREATE + - " TEMPLATE=template0 LC_COLLATE='C' " + - "LC_CTYPE='C';"; - - public PostgresqlSessions(HugeConfig config, String database, String store) { - super(config, database, store); - } - - @Override - public boolean existsDatabase() { - String statement = String.format( - "SELECT datname FROM pg_catalog.pg_database " + - "WHERE datname = '%s';", this.escapedDatabase()); - try (Connection conn = this.openWithoutDB(0)) { - ResultSet result = conn.createStatement().executeQuery(statement); - return result.next(); - } catch (Exception e) { - throw new BackendException("Failed to obtain database info", e); - } - } - - @Override - public void createDatabase() { - // Create database with non-database-session - LOG.debug("Create database: {}", this.database()); - - String sql = this.buildCreateDatabase(this.database()); - try (Connection conn = this.openWithoutDB(0)) { - try { - conn.createStatement().execute(sql); - } catch (PSQLException e) { - // CockroachDB not support 'template' arg of CREATE DATABASE - if (e.getMessage().contains("syntax error at or near " + - "\"template\"")) { - sql = String.format(COCKROACH_DB_CREATE, this.database()); - conn.createStatement().execute(sql); - } - } - } catch (SQLException e) { - if (!e.getMessage().endsWith("already exists")) { - throw new BackendException("Failed to create database '%s'", e, - this.database()); - } - // Ignore exception if database already exists - } - } - - @Override - protected String buildCreateDatabase(String database) { - return String.format(POSTGRESQL_DB_CREATE, database); - } - - @Override - protected String buildDropDatabase(String database) { - return String.format( - "REVOKE CONNECT ON DATABASE %s FROM public;" + - "SELECT pg_terminate_backend(pg_stat_activity.pid) " + - " FROM pg_stat_activity " + - " WHERE pg_stat_activity.datname = %s;" + - "DROP DATABASE IF EXISTS %s;", - database, escapeAndWrapString(database), database); - } - - @Override - protected String buildExistsTable(String table) { - return String.format( - "SELECT * FROM information_schema.tables " + - "WHERE table_schema = 'public' AND table_name = '%s' LIMIT 1;", - MysqlUtil.escapeString(table)); - } - - @Override - protected URIBuilder newConnectionURIBuilder(String url) - throws URISyntaxException { - // Suppress error log when database does not exist - return new URIBuilder(url).addParameter("loggerLevel", "OFF"); - } - - @Override - protected String connectDatabase() { - return this.config().get(PostgresqlOptions.POSTGRESQL_CONNECT_DATABASE); - } - - public static String escapeAndWrapString(String value) { - StringBuilder builder = new StringBuilder(8 + value.length()); - builder.append('\''); - try { - Utils.escapeLiteral(builder, value, false); - } catch (SQLException e) { - throw new BackendException("Failed to escape '%s'", e, value); - } - builder.append('\''); - return builder.toString(); - } -} diff --git a/hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlStore.java b/hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlStore.java deleted file mode 100644 index 797dbbe29f..0000000000 --- a/hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlStore.java +++ /dev/null @@ -1,35 +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.hugegraph.backend.store.postgresql; - -import org.apache.hugegraph.backend.store.BackendStoreProvider; -import org.apache.hugegraph.backend.store.mysql.MysqlStore; -import org.apache.hugegraph.config.HugeConfig; - -public abstract class PostgresqlStore extends MysqlStore { - - public PostgresqlStore(BackendStoreProvider provider, - String database, String name) { - super(provider, database, name); - } - - @Override - protected PostgresqlSessions openSessionPool(HugeConfig config) { - return new PostgresqlSessions(config, this.database(), this.store()); - } -} diff --git a/hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlStoreProvider.java b/hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlStoreProvider.java deleted file mode 100644 index 65ed8e0fac..0000000000 --- a/hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlStoreProvider.java +++ /dev/null @@ -1,221 +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.hugegraph.backend.store.postgresql; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import org.apache.hugegraph.backend.id.Id; -import org.apache.hugegraph.backend.store.BackendStore; -import org.apache.hugegraph.backend.store.BackendStoreProvider; -import org.apache.hugegraph.backend.store.mysql.MysqlSessions; -import org.apache.hugegraph.backend.store.mysql.MysqlStoreProvider; -import org.apache.hugegraph.backend.store.mysql.MysqlTable; -import org.apache.hugegraph.config.HugeConfig; -import org.apache.hugegraph.type.HugeType; -import org.apache.hugegraph.type.define.Directions; -import org.apache.hugegraph.util.Log; -import org.slf4j.Logger; - -public class PostgresqlStoreProvider extends MysqlStoreProvider { - - private static final Logger LOG = Log.logger(PostgresqlStoreProvider.class); - - @Override - protected BackendStore newSchemaStore(HugeConfig config, String store) { - return new PostgresqlSchemaStore(this, this.database(), store); - } - - @Override - protected BackendStore newGraphStore(HugeConfig config, String store) { - return new PostgresqlGraphStore(this, this.database(), store); - } - - @Override - protected BackendStore newSystemStore(HugeConfig config, String store) { - return new PostgresqlSystemStore(this, this.database(), store); - } - - @Override - public String type() { - return "postgresql"; - } - - @Override - public String driverVersion() { - /* - * Versions history: - * [1.0] #441: supports PostgreSQL and Cockroach backend - * [1.1] #270 & #398: support shard-index and vertex + sortkey prefix, - * also split range table to rangeInt, rangeFloat, - * rangeLong and rangeDouble - * [1.2] #633: support unique index - * [1.3] #661: reduce the storage of vertex/edge id - * [1.4] #691: support aggregate property - * [1.5] #746: support userdata for indexlabel - * [1.6] #894: asStoredString() encoding is changed to signed B64 - * instead of sortable B64 - * [1.7] #295: support ttl for vertex and edge - * [1.8] #1333: support read frequency for property key - * [1.9] #1506: rename read frequency to write type - * [1.9] #1533: add meta table in system store - */ - return "1.9"; - } - - public static class PostgresqlSchemaStore extends PostgresqlStore { - - private final PostgresqlTables.Counters counters; - - public PostgresqlSchemaStore(BackendStoreProvider provider, - String database, String store) { - super(provider, database, store); - - this.counters = new PostgresqlTables.Counters(); - - registerTableManager(HugeType.VERTEX_LABEL, - new PostgresqlTables.VertexLabel()); - registerTableManager(HugeType.EDGE_LABEL, - new PostgresqlTables.EdgeLabel()); - registerTableManager(HugeType.PROPERTY_KEY, - new PostgresqlTables.PropertyKey()); - registerTableManager(HugeType.INDEX_LABEL, - new PostgresqlTables.IndexLabel()); - } - - @Override - protected Collection tables() { - List tables = new ArrayList<>(super.tables()); - tables.add(this.counters); - return tables; - } - - @Override - public void increaseCounter(HugeType type, long increment) { - this.checkOpened(); - MysqlSessions.Session session = this.session(type); - this.counters.increaseCounter(session, type, increment); - } - - @Override - public long getCounter(HugeType type) { - this.checkOpened(); - MysqlSessions.Session session = this.session(type); - return this.counters.getCounter(session, type); - } - - @Override - public boolean isSchemaStore() { - return true; - } - } - - public static class PostgresqlGraphStore extends PostgresqlStore { - - public PostgresqlGraphStore(BackendStoreProvider provider, - String database, String store) { - super(provider, database, store); - - registerTableManager(HugeType.VERTEX, - new PostgresqlTables.Vertex(store)); - registerTableManager(HugeType.EDGE_OUT, - new PostgresqlTables.Edge(store, - Directions.OUT)); - registerTableManager(HugeType.EDGE_IN, - new PostgresqlTables.Edge(store, - Directions.IN)); - registerTableManager(HugeType.SECONDARY_INDEX, - new PostgresqlTables.SecondaryIndex(store)); - registerTableManager(HugeType.RANGE_INT_INDEX, - new PostgresqlTables.RangeIntIndex(store)); - registerTableManager(HugeType.RANGE_FLOAT_INDEX, - new PostgresqlTables.RangeFloatIndex(store)); - registerTableManager(HugeType.RANGE_LONG_INDEX, - new PostgresqlTables.RangeLongIndex(store)); - registerTableManager(HugeType.RANGE_DOUBLE_INDEX, - new PostgresqlTables.RangeDoubleIndex(store)); - registerTableManager(HugeType.SEARCH_INDEX, - new PostgresqlTables.SearchIndex(store)); - registerTableManager(HugeType.SHARD_INDEX, - new PostgresqlTables.ShardIndex(store)); - registerTableManager(HugeType.UNIQUE_INDEX, - new PostgresqlTables.UniqueIndex(store)); - } - - @Override - public boolean isSchemaStore() { - return false; - } - - @Override - public Id nextId(HugeType type) { - throw new UnsupportedOperationException( - "PostgresqlGraphStore.nextId()"); - } - - @Override - public void increaseCounter(HugeType type, long increment) { - throw new UnsupportedOperationException( - "PostgresqlGraphStore.increaseCounter()"); - } - - @Override - public long getCounter(HugeType type) { - throw new UnsupportedOperationException( - "PostgresqlGraphStore.getCounter()"); - } - } - - public static class PostgresqlSystemStore extends PostgresqlGraphStore { - - private final PostgresqlTables.Meta meta; - - public PostgresqlSystemStore(BackendStoreProvider provider, - String database, String store) { - super(provider, database, store); - - this.meta = new PostgresqlTables.Meta(); - } - - @Override - public void init() { - super.init(); - this.checkOpened(); - MysqlSessions.Session session = this.session(HugeType.META); - String driverVersion = this.provider().driverVersion(); - this.meta.writeVersion(session, driverVersion); - LOG.info("Write down the backend version: {}", driverVersion); - } - - @Override - public String storedVersion() { - super.init(); - this.checkOpened(); - MysqlSessions.Session session = this.session(HugeType.META); - return this.meta.readVersion(session); - } - - @Override - protected Collection tables() { - List tables = new ArrayList<>(super.tables()); - tables.add(this.meta); - return tables; - } - } -} diff --git a/hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlTable.java b/hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlTable.java deleted file mode 100644 index 555615fe79..0000000000 --- a/hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlTable.java +++ /dev/null @@ -1,170 +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.hugegraph.backend.store.postgresql; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.hugegraph.backend.serializer.TableBackendEntry.Row; -import org.apache.hugegraph.backend.store.mysql.MysqlBackendEntry; -import org.apache.hugegraph.backend.store.mysql.MysqlSessions.Session; -import org.apache.hugegraph.backend.store.mysql.MysqlTable; -import org.apache.hugegraph.backend.store.mysql.WhereBuilder; -import org.apache.hugegraph.type.define.HugeKeys; -import org.apache.logging.log4j.util.Strings; - -public abstract class PostgresqlTable extends MysqlTable { - - private String orderByKeysTemplate = null; - - public PostgresqlTable(String table) { - super(table); - } - - @Override - protected String buildDropTemplate() { - return String.format("DROP TABLE IF EXISTS %s CASCADE;", this.table()); - } - - @Override - protected String buildTruncateTemplate() { - return String.format("TRUNCATE TABLE %s CASCADE;", this.table()); - } - - @Override - protected String engine(Session session) { - return Strings.EMPTY; - } - - @Override - protected String buildUpdateForcedTemplate(MysqlBackendEntry.Row entry) { - return this.buildInsertKeys(entry, false); - } - - @Override - protected List buildUpdateForcedParams(MysqlBackendEntry.Row entry) { - List params = new ArrayList<>(); - List allColumns = this.buildColumnsParams(entry); - params.addAll(allColumns); - params.addAll(allColumns); - return params; - } - - @Override - protected String buildUpdateIfAbsentTemplate(Row entry) { - return this.buildInsertKeys(entry, true); - } - - @Override - protected List buildUpdateIfAbsentParams(MysqlBackendEntry.Row entry) { - return this.buildColumnsParams(entry); - } - - protected String buildInsertKeys(MysqlBackendEntry.Row entry, - boolean ignoreConflicts) { - StringBuilder insert = new StringBuilder(); - insert.append("INSERT INTO ").append(this.table()).append(" ("); - - int i = 0; - int size = entry.columns().size(); - for (HugeKeys key : entry.columns().keySet()) { - insert.append(formatKey(key)); - if (++i != size) { - insert.append(", "); - } - } - insert.append(") VALUES ("); - - for (i = 0; i < size; i++) { - insert.append("?"); - if (i != size - 1) { - insert.append(", "); - } - } - insert.append(")"); - - i = 0; - size = this.tableDefine().keys().size(); - insert.append(" ON CONFLICT ("); - for (HugeKeys key : this.tableDefine().keys()) { - insert.append(formatKey(key)); - if (++i != size) { - insert.append(", "); - } - } - insert.append(")"); - - if (ignoreConflicts) { - insert.append(" DO NOTHING"); - } else { - i = 0; - size = entry.columns().keySet().size(); - insert.append(" DO UPDATE SET "); - for (HugeKeys key : entry.columns().keySet()) { - insert.append(formatKey(key)).append(" = ?"); - if (++i != size) { - insert.append(", "); - } - } - } - - return insert.toString(); - } - - @Override - protected String orderByKeys() { - // Set order-by to keep results order consistence for PostgreSQL result - if (this.orderByKeysTemplate != null) { - return this.orderByKeysTemplate; - } - int i = 0; - int size = this.tableDefine().keys().size(); - StringBuilder select = new StringBuilder(" ORDER BY "); - for (HugeKeys hugeKey : this.tableDefine().keys()) { - String key = formatKey(hugeKey); - select.append(key).append(" "); - select.append("ASC "); - if (++i != size) { - select.append(", "); - } - } - this.orderByKeysTemplate = select.toString(); - return this.orderByKeysTemplate; - } - - @Override - protected WhereBuilder newWhereBuilder(boolean startWithWhere) { - return new PgWhereBuilder(startWithWhere); - } - - private static class PgWhereBuilder extends WhereBuilder { - - public PgWhereBuilder(boolean startWithWhere) { - super(startWithWhere); - } - - @Override - protected String escapeAndWrapString(String value) { - if (value.equals("\u0000")) { - /* PR-2439 return string of '' */ - return "''"; - } - return PostgresqlSessions.escapeAndWrapString(value); - } - } -} diff --git a/hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlTables.java b/hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlTables.java deleted file mode 100644 index d57ad3c2db..0000000000 --- a/hugegraph-server/hugegraph-postgresql/src/main/java/org/apache/hugegraph/backend/store/postgresql/PostgresqlTables.java +++ /dev/null @@ -1,291 +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.hugegraph.backend.store.postgresql; - -import static org.apache.hugegraph.backend.store.mysql.MysqlTables.BOOLEAN; -import static org.apache.hugegraph.backend.store.mysql.MysqlTables.HUGE_TEXT; -import static org.apache.hugegraph.backend.store.mysql.MysqlTables.INT; -import static org.apache.hugegraph.backend.store.mysql.MysqlTables.LARGE_TEXT; -import static org.apache.hugegraph.backend.store.mysql.MysqlTables.MID_TEXT; -import static org.apache.hugegraph.backend.store.mysql.MysqlTables.NUMERIC; -import static org.apache.hugegraph.backend.store.mysql.MysqlTables.SMALL_TEXT; -import static org.apache.hugegraph.backend.store.mysql.MysqlTables.TINYINT; - -import java.sql.SQLException; -import java.util.List; -import java.util.Map; - -import org.apache.hugegraph.backend.BackendException; -import org.apache.hugegraph.backend.id.Id; -import org.apache.hugegraph.backend.store.BackendEntry; -import org.apache.hugegraph.backend.store.TableDefine; -import org.apache.hugegraph.backend.store.mysql.MysqlBackendEntry; -import org.apache.hugegraph.backend.store.mysql.MysqlSessions.Session; -import org.apache.hugegraph.backend.store.mysql.MysqlTables; -import org.apache.hugegraph.backend.store.mysql.MysqlTables.MysqlTableTemplate; -import org.apache.hugegraph.type.HugeType; -import org.apache.hugegraph.type.define.Directions; -import org.apache.hugegraph.type.define.HugeKeys; - -import com.google.common.collect.ImmutableMap; - -public class PostgresqlTables { - - private static final Map TYPES_MAPPING = - ImmutableMap.builder() - .put(BOOLEAN, "BOOL") - .put(TINYINT, "INT") - .put(INT, "INT") - .put(NUMERIC, "DECIMAL") - .put(SMALL_TEXT, "VARCHAR(255)") - .put(MID_TEXT, "VARCHAR(1024)") - .put(LARGE_TEXT, "VARCHAR(65533)") - .put(HUGE_TEXT, "TEXT") - .build(); - - public static class PostgresqlTableTemplate extends PostgresqlTable { - - protected MysqlTableTemplate template; - - public PostgresqlTableTemplate(MysqlTableTemplate template) { - super(template.table()); - this.template = template; - } - - @Override - public TableDefine tableDefine() { - return this.template.tableDefine(); - } - } - - public static class Meta extends PostgresqlTableTemplate { - - public Meta() { - super(new MysqlTables.Meta(TYPES_MAPPING)); - } - - public void writeVersion(Session session, String version) { - String versionColumn = formatKey(HugeKeys.VERSION); - String insert = String.format("INSERT INTO %s VALUES ('%s', '%s') " + - "ON CONFLICT(name) DO NOTHING;", - this.table(), versionColumn, version); - try { - session.execute(insert); - } catch (SQLException e) { - throw new BackendException("Failed to insert driver version " + - "with '%s'", e, insert); - } - } - - public String readVersion(Session session) { - MysqlTables.Meta table = (MysqlTables.Meta) this.template; - return table.readVersion(session); - } - } - - public static class Counters extends PostgresqlTableTemplate { - - public Counters() { - super(new MysqlTables.Counters(TYPES_MAPPING)); - } - - public long getCounter(Session session, HugeType type) { - MysqlTables.Counters table = (MysqlTables.Counters) this.template; - return table.getCounter(session, type); - } - - public void increaseCounter(Session session, HugeType type, - long increment) { - String update = String.format( - "INSERT INTO %s (%s, %s) VALUES ('%s', %s) " + - "ON CONFLICT (%s) DO UPDATE SET ID = %s.ID + %s;", - this.table(), formatKey(HugeKeys.SCHEMA_TYPE), - formatKey(HugeKeys.ID), type.name(), increment, - formatKey(HugeKeys.SCHEMA_TYPE), - this.table(), increment); - try { - session.execute(update); - } catch (SQLException e) { - throw new BackendException( - "Failed to update counters with type '%s'", e, type); - } - } - } - - public static class VertexLabel extends PostgresqlTableTemplate { - - public VertexLabel() { - super(new MysqlTables.VertexLabel(TYPES_MAPPING)); - } - } - - public static class EdgeLabel extends PostgresqlTableTemplate { - - public EdgeLabel() { - super(new MysqlTables.EdgeLabel(TYPES_MAPPING)); - } - } - - public static class PropertyKey extends PostgresqlTableTemplate { - - public PropertyKey() { - super(new MysqlTables.PropertyKey(TYPES_MAPPING)); - } - } - - public static class IndexLabel extends PostgresqlTableTemplate { - - public IndexLabel() { - super(new MysqlTables.IndexLabel(TYPES_MAPPING)); - } - } - - public static class Vertex extends PostgresqlTableTemplate { - - public static final String TABLE = HugeType.VERTEX.string(); - - public Vertex(String store) { - super(new MysqlTables.Vertex(store, TYPES_MAPPING)); - } - } - - public static class Edge extends PostgresqlTableTemplate { - - public Edge(String store, Directions direction) { - super(new MysqlTables.Edge(store, direction, TYPES_MAPPING)); - } - - @Override - protected List idColumnValue(Id id) { - MysqlTables.Edge table = (MysqlTables.Edge) this.template; - return table.idColumnValue(id); - } - - @Override - public void delete(Session session, MysqlBackendEntry.Row entry) { - MysqlTables.Edge table = (MysqlTables.Edge) this.template; - table.delete(session, entry); - } - - @Override - protected BackendEntry mergeEntries(BackendEntry e1, BackendEntry e2) { - MysqlTables.Edge table = (MysqlTables.Edge) this.template; - return table.mergeEntries(e1, e2); - } - } - - public static class SecondaryIndex extends PostgresqlTableTemplate { - - public static final String TABLE = MysqlTables.SecondaryIndex.TABLE; - - public SecondaryIndex(String store) { - super(new MysqlTables.SecondaryIndex(store, TABLE, TYPES_MAPPING)); - } - - public SecondaryIndex(String store, String table) { - super(new MysqlTables.SecondaryIndex(store, table, TYPES_MAPPING)); - } - - protected final String entryId(MysqlBackendEntry entry) { - return ((MysqlTables.SecondaryIndex) this.template).entryId(entry); - } - } - - public static class SearchIndex extends SecondaryIndex { - - public static final String TABLE = MysqlTables.SearchIndex.TABLE; - - public SearchIndex(String store) { - super(store, TABLE); - } - } - - public static class UniqueIndex extends SecondaryIndex { - - public static final String TABLE = MysqlTables.UniqueIndex.TABLE; - - public UniqueIndex(String store) { - super(store, TABLE); - } - } - - public static class RangeIntIndex extends PostgresqlTableTemplate { - - public static final String TABLE = HugeType.RANGE_INT_INDEX.string(); - - public RangeIntIndex(String store) { - super(new MysqlTables.RangeIntIndex(store, TABLE, TYPES_MAPPING)); - } - - protected final String entryId(MysqlBackendEntry entry) { - return ((MysqlTables.RangeIntIndex) this.template).entryId(entry); - } - } - - public static class RangeFloatIndex extends PostgresqlTableTemplate { - - public static final String TABLE = HugeType.RANGE_FLOAT_INDEX.string(); - - public RangeFloatIndex(String store) { - super(new MysqlTables.RangeFloatIndex(store, TABLE, TYPES_MAPPING)); - } - - protected final String entryId(MysqlBackendEntry entry) { - return ((MysqlTables.RangeFloatIndex) this.template).entryId(entry); - } - } - - public static class RangeLongIndex extends PostgresqlTableTemplate { - - public static final String TABLE = HugeType.RANGE_LONG_INDEX.string(); - - public RangeLongIndex(String store) { - super(new MysqlTables.RangeLongIndex(store, TABLE, TYPES_MAPPING)); - } - - protected final String entryId(MysqlBackendEntry entry) { - return ((MysqlTables.RangeLongIndex) this.template).entryId(entry); - } - } - - public static class RangeDoubleIndex extends PostgresqlTableTemplate { - - public static final String TABLE = HugeType.RANGE_DOUBLE_INDEX.string(); - - public RangeDoubleIndex(String store) { - super(new MysqlTables.RangeDoubleIndex(store, TABLE, - TYPES_MAPPING)); - } - - protected final String entryId(MysqlBackendEntry entry) { - return ((MysqlTables.RangeDoubleIndex) this.template) - .entryId(entry); - } - } - - public static class ShardIndex extends PostgresqlTableTemplate { - - public ShardIndex(String store) { - super(new MysqlTables.ShardIndex(store, TYPES_MAPPING)); - } - - protected final String entryId(MysqlBackendEntry entry) { - return ((MysqlTables.ShardIndex) this.template).entryId(entry); - } - } -} diff --git a/hugegraph-server/hugegraph-scylladb/pom.xml b/hugegraph-server/hugegraph-scylladb/pom.xml deleted file mode 100644 index 50573df23b..0000000000 --- a/hugegraph-server/hugegraph-scylladb/pom.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - hugegraph-server - org.apache.hugegraph - ${revision} - ../pom.xml - - 4.0.0 - - hugegraph-scylladb - - - - org.apache.hugegraph - hugegraph-cassandra - ${revision} - - - - diff --git a/hugegraph-server/hugegraph-scylladb/src/main/java/org/apache/hugegraph/backend/store/scylladb/ScyllaDBFeatures.java b/hugegraph-server/hugegraph-scylladb/src/main/java/org/apache/hugegraph/backend/store/scylladb/ScyllaDBFeatures.java deleted file mode 100644 index 2ff7fd0bc6..0000000000 --- a/hugegraph-server/hugegraph-scylladb/src/main/java/org/apache/hugegraph/backend/store/scylladb/ScyllaDBFeatures.java +++ /dev/null @@ -1,33 +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.hugegraph.backend.store.scylladb; - -import org.apache.hugegraph.backend.store.cassandra.CassandraFeatures; - -public class ScyllaDBFeatures extends CassandraFeatures { - - @Override - public boolean supportsQueryWithContains() { - return false; - } - - @Override - public boolean supportsQueryWithContainsKey() { - return false; - } -} diff --git a/hugegraph-server/hugegraph-scylladb/src/main/java/org/apache/hugegraph/backend/store/scylladb/ScyllaDBMetrics.java b/hugegraph-server/hugegraph-scylladb/src/main/java/org/apache/hugegraph/backend/store/scylladb/ScyllaDBMetrics.java deleted file mode 100644 index 77585c73aa..0000000000 --- a/hugegraph-server/hugegraph-scylladb/src/main/java/org/apache/hugegraph/backend/store/scylladb/ScyllaDBMetrics.java +++ /dev/null @@ -1,69 +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.hugegraph.backend.store.scylladb; - -import java.util.Map; - -import org.apache.cassandra.tools.NodeProbe; -import org.apache.hugegraph.backend.store.cassandra.CassandraMetrics; -import org.apache.hugegraph.backend.store.cassandra.CassandraSessionPool; -import org.apache.hugegraph.config.HugeConfig; - -public class ScyllaDBMetrics extends CassandraMetrics { - - public ScyllaDBMetrics(HugeConfig conf, - CassandraSessionPool sessions, - String keyspace) { - super(conf, sessions, keyspace); - } - - @Override - protected void appendExtraMetrics(Map metrics, - NodeProbe probe) { - // Table counter Metrics - appendCounterMetrics(metrics, probe, this.keyspace(), this.tables(), - "EstimatedPartitionCount"); - appendCounterMetrics(metrics, probe, this.keyspace(), this.tables(), - "DroppedMutations"); - appendCounterMetrics(metrics, probe, this.keyspace(), this.tables(), - "PendingFlushes"); - //appendCounterMetrics(metrics, probe, this.keyspace(), this.tables(), - // "KeyCacheHitRate"); - appendCounterMetrics(metrics, probe, this.keyspace(), this.tables(), - "BloomFilterFalseRatio"); - - // Table timer Metrics - //appendTimerMetrics(metrics, probe, this.keyspace(), "WriteLatency"); - //appendTimerMetrics(metrics, probe, this.keyspace(), "ReadLatency"); - //appendTimerMetrics(metrics, probe, null, "WriteLatency"); - //appendTimerMetrics(metrics, probe, null, "ReadLatency"); - - // Cache Metrics - appendCacheMetrics(metrics, probe, "KeyCache", "Size"); - appendCacheMetrics(metrics, probe, "KeyCache", "Entries"); - appendCacheMetrics(metrics, probe, "RowCache", "Size"); - appendCacheMetrics(metrics, probe, "RowCache", "Entries"); - appendCacheMetrics(metrics, probe, "CounterCache", "Size"); - appendCacheMetrics(metrics, probe, "CounterCache", "Entries"); - - // Compaction Metrics - appendCompactionMetrics(metrics, probe, "CompletedTasks"); - appendCompactionMetrics(metrics, probe, "PendingTasks"); - //appendCompactionMetrics(metrics, probe, "BytesCompacted"); - } -} diff --git a/hugegraph-server/hugegraph-scylladb/src/main/java/org/apache/hugegraph/backend/store/scylladb/ScyllaDBStoreProvider.java b/hugegraph-server/hugegraph-scylladb/src/main/java/org/apache/hugegraph/backend/store/scylladb/ScyllaDBStoreProvider.java deleted file mode 100644 index 015afb8319..0000000000 --- a/hugegraph-server/hugegraph-scylladb/src/main/java/org/apache/hugegraph/backend/store/scylladb/ScyllaDBStoreProvider.java +++ /dev/null @@ -1,173 +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.hugegraph.backend.store.scylladb; - -import org.apache.hugegraph.backend.store.BackendFeatures; -import org.apache.hugegraph.backend.store.BackendStore; -import org.apache.hugegraph.backend.store.BackendStoreProvider; -import org.apache.hugegraph.backend.store.cassandra.CassandraMetrics; -import org.apache.hugegraph.backend.store.cassandra.CassandraSessionPool; -import org.apache.hugegraph.backend.store.cassandra.CassandraStore; -import org.apache.hugegraph.backend.store.cassandra.CassandraStoreProvider; -import org.apache.hugegraph.config.HugeConfig; -import org.apache.hugegraph.type.HugeType; -import org.apache.hugegraph.util.E; -import org.apache.hugegraph.util.Log; -import org.slf4j.Logger; - -public class ScyllaDBStoreProvider extends CassandraStoreProvider { - - private static final Logger LOG = Log.logger(CassandraStore.class); - - private static final BackendFeatures FEATURES = new ScyllaDBFeatures(); - - @Override - public String type() { - return "scylladb"; - } - - @Override - public BackendStore loadSchemaStore(HugeConfig config) { - String name = SCHEMA_STORE; - LOG.debug("ScyllaDBStoreProvider load SchemaStore '{}'", name); - - if (!this.stores.containsKey(name)) { - BackendStore s = new ScyllaDBSchemaStore(this, keyspace(), name); - this.stores.putIfAbsent(name, s); - } - - BackendStore store = this.stores.get(name); - E.checkNotNull(store, "store"); - E.checkState(store instanceof ScyllaDBSchemaStore, - "SchemaStore must be an instance of ScyllaDBSchemaStore"); - return store; - } - - @Override - public BackendStore loadGraphStore(HugeConfig config) { - String name = GRAPH_STORE; - LOG.debug("ScyllaDBStoreProvider load GraphStore '{}'", name); - - if (!this.stores.containsKey(name)) { - BackendStore s = new ScyllaDBGraphStore(this, keyspace(), name); - this.stores.putIfAbsent(name, s); - } - - BackendStore store = this.stores.get(name); - E.checkNotNull(store, "store"); - E.checkState(store instanceof ScyllaDBGraphStore, - "GraphStore must be an instance of ScyllaDBGraphStore"); - return store; - } - - @Override - public BackendStore loadSystemStore(HugeConfig config) { - String name = SYSTEM_STORE; - LOG.debug("ScyllaDBStoreProvider load SystemStore '{}'", name); - - if (!this.stores.containsKey(name)) { - BackendStore s = new ScyllaDBSystemStore(this, keyspace(), name); - this.stores.putIfAbsent(name, s); - } - - BackendStore store = this.stores.get(name); - E.checkNotNull(store, "store"); - E.checkState(store instanceof ScyllaDBSystemStore, - "SystemStore must be an instance of ScyllaDBSystemStore"); - return store; - } - - public static class ScyllaDBSchemaStore - extends CassandraStore.CassandraSchemaStore { - - public ScyllaDBSchemaStore(BackendStoreProvider provider, - String keyspace, String store) { - super(provider, keyspace, store); - - registerTableManager(HugeType.VERTEX_LABEL, - new ScyllaDBTablesWithMV.VertexLabel()); - registerTableManager(HugeType.EDGE_LABEL, - new ScyllaDBTablesWithMV.EdgeLabel()); - registerTableManager(HugeType.PROPERTY_KEY, - new ScyllaDBTablesWithMV.PropertyKey()); - registerTableManager(HugeType.INDEX_LABEL, - new ScyllaDBTablesWithMV.IndexLabel()); - } - - @Override - public BackendFeatures features() { - return FEATURES; - } - - @Override - protected CassandraMetrics createMetrics(HugeConfig conf, - CassandraSessionPool sessions, - String keyspace) { - return new ScyllaDBMetrics(conf, sessions, keyspace); - } - } - - public static class ScyllaDBGraphStore - extends CassandraStore.CassandraGraphStore { - - public ScyllaDBGraphStore(BackendStoreProvider provider, - String keyspace, String store) { - super(provider, keyspace, store); - - registerTableManager(HugeType.VERTEX, - new ScyllaDBTablesWithMV.Vertex(store)); - registerTableManager(HugeType.EDGE_OUT, - ScyllaDBTablesWithMV.Edge.out(store)); - registerTableManager(HugeType.EDGE_IN, - ScyllaDBTablesWithMV.Edge.in(store)); - } - - @Override - public BackendFeatures features() { - return FEATURES; - } - - @Override - protected CassandraMetrics createMetrics(HugeConfig conf, - CassandraSessionPool sessions, - String keyspace) { - return new ScyllaDBMetrics(conf, sessions, keyspace); - } - } - - public static class ScyllaDBSystemStore - extends CassandraStore.CassandraSystemStore { - - public ScyllaDBSystemStore(BackendStoreProvider provider, - String keyspace, String store) { - super(provider, keyspace, store); - } - - @Override - public BackendFeatures features() { - return FEATURES; - } - - @Override - protected CassandraMetrics createMetrics(HugeConfig conf, - CassandraSessionPool sessions, - String keyspace) { - return new ScyllaDBMetrics(conf, sessions, keyspace); - } - } -} diff --git a/hugegraph-server/hugegraph-scylladb/src/main/java/org/apache/hugegraph/backend/store/scylladb/ScyllaDBTablesWithMV.java b/hugegraph-server/hugegraph-scylladb/src/main/java/org/apache/hugegraph/backend/store/scylladb/ScyllaDBTablesWithMV.java deleted file mode 100644 index 4d0500a231..0000000000 --- a/hugegraph-server/hugegraph-scylladb/src/main/java/org/apache/hugegraph/backend/store/scylladb/ScyllaDBTablesWithMV.java +++ /dev/null @@ -1,301 +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.hugegraph.backend.store.scylladb; - -import java.util.Collection; -import java.util.List; -import java.util.stream.Collectors; - -import org.apache.hugegraph.backend.query.Condition; -import org.apache.hugegraph.backend.query.ConditionQuery; -import org.apache.hugegraph.backend.query.Query; -import org.apache.hugegraph.backend.store.cassandra.CassandraSessionPool; -import org.apache.hugegraph.backend.store.cassandra.CassandraTable; -import org.apache.hugegraph.backend.store.cassandra.CassandraTables; -import org.apache.hugegraph.type.define.Directions; -import org.apache.hugegraph.type.define.HugeKeys; - -import com.datastax.driver.core.querybuilder.Select; - -public class ScyllaDBTablesWithMV { - - private static boolean isQueryBySpecifiedKey(Query query, HugeKeys key) { - Collection conditions = query.conditions(); - if (query instanceof ConditionQuery && !conditions.isEmpty()) { - ConditionQuery cq = (ConditionQuery) query; - Object value = cq.condition(key); - return value != null && cq.allSysprop() && - conditions.size() == 1 && - cq.containsRelation(key, Condition.RelationType.EQ); - } - return false; - } - - private static boolean isQueryByLabel(Query query) { - return isQueryBySpecifiedKey(query, HugeKeys.LABEL); - } - - private static boolean isQueryByName(Query query) { - return isQueryBySpecifiedKey(query, HugeKeys.NAME); - } - - private static String mvNameTable(String table) { - return "mv_name2" + table; - } - - private static String mvLabelTable(String table) { - return "mv_label2" + table; - } - - private static void createSchemaIndexTable( - CassandraSessionPool.Session session, - String mvName, String table) { - final String NAME = CassandraTable.formatKey(HugeKeys.NAME); - final String ID = CassandraTable.formatKey(HugeKeys.ID); - String cql = String.format( - "CREATE MATERIALIZED VIEW IF NOT EXISTS %s AS " + - " SELECT * FROM %s " + - " WHERE %s IS NOT NULL " + - " PRIMARY KEY(%s, %s)", - mvName, table, NAME, - NAME, ID); - session.execute(cql); - } - - private static void dropIndexTable(CassandraSessionPool.Session session, - String mvName) { - String cql = String.format("DROP MATERIALIZED VIEW IF EXISTS %s", - mvName); - session.execute(cql); - } - - public static class PropertyKey extends CassandraTables.PropertyKey { - - private final String mvName2Pk = mvNameTable(this.table()); - - @Override - protected void createIndex(CassandraSessionPool.Session session, - String indexLabel, - HugeKeys column) { - createSchemaIndexTable(session, mvName2Pk, this.table()); - } - - @Override - protected void dropTable(CassandraSessionPool.Session session) { - dropIndexTable(session, mvName2Pk); - super.dropTable(session); - } - - @Override - protected List query2Select(String table, Query query) { - if (isQueryByName(query)) { - // Query from materialized view - return super.query2Select(mvName2Vl, query); - } - return super.query2Select(table, query); - } - } - - public static class EdgeLabel extends CassandraTables.EdgeLabel { - - private final String mvName2El = mvNameTable(this.table()); - - @Override - protected void createIndex(CassandraSessionPool.Session session, - String indexLabel, - HugeKeys column) { - createSchemaIndexTable(session, mvName2El, this.table()); - } - - @Override - protected void dropTable(CassandraSessionPool.Session session) { - dropIndexTable(session, mvName2El); - super.dropTable(session); - } - - @Override - protected List query2Select(String table, Query query) { - if (isQueryByName(query)) { - // Query from materialized view - return super.query2Select(mvName2Il, query); - } - return super.query2Select(table, query); - } - } - - public static class Vertex extends CassandraTables.Vertex { - - private final String mvLabel2Vertex = mvLabelTable(this.table()); - - public Vertex(String store) { - super(store); - } - - @Override - protected void createIndex(CassandraSessionPool.Session session, - String indexLabel, - HugeKeys column) { - final String LABEL = CassandraTable.formatKey(HugeKeys.LABEL); - final String ID = CassandraTable.formatKey(HugeKeys.ID); - String cql = String.format( - "CREATE MATERIALIZED VIEW IF NOT EXISTS %s AS " + - " SELECT * FROM %s " + - " WHERE %s IS NOT NULL " + - " PRIMARY KEY(%s, %s)", - mvLabel2Vertex, this.table(), LABEL, LABEL, ID); - session.execute(cql); - } - - @Override - protected void dropTable(CassandraSessionPool.Session session) { - dropIndexTable(session, mvLabel2Vertex); - super.dropTable(session); - } - - /** - * Query data from label index table if just want to query by label - */ - @Override - protected List query2Select(String table, Query query) { - if (isQueryByLabel(query)) { - // Query from materialized view - return super.query2Select(mvLabel2Edge, query); - } - return super.query2Select(table, query); - } - - @Override - protected String labelIndexTable() { - return mvLabel2Edge; - } - - public static Edge out(String store) { - return new Edge(store, Directions.OUT); - } - - public static Edge in(String store) { - return new Edge(store, Directions.IN); - } - } -} diff --git a/hugegraph-server/hugegraph-test/pom.xml b/hugegraph-server/hugegraph-test/pom.xml index b3fc645f79..259d5a9b9a 100644 --- a/hugegraph-server/hugegraph-test/pom.xml +++ b/hugegraph-server/hugegraph-test/pom.xml @@ -45,16 +45,6 @@ hugegraph-api ${revision} - - org.apache.hugegraph - hugegraph-cassandra - ${revision} - - - org.apache.hugegraph - hugegraph-scylladb - ${revision} - org.apache.hugegraph hugegraph-rocksdb @@ -65,16 +55,6 @@ hugegraph-hbase ${revision} - - org.apache.hugegraph - hugegraph-mysql - ${revision} - - - org.apache.hugegraph - hugegraph-postgresql - ${revision} - org.apache.hugegraph hugegraph-dist @@ -97,13 +77,6 @@ jersey-test-framework-provider-grizzly2 - - mysql - mysql-connector-java - 8.0.28 - test - - com.janeluo ikanalyzer diff --git a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/MetricsApiTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/MetricsApiTest.java index 2a903af234..d0a1775a16 100644 --- a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/MetricsApiTest.java +++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/MetricsApiTest.java @@ -90,8 +90,6 @@ public void testMetricsBackend() { int nodes = (Integer) graph.get("nodes"); switch (backend) { case "memory": - case "mysql": - case "postgresql": Assert.assertEquals(1, nodes); break; case "rocksdb": @@ -116,128 +114,6 @@ public void testMetricsBackend() { assertMapContains(host, "estimate_num_keys"); break; - case "cassandra": - assertMapContains(graph, "cluster_id"); - assertMapContains(graph, "servers"); - - servers = (Map) graph.get("servers"); - Assert.assertGte(1, servers.size()); - // TODO: Uncomment after fixed #1843 - for (Map.Entry e : servers.entrySet()) { - String key = (String) e.getKey(); - value = e.getValue(); - Assert.assertTrue(String.format("Expect map value for key %s but got %s", - key, value), value instanceof Map); - host = (Map) value; - assertMapContains(host, "mem_max"); - assertMapContains(host, "mem_committed"); - assertMapContains(host, "mem_used"); - assertMapContains(host, "mem_used_readable"); - assertMapContains(host, "mem_unit"); - - assertMapContains(host, "disk_usage"); - assertMapContains(host, "disk_usage_readable"); - assertMapContains(host, "disk_usage_details"); - assertMapContains(host, "disk_unit"); - - assertMapContains(host, "uptime"); - assertMapContains(host, "uptime_readable"); - assertMapContains(host, "time_unit"); - - assertMapContains(host, "estimated_partition_count"); - assertMapContains(host, "dropped_mutations"); - assertMapContains(host, "pending_flushes"); - assertMapContains(host, "key_cache_hit_rate"); - assertMapContains(host, "bloom_filter_false_ratio"); - - assertMapContains(host, "write_latency_hugegraph"); - assertMapContains(host, "read_latency_hugegraph"); - assertMapContains(host, "write_latency_*"); - assertMapContains(host, "read_latency_*"); - - assertMapContains(host, "key_cache_size"); - assertMapContains(host, "key_cache_entries"); - assertMapContains(host, "row_cache_size"); - assertMapContains(host, "row_cache_entries"); - assertMapContains(host, "counter_cache_size"); - assertMapContains(host, "counter_cache_entries"); - - assertMapContains(host, "compaction_completed_tasks"); - assertMapContains(host, "compaction_pending_tasks"); - assertMapContains(host, "compaction_bytes_compacted"); - - assertMapContains(host, "live_nodes"); - assertMapContains(host, "joining_nodes"); - assertMapContains(host, "moving_nodes"); - assertMapContains(host, "leaving_nodes"); - assertMapContains(host, "unreachable_nodes"); - - assertMapContains(host, "keyspaces"); - assertMapContains(host, "num_tables"); - assertMapContains(host, "exception_count"); - } - break; - case "scylladb": - assertMapContains(graph, "cluster_id"); - assertMapContains(graph, "servers"); - - servers = (Map) graph.get("servers"); - Assert.assertGte(1, servers.size()); - - for (Map.Entry e : servers.entrySet()) { - String key = (String) e.getKey(); - value = e.getValue(); - Assert.assertTrue(String.format("Expect map value for key %s but got %s", - key, value), value instanceof Map); - host = (Map) value; - assertMapContains(host, "mem_max"); - assertMapContains(host, "mem_committed"); - assertMapContains(host, "mem_used"); - assertMapContains(host, "mem_used_readable"); - assertMapContains(host, "mem_unit"); - - assertMapContains(host, "disk_usage"); - assertMapContains(host, "disk_usage_readable"); - assertMapContains(host, "disk_usage_details"); - assertMapContains(host, "disk_unit"); - - assertMapContains(host, "uptime"); - assertMapContains(host, "uptime_readable"); - assertMapContains(host, "time_unit"); - - assertMapContains(host, "estimated_partition_count"); - assertMapContains(host, "dropped_mutations"); - assertMapContains(host, "pending_flushes"); - //assertMapContains(host, "key_cache_hit_rate"); - assertMapContains(host, "bloom_filter_false_ratio"); - - //assertMapContains(host, "write_latency_hugegraph"); - //assertMapContains(host, "read_latency_hugegraph"); - //assertMapContains(host, "write_latency_*"); - //assertMapContains(host, "read_latency_*"); - - assertMapContains(host, "key_cache_size"); - assertMapContains(host, "key_cache_entries"); - assertMapContains(host, "row_cache_size"); - assertMapContains(host, "row_cache_entries"); - assertMapContains(host, "counter_cache_size"); - assertMapContains(host, "counter_cache_entries"); - - assertMapContains(host, "compaction_completed_tasks"); - assertMapContains(host, "compaction_pending_tasks"); - //assertMapContains(host, "compaction_bytes_compacted"); - - assertMapContains(host, "live_nodes"); - assertMapContains(host, "joining_nodes"); - assertMapContains(host, "moving_nodes"); - assertMapContains(host, "leaving_nodes"); - assertMapContains(host, "unreachable_nodes"); - - assertMapContains(host, "keyspaces"); - assertMapContains(host, "num_tables"); - assertMapContains(host, "exception_count"); - } - break; case "hbase": assertMapContains(graph, "cluster_id"); assertMapContains(graph, "master_name"); diff --git a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/EdgeCoreTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/EdgeCoreTest.java index eadc277136..f74c5c1c5b 100644 --- a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/EdgeCoreTest.java +++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/EdgeCoreTest.java @@ -499,27 +499,7 @@ public void testAddEdgeWithInvalidSortkey() { }); String backend = graph.backend(); - if (backend.equals("postgresql")) { - Assert.assertThrows(BackendException.class, () -> { - james.addEdge("write", book, "time", "2017-5-27\u0000"); - graph.tx().commit(); - }, e -> { - // pgsql need to clear and reset state (like auto-commit) - graph.tx().rollback(); - Assert.assertContains("invalid byte sequence for encoding " + - "\"UTF8\": 0x00", - e.getCause().getMessage()); - }); - - Assert.assertThrows(BackendException.class, () -> { - graph.traversal().V(james.id()) - .outE("write").has("time", "2017-5-27\u0000") - .toList(); - }, e -> { - Assert.assertContains("Zero bytes may not occur in string " + - "parameters", e.getCause().getMessage()); - }); - } else if (ImmutableSet.of("rocksdb", "hbase", "hstore").contains(backend)) { + if (ImmutableSet.of("rocksdb", "hbase", "hstore").contains(backend)) { Assert.assertThrows(IllegalArgumentException.class, () -> { james.addEdge("write", book, "time", "2017-5-27\u0000"); graph.tx().commit(); @@ -2930,9 +2910,6 @@ public void testQueryEdgesByHasValue() { Assert.assertEquals(3, edges.get(0).value("score")); Assert.assertEquals(3, edges.get(1).value("score")); - // TODO: Seems Cassandra Bug if contains null value #862 - //edges = graph.traversal().E().hasValue(3).toList(); - //Assert.assertEquals(3, edges.size()); } @Test @@ -5265,14 +5242,9 @@ public void testScanEdgeInPaging() { ConditionQuery query = new ConditionQuery(HugeType.EDGE); String backend = graph.backend(); - if (backend.equals("cassandra") || backend.equals("scylladb")) { - query.scan(String.valueOf(Long.MIN_VALUE), - String.valueOf(Long.MAX_VALUE)); - } else { - // QUESTION: The query method may not be well adapted - query.scan(BackendTable.ShardSplitter.START, - BackendTable.ShardSplitter.END); - } + // QUESTION: The query method may not be well adapted + query.scan(BackendTable.ShardSplitter.START, + BackendTable.ShardSplitter.END); query.limit(1); String page = PageInfo.PAGE_NONE; @@ -5896,8 +5868,7 @@ public void testAddEdgePropertyWithSpecialValueForSecondaryIndex() { Assert.assertEquals(3, edges.get(0).value("id")); String backend = graph.backend(); - Set nonZeroBackends = ImmutableSet.of("postgresql", - "rocksdb", "hbase", "hstore"); + Set nonZeroBackends = ImmutableSet.of("rocksdb", "hbase", "hstore"); if (nonZeroBackends.contains(backend)) { Assert.assertThrows(Exception.class, () -> { louise.addEdge("strike", sean, "id", 4, diff --git a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/VertexCoreTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/VertexCoreTest.java index 4b7ec65bc3..6118deee2b 100644 --- a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/VertexCoreTest.java +++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/VertexCoreTest.java @@ -4203,8 +4203,7 @@ public void testQueryByDoubleProperty() { /* * The double precision type typically has a range of around 1E-307 to - * 1E+308 with a precision of at least 15 digits. (postgresql) - * https://www.postgresql.org/docs/9.5/datatype-numeric.html#DATATYPE-NUMERIC-TABLE + * 1E+308 with a precision of at least 15 digits. */ final double max15 = new BigDecimal(Double.MAX_VALUE) .movePointLeft(308) @@ -6339,8 +6338,7 @@ public void testAddVertexPropertyWithSpecialValueForSecondaryIndex() { Assert.assertEquals("3", vertices.get(0).value("name")); String backend = graph.backend(); - Set nonZeroBackends = ImmutableSet.of("postgresql", - "rocksdb", "hbase", "hstore"); + Set nonZeroBackends = ImmutableSet.of("rocksdb", "hbase", "hstore"); if (nonZeroBackends.contains(backend)) { Assert.assertThrows(Exception.class, () -> { graph.addVertex(T.label, "person", "name", "0", @@ -7754,13 +7752,8 @@ public void testScanVertexInPaging() { ConditionQuery query = new ConditionQuery(HugeType.VERTEX); String backend = graph.backend(); - if (backend.equals("cassandra") || backend.equals("scylladb")) { - query.scan(String.valueOf(Long.MIN_VALUE), - String.valueOf(Long.MAX_VALUE)); - } else { - query.scan(BackendTable.ShardSplitter.START, - BackendTable.ShardSplitter.END); - } + query.scan(BackendTable.ShardSplitter.START, + BackendTable.ShardSplitter.END); query.limit(1); String page = PageInfo.PAGE_NONE; @@ -9135,13 +9128,11 @@ public void testAddVertexWithSpecialSymbolInPrimaryValues() { Assert.assertEquals(vertex3, g.V().hasLabel("person") .has("name", "xyz\u0003abc").next()); - if (!graph.backend().equals("postgresql")) { - Vertex vertex0 = graph.addVertex(T.label, "person", "name", - "xyz\u0000abc", "city", "Hongkong", - "age", 10); - Assert.assertEquals(vertex0, g.V().hasLabel("person") - .has("name", "xyz\u0000abc").next()); - } + Vertex vertex0 = graph.addVertex(T.label, "person", "name", + "xyz\u0000abc", "city", "Hongkong", + "age", 10); + Assert.assertEquals(vertex0, g.V().hasLabel("person") + .has("name", "xyz\u0000abc").next()); Assert.assertThrows(IllegalArgumentException.class, () -> { graph.addVertex(T.label, "person", "name", @@ -9267,18 +9258,6 @@ public void testQueryBySearchIndexWithSpecialSymbol() { Assert.assertContains("can't contains byte '0x00'", e.getMessage()); }); - } else if (backend.equals("postgresql")) { - Assert.assertThrows(BackendException.class, () -> { - graph.addVertex(T.label, "person", "name", "7", - "city", "xyz\u0000efg", - "age", 15); - graph.tx().commit(); - }, e -> { - graph.tx().rollback(); - Assert.assertContains("invalid byte sequence for encoding " + - "\"UTF8\": 0x00", - e.getCause().getMessage()); - }); } else { graph.addVertex(T.label, "person", "name", "8", "city", "xyz\u0000efg", diff --git a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/tinkerpop/TestGraph.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/tinkerpop/TestGraph.java index 9ef6d9affd..53dc1fe9ac 100644 --- a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/tinkerpop/TestGraph.java +++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/tinkerpop/TestGraph.java @@ -53,7 +53,7 @@ public class TestGraph implements Graph { public static final String DEFAULT_VL = "vertex"; - public static final Set TRUNCATE_BACKENDS = ImmutableSet.of("rocksdb", "mysql"); + public static final Set TRUNCATE_BACKENDS = ImmutableSet.of("rocksdb"); private static volatile int id = 666; diff --git a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/UnitTestSuite.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/UnitTestSuite.java index 1a4f0c2c9b..1d3dd58a83 100644 --- a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/UnitTestSuite.java +++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/UnitTestSuite.java @@ -37,7 +37,6 @@ import org.apache.hugegraph.unit.cache.CachedGraphTransactionTest; import org.apache.hugegraph.unit.cache.CachedSchemaTransactionTest; import org.apache.hugegraph.unit.cache.RamTableTest; -import org.apache.hugegraph.unit.cassandra.CassandraTest; import org.apache.hugegraph.unit.core.AnalyzerTest; import org.apache.hugegraph.unit.core.BackendMutationTest; import org.apache.hugegraph.unit.core.BackendStoreInfoTest; @@ -64,8 +63,6 @@ import org.apache.hugegraph.unit.id.IdTest; import org.apache.hugegraph.unit.id.IdUtilTest; import org.apache.hugegraph.unit.id.SplicingIdGeneratorTest; -import org.apache.hugegraph.unit.mysql.MysqlUtilTest; -import org.apache.hugegraph.unit.mysql.WhereBuilderTest; import org.apache.hugegraph.unit.rocksdb.RocksDBCountersTest; import org.apache.hugegraph.unit.rocksdb.RocksDBSessionTest; import org.apache.hugegraph.unit.rocksdb.RocksDBSessionsTest; @@ -169,13 +166,6 @@ StoreSerializerTest.class, TextSerializerTest.class, - /* cassandra */ - CassandraTest.class, - - /* mysql */ - MysqlUtilTest.class, - WhereBuilderTest.class, - /* rocksdb */ RocksDBSessionsTest.class, RocksDBSessionTest.class, diff --git a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/cassandra/CassandraTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/cassandra/CassandraTest.java deleted file mode 100644 index 6445fc38bd..0000000000 --- a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/cassandra/CassandraTest.java +++ /dev/null @@ -1,437 +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.hugegraph.unit.cassandra; - -import java.net.InetSocketAddress; -import java.util.Collections; -import java.util.Map; - -import org.apache.commons.configuration2.Configuration; -import org.apache.commons.configuration2.PropertiesConfiguration; -import org.apache.hugegraph.backend.BackendException; -import org.apache.hugegraph.backend.store.cassandra.CassandraOptions; -import org.apache.hugegraph.backend.store.cassandra.CassandraSessionPool; -import org.apache.hugegraph.backend.store.cassandra.CassandraStore; -import org.apache.hugegraph.config.HugeConfig; -import org.apache.hugegraph.config.OptionSpace; -import org.apache.hugegraph.testutil.Assert; -import org.apache.hugegraph.testutil.Whitebox; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.mockito.Mockito; - -import com.datastax.driver.core.ResultSet; -import com.datastax.driver.core.ResultSetFuture; -import com.datastax.driver.core.SimpleStatement; -import com.datastax.driver.core.Statement; -import com.datastax.driver.core.exceptions.NoHostAvailableException; -import com.datastax.driver.core.exceptions.OperationTimedOutException; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; - -public class CassandraTest { - - @Before - public void setup() { - OptionSpace.register("cassandra", - "org.apache.hugegraph.backend.store.cassandra.CassandraOptions"); - } - - @After - public void teardown() { - // pass - } - - @Test - public void testParseReplicaWithSimpleStrategy() { - String strategy = CassandraOptions.CASSANDRA_STRATEGY.name(); - String replica = CassandraOptions.CASSANDRA_REPLICATION.name(); - - Configuration conf = new PropertiesConfiguration(); - conf.setProperty(strategy, "SimpleStrategy"); - conf.setProperty(replica, ImmutableList.of("5")); - HugeConfig config = new HugeConfig(conf); - - Map result = Whitebox.invokeStatic(CassandraStore.class, - "parseReplica", - config); - - Map expected = ImmutableMap.of( - "class", "SimpleStrategy", - "replication_factor", 5); - Assert.assertEquals(expected, result); - } - - @Test - public void testParseReplicaWithNetworkTopologyStrategy() { - String strategy = CassandraOptions.CASSANDRA_STRATEGY.name(); - String replica = CassandraOptions.CASSANDRA_REPLICATION.name(); - - Configuration conf = new PropertiesConfiguration(); - conf.setProperty(strategy, "NetworkTopologyStrategy"); - conf.setProperty(replica, ImmutableList.of("dc1:2", "dc2:1")); - HugeConfig config = new HugeConfig(conf); - - Map result = Whitebox.invokeStatic(CassandraStore.class, - "parseReplica", - config); - - Map expected = ImmutableMap.of( - "class", "NetworkTopologyStrategy", - "dc1", 2, - "dc2", 1); - Assert.assertEquals(expected, result); - } - - @Test - public void testParseReplicaWithSimpleStrategyAndEmptyReplica() { - String strategy = CassandraOptions.CASSANDRA_STRATEGY.name(); - String replica = CassandraOptions.CASSANDRA_REPLICATION.name(); - - Configuration conf = new PropertiesConfiguration(); - conf.setProperty(strategy, "SimpleStrategy"); - conf.setProperty(replica, ImmutableList.of("")); - HugeConfig config = new HugeConfig(conf); - - Assert.assertThrows(RuntimeException.class, () -> { - Whitebox.invokeStatic(CassandraStore.class, "parseReplica", config); - }); - } - - @Test - public void testParseReplicaWithSimpleStrategyAndDoubleReplica() { - String strategy = CassandraOptions.CASSANDRA_STRATEGY.name(); - String replica = CassandraOptions.CASSANDRA_REPLICATION.name(); - - Configuration conf = new PropertiesConfiguration(); - conf.setProperty(strategy, "SimpleStrategy"); - conf.setProperty(replica, ImmutableList.of("1.5")); - HugeConfig config = new HugeConfig(conf); - - Assert.assertThrows(RuntimeException.class, () -> { - Whitebox.invokeStatic(CassandraStore.class, "parseReplica", config); - }); - } - - @Test - public void testParseReplicaWithSimpleStrategyAndStringReplica() { - String strategy = CassandraOptions.CASSANDRA_STRATEGY.name(); - String replica = CassandraOptions.CASSANDRA_REPLICATION.name(); - - Configuration conf = new PropertiesConfiguration(); - conf.setProperty(strategy, "SimpleStrategy"); - conf.setProperty(replica, ImmutableList.of("string")); - HugeConfig config = new HugeConfig(conf); - - Assert.assertThrows(RuntimeException.class, () -> { - Whitebox.invokeStatic(CassandraStore.class, "parseReplica", config); - }); - } - - @Test - public void testParseReplicaWithNetworkTopologyStrategyAndStringReplica() { - String strategy = CassandraOptions.CASSANDRA_STRATEGY.name(); - String replica = CassandraOptions.CASSANDRA_REPLICATION.name(); - - Configuration conf = new PropertiesConfiguration(); - conf.setProperty(strategy, "NetworkTopologyStrategy"); - conf.setProperty(replica, ImmutableList.of("dc1:2", "dc2:string")); - HugeConfig config = new HugeConfig(conf); - - Assert.assertThrows(RuntimeException.class, () -> { - Whitebox.invokeStatic(CassandraStore.class, "parseReplica", config); - }); - } - - @Test - public void testParseReplicaWithNetworkTopologyStrategyWithoutDatacenter() { - String strategy = CassandraOptions.CASSANDRA_STRATEGY.name(); - String replica = CassandraOptions.CASSANDRA_REPLICATION.name(); - - Configuration conf = new PropertiesConfiguration(); - conf.setProperty(strategy, "NetworkTopologyStrategy"); - conf.setProperty(replica, ImmutableList.of(":2", "dc2:1")); - HugeConfig config = new HugeConfig(conf); - - Assert.assertThrows(RuntimeException.class, () -> { - Whitebox.invokeStatic(CassandraStore.class, "parseReplica", config); - }); - } - - @Test - public void testParseReplicaWithNetworkTopologyStrategyAndEmptyReplica() { - String strategy = CassandraOptions.CASSANDRA_STRATEGY.name(); - String replica = CassandraOptions.CASSANDRA_REPLICATION.name(); - - Configuration conf = new PropertiesConfiguration(); - conf.setProperty(strategy, "NetworkTopologyStrategy"); - conf.setProperty(replica, ImmutableList.of("dc1:", "dc2:1")); - HugeConfig config = new HugeConfig(conf); - - Assert.assertThrows(RuntimeException.class, () -> { - Whitebox.invokeStatic(CassandraStore.class, "parseReplica", config); - }); - } - - @Test - public void testParseReplicaWithNetworkTopologyStrategyAndDoubleReplica() { - String strategy = CassandraOptions.CASSANDRA_STRATEGY.name(); - String replica = CassandraOptions.CASSANDRA_REPLICATION.name(); - - Configuration conf = new PropertiesConfiguration(); - conf.setProperty(strategy, "NetworkTopologyStrategy"); - conf.setProperty(replica, ImmutableList.of("dc1:3.5", "dc2:1")); - HugeConfig config = new HugeConfig(conf); - - Assert.assertThrows(RuntimeException.class, () -> { - Whitebox.invokeStatic(CassandraStore.class, "parseReplica", config); - }); - } - - @Test - public void testReconnectOptionsHaveSensibleDefaults() { - // Runtime-reconnection options must exist with non-zero defaults so - // HugeGraph keeps running when Cassandra restarts (issue #2740). - Assert.assertEquals(1000L, (long) CassandraOptions - .CASSANDRA_RECONNECT_BASE_DELAY.defaultValue()); - Assert.assertEquals(10_000L, (long) CassandraOptions - .CASSANDRA_RECONNECT_MAX_DELAY.defaultValue()); - Assert.assertEquals(3, (int) CassandraOptions - .CASSANDRA_QUERY_RETRY_MAX_ATTEMPTS.defaultValue()); - Assert.assertEquals(1000L, (long) CassandraOptions - .CASSANDRA_QUERY_RETRY_INTERVAL.defaultValue()); - } - - @Test - public void testReconnectOptionsAreOverridable() { - String base = CassandraOptions.CASSANDRA_RECONNECT_BASE_DELAY.name(); - String max = CassandraOptions.CASSANDRA_RECONNECT_MAX_DELAY.name(); - String retries = CassandraOptions.CASSANDRA_QUERY_RETRY_MAX_ATTEMPTS - .name(); - String interval = CassandraOptions.CASSANDRA_QUERY_RETRY_INTERVAL.name(); - - Configuration conf = new PropertiesConfiguration(); - conf.setProperty(base, 500L); - conf.setProperty(max, 30_000L); - conf.setProperty(retries, 3); - conf.setProperty(interval, 1000L); - HugeConfig config = new HugeConfig(conf); - - Assert.assertEquals(500L, (long) config.get( - CassandraOptions.CASSANDRA_RECONNECT_BASE_DELAY)); - Assert.assertEquals(30_000L, (long) config.get( - CassandraOptions.CASSANDRA_RECONNECT_MAX_DELAY)); - Assert.assertEquals(3, (int) config.get( - CassandraOptions.CASSANDRA_QUERY_RETRY_MAX_ATTEMPTS)); - Assert.assertEquals(1000L, (long) config.get( - CassandraOptions.CASSANDRA_QUERY_RETRY_INTERVAL)); - } - - @Test - public void testQueryRetryAttemptsCanBeDisabled() { - String retries = CassandraOptions.CASSANDRA_QUERY_RETRY_MAX_ATTEMPTS - .name(); - Configuration conf = new PropertiesConfiguration(); - conf.setProperty(retries, 0); - HugeConfig config = new HugeConfig(conf); - Assert.assertEquals(0, (int) config.get( - CassandraOptions.CASSANDRA_QUERY_RETRY_MAX_ATTEMPTS)); - } - - @Test - public void testExecuteWithRetrySucceedsAfterTransientFailures() { - // Configure retry knobs via config so the pool reads them through - // the normal path (no Whitebox overrides on retry fields). Keep the - // values within the validators' lower bounds (base >= 100, max >= - // base, interval >= 100). - Configuration conf = new PropertiesConfiguration(); - conf.setProperty( - CassandraOptions.CASSANDRA_RECONNECT_BASE_DELAY.name(), 100L); - conf.setProperty( - CassandraOptions.CASSANDRA_RECONNECT_MAX_DELAY.name(), 1000L); - conf.setProperty( - CassandraOptions.CASSANDRA_QUERY_RETRY_MAX_ATTEMPTS.name(), 3); - conf.setProperty( - CassandraOptions.CASSANDRA_QUERY_RETRY_INTERVAL.name(), 100L); - HugeConfig config = new HugeConfig(conf); - CassandraSessionPool pool = new CassandraSessionPool(config, - "ks", "store"); - - com.datastax.driver.core.Session driverSession = Mockito.mock( - com.datastax.driver.core.Session.class); - ResultSet rs = Mockito.mock(ResultSet.class); - NoHostAvailableException transientFailure = - new NoHostAvailableException(Collections.emptyMap()); - Mockito.when(driverSession.execute(Mockito.any(Statement.class))) - .thenThrow(transientFailure) - .thenThrow(transientFailure) - .thenReturn(rs); - - CassandraSessionPool.Session session = pool.new Session(); - Whitebox.setInternalState(session, "session", driverSession); - - ResultSet result = session.execute("SELECT now() FROM system.local"); - Assert.assertSame(rs, result); - Mockito.verify(driverSession, Mockito.times(3)) - .execute(Mockito.any(Statement.class)); - Mockito.verify(driverSession, Mockito.never()).close(); - } - - @Test - public void testExecuteWithRetrySkipsNonIdempotentTimeoutRetry() { - Configuration conf = new PropertiesConfiguration(); - conf.setProperty( - CassandraOptions.CASSANDRA_RECONNECT_BASE_DELAY.name(), 100L); - conf.setProperty( - CassandraOptions.CASSANDRA_RECONNECT_MAX_DELAY.name(), 1000L); - conf.setProperty( - CassandraOptions.CASSANDRA_QUERY_RETRY_MAX_ATTEMPTS.name(), 3); - conf.setProperty( - CassandraOptions.CASSANDRA_QUERY_RETRY_INTERVAL.name(), 100L); - HugeConfig config = new HugeConfig(conf); - CassandraSessionPool pool = new CassandraSessionPool(config, - "ks", "store"); - - com.datastax.driver.core.Session driverSession = Mockito.mock( - com.datastax.driver.core.Session.class); - OperationTimedOutException timeout = new OperationTimedOutException( - new InetSocketAddress("127.0.0.1", 9042)); - Mockito.when(driverSession.execute(Mockito.any(Statement.class))) - .thenThrow(timeout); - - CassandraSessionPool.Session session = pool.new Session(); - Whitebox.setInternalState(session, "session", driverSession); - - Assert.assertThrows(BackendException.class, () -> - session.execute("UPDATE counter SET value = value + 1")); - Mockito.verify(driverSession, Mockito.times(1)) - .execute(Mockito.any(Statement.class)); - } - - @Test - public void testExecuteWithRetryAllowsIdempotentTimeoutRetry() { - Configuration conf = new PropertiesConfiguration(); - conf.setProperty( - CassandraOptions.CASSANDRA_RECONNECT_BASE_DELAY.name(), 100L); - conf.setProperty( - CassandraOptions.CASSANDRA_RECONNECT_MAX_DELAY.name(), 1000L); - conf.setProperty( - CassandraOptions.CASSANDRA_QUERY_RETRY_MAX_ATTEMPTS.name(), 3); - conf.setProperty( - CassandraOptions.CASSANDRA_QUERY_RETRY_INTERVAL.name(), 100L); - HugeConfig config = new HugeConfig(conf); - CassandraSessionPool pool = new CassandraSessionPool(config, - "ks", "store"); - - com.datastax.driver.core.Session driverSession = Mockito.mock( - com.datastax.driver.core.Session.class); - ResultSet rs = Mockito.mock(ResultSet.class); - OperationTimedOutException timeout = new OperationTimedOutException( - new InetSocketAddress("127.0.0.1", 9042)); - SimpleStatement statement = new SimpleStatement( - "SELECT now() FROM system.local"); - statement.setIdempotent(true); - Mockito.when(driverSession.execute(statement)) - .thenThrow(timeout) - .thenReturn(rs); - - CassandraSessionPool.Session session = pool.new Session(); - Whitebox.setInternalState(session, "session", driverSession); - - ResultSet result = session.execute(statement); - Assert.assertSame(rs, result); - Mockito.verify(driverSession, Mockito.times(2)).execute(statement); - } - - @Test - public void testCommitAsyncOpensSessionBeforeExecuteAsync() { - Configuration conf = new PropertiesConfiguration(); - conf.setProperty( - CassandraOptions.CASSANDRA_RECONNECT_BASE_DELAY.name(), 100L); - conf.setProperty( - CassandraOptions.CASSANDRA_RECONNECT_MAX_DELAY.name(), 1000L); - conf.setProperty( - CassandraOptions.CASSANDRA_QUERY_RETRY_MAX_ATTEMPTS.name(), 3); - conf.setProperty( - CassandraOptions.CASSANDRA_QUERY_RETRY_INTERVAL.name(), 100L); - HugeConfig config = new HugeConfig(conf); - CassandraSessionPool pool = new CassandraSessionPool(config, - "ks", "store"); - - com.datastax.driver.core.Cluster mockCluster = Mockito.mock( - com.datastax.driver.core.Cluster.class); - com.datastax.driver.core.Session driverSession = Mockito.mock( - com.datastax.driver.core.Session.class); - ResultSetFuture future = Mockito.mock(ResultSetFuture.class); - Mockito.when(mockCluster.isClosed()).thenReturn(false); - Mockito.when(mockCluster.connect(Mockito.anyString())) - .thenReturn(driverSession); - Mockito.when(driverSession.executeAsync(Mockito.any(Statement.class))) - .thenReturn(future); - Whitebox.setInternalState(pool, "cluster", mockCluster); - - CassandraSessionPool.Session session = pool.new Session(); - Statement statement = new SimpleStatement( - "INSERT INTO system.local(key) VALUES ('test')"); - session.add(statement); - - session.commitAsync(); - - Mockito.verify(mockCluster, Mockito.times(1)).connect("ks"); - Mockito.verify(driverSession, Mockito.times(1)).executeAsync(statement); - Mockito.verify(future, Mockito.times(1)).getUninterruptibly(); - Assert.assertFalse(session.hasChanges()); - } - - @Test - public void testReconnectBaseDelayBelowMinimumRejected() { - // The validator on CASSANDRA_RECONNECT_BASE_DELAY is - // rangeInt(100L, Long.MAX_VALUE); values below 100 must be rejected - // at parse time. Setting the property as a String forces HugeConfig - // to run parseConvert() which invokes the range check. - Configuration conf = new PropertiesConfiguration(); - Assert.assertThrows(Exception.class, () -> { - conf.setProperty( - CassandraOptions.CASSANDRA_RECONNECT_BASE_DELAY.name(), - "50"); - new HugeConfig(conf); - }); - } - - @Test - public void testReconnectMaxDelayLessThanBaseRejected() { - // Both values must pass their individual range validators with margin - // (base >= 100, max >= 1000), so the only thing that can throw is the - // E.checkArgument(max >= base) cross-check inside the pool ctor. Set - // all four retry/reconnect properties explicitly so the test does not - // depend on default values changing in CassandraOptions. - Configuration conf = new PropertiesConfiguration(); - conf.setProperty( - CassandraOptions.CASSANDRA_RECONNECT_BASE_DELAY.name(), 10_000L); - conf.setProperty( - CassandraOptions.CASSANDRA_RECONNECT_MAX_DELAY.name(), 2_000L); - conf.setProperty( - CassandraOptions.CASSANDRA_QUERY_RETRY_MAX_ATTEMPTS.name(), 3); - conf.setProperty( - CassandraOptions.CASSANDRA_QUERY_RETRY_INTERVAL.name(), 1_000L); - HugeConfig config = new HugeConfig(conf); - Assert.assertThrows(IllegalArgumentException.class, () -> - new CassandraSessionPool(config, "ks", "store")); - } -} diff --git a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/mysql/MysqlUtilTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/mysql/MysqlUtilTest.java deleted file mode 100644 index 0fcd9fe8f6..0000000000 --- a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/mysql/MysqlUtilTest.java +++ /dev/null @@ -1,59 +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.hugegraph.unit.mysql; - -import org.apache.hugegraph.backend.store.mysql.MysqlUtil; -import org.apache.hugegraph.testutil.Assert; -import org.apache.hugegraph.unit.BaseUnitTest; -import org.junit.Test; - -public class MysqlUtilTest extends BaseUnitTest { - - @Test - public void testEscapeString() { - Assert.assertEquals("abc", MysqlUtil.escapeString("abc")); - Assert.assertEquals("abc\"", MysqlUtil.escapeString("abc\"")); - - Assert.assertEquals("can\\'t", MysqlUtil.escapeString("can't")); - Assert.assertEquals("abc\\n", MysqlUtil.escapeString("abc\n")); - Assert.assertEquals("abc\\r", MysqlUtil.escapeString("abc\r")); - Assert.assertEquals("abc\\\\", MysqlUtil.escapeString("abc\\")); - Assert.assertEquals("abc\\0", MysqlUtil.escapeString("abc\u0000")); - Assert.assertEquals("abc\\Z", MysqlUtil.escapeString("abc\u001a")); - } - - @Test - public void testEscapeAndWrapString() { - Assert.assertEquals("'abc'", MysqlUtil.escapeAndWrapString("abc")); - Assert.assertEquals("'abc\"'", MysqlUtil.escapeAndWrapString("abc\"")); - Assert.assertEquals("''", MysqlUtil.escapeAndWrapString("")); - - Assert.assertEquals("'can\\'t'", - MysqlUtil.escapeAndWrapString("can't")); - Assert.assertEquals("'abc\\n'", - MysqlUtil.escapeAndWrapString("abc\n")); - Assert.assertEquals("'abc\\r'", - MysqlUtil.escapeAndWrapString("abc\r")); - Assert.assertEquals("'abc\\\\'", - MysqlUtil.escapeAndWrapString("abc\\")); - Assert.assertEquals("'abc\\0'", - MysqlUtil.escapeAndWrapString("abc\u0000")); - Assert.assertEquals("'abc\\Z'", - MysqlUtil.escapeAndWrapString("abc\u001a")); - } -} diff --git a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/mysql/WhereBuilderTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/mysql/WhereBuilderTest.java deleted file mode 100644 index c4421c566a..0000000000 --- a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/mysql/WhereBuilderTest.java +++ /dev/null @@ -1,123 +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.hugegraph.unit.mysql; - -import org.apache.hugegraph.backend.query.Condition.RelationType; -import org.apache.hugegraph.backend.store.mysql.WhereBuilder; -import org.apache.hugegraph.exception.NotSupportException; -import org.apache.hugegraph.testutil.Assert; -import org.apache.hugegraph.unit.BaseUnitTest; -import org.junit.Test; - -import com.google.common.collect.ImmutableList; - -public class WhereBuilderTest extends BaseUnitTest { - - @Test - public void testRelation() { - WhereBuilder where = new WhereBuilder(); - where.relation("key1", RelationType.EQ, "value1"); - Assert.assertEquals(" WHERE key1='value1'", where.build().toString()); - Assert.assertEquals(" WHERE key1='value1'", where.toString()); - - where = new WhereBuilder(false); - where.relation("key1", RelationType.EQ, "value1"); - Assert.assertEquals(" key1='value1'", where.build().toString()); - Assert.assertEquals(" key1='value1'", where.toString()); - - where.and().relation("key2", RelationType.EQ, "value2"); - Assert.assertEquals(" key1='value1' AND key2='value2'", - where.toString()); - - where = new WhereBuilder(false); - where.relation("key1", RelationType.NEQ, "value1"); - Assert.assertEquals(" key1!='value1'", where.toString()); - - where = new WhereBuilder(false); - where.relation("key1", RelationType.GT, "value1"); - Assert.assertEquals(" key1>'value1'", where.toString()); - - where = new WhereBuilder(false); - where.relation("key1", RelationType.GTE, "value1"); - Assert.assertEquals(" key1>='value1'", where.toString()); - - where = new WhereBuilder(false); - where.relation("key1", RelationType.LT, "value1"); - Assert.assertEquals(" key1<'value1'", where.toString()); - - where = new WhereBuilder(false); - where.relation("key1", RelationType.LTE, "value1"); - Assert.assertEquals(" key1<='value1'", where.toString()); - - where = new WhereBuilder(false); - where.relation("key1", RelationType.IN, ImmutableList.of("v1", "v2")); - Assert.assertEquals(" key1 IN ('v1', 'v2')", where.toString()); - - Assert.assertThrows(NotSupportException.class, () -> { - new WhereBuilder().relation("k", RelationType.CONTAINS_KEY, "v"); - }); - Assert.assertThrows(NotSupportException.class, () -> { - new WhereBuilder().relation("k", RelationType.CONTAINS_VALUE, "v"); - }); - Assert.assertThrows(NotSupportException.class, () -> { - new WhereBuilder().relation("k", RelationType.NOT_IN, "v"); - }); - Assert.assertThrows(NotSupportException.class, () -> { - new WhereBuilder().relation("k", RelationType.TEXT_CONTAINS, "v"); - }); - Assert.assertThrows(NotSupportException.class, () -> { - new WhereBuilder().relation("k", RelationType.SCAN, "v"); - }); - } - - @Test - public void testAnd() { - WhereBuilder where = new WhereBuilder(false); - where.and(ImmutableList.of("k1", "k2"), ImmutableList.of("v1", "v2")); - Assert.assertEquals(" k1='v1' AND k2='v2'", where.toString()); - - where = new WhereBuilder(false); - where.and(ImmutableList.of("k1", "k2"), "!=", - ImmutableList.of("v1", "v2")); - Assert.assertEquals(" k1!='v1' AND k2!='v2'", where.toString()); - - where = new WhereBuilder(false); - where.and(ImmutableList.of("k1", "k2", "k3"), - ImmutableList.of("=", "!=", ">"), - ImmutableList.of("v1", "v2", 3)); - Assert.assertEquals(" k1='v1' AND k2!='v2' AND k3>3", where.toString()); - - where = new WhereBuilder(false); - where.and(ImmutableList.of("k1", "k2"), "="); - Assert.assertEquals(" k1=? AND k2=?", where.toString()); - } - - @Test - public void testIn() { - WhereBuilder where = new WhereBuilder(false); - where.in("key", ImmutableList.of("v1", "v2", "v3")); - Assert.assertEquals(" key IN ('v1', 'v2', 'v3')", where.toString()); - } - - @Test - public void testGt() { - WhereBuilder where = new WhereBuilder(false); - where.gte(ImmutableList.of("k1", "k2"), ImmutableList.of("v1", "v2")); - Assert.assertEquals(" (k1, k2) >= ('v1', 'v2')", where.toString()); - } -} diff --git a/hugegraph-server/hugegraph-test/src/main/resources/log4j2.xml b/hugegraph-server/hugegraph-test/src/main/resources/log4j2.xml index e943d3a282..30753c2c18 100644 --- a/hugegraph-server/hugegraph-test/src/main/resources/log4j2.xml +++ b/hugegraph-server/hugegraph-test/src/main/resources/log4j2.xml @@ -107,10 +107,6 @@ - - - - @@ -119,10 +115,6 @@ - - - - diff --git a/hugegraph-server/pom.xml b/hugegraph-server/pom.xml index 226199cdc8..a9169591a3 100644 --- a/hugegraph-server/pom.xml +++ b/hugegraph-server/pom.xml @@ -64,13 +64,8 @@ hugegraph-example hugegraph-dist hugegraph-test - hugegraph-cassandra - hugegraph-scylladb hugegraph-rocksdb - hugegraph-mysql - hugegraph-palo hugegraph-hbase - hugegraph-postgresql hugegraph-hstore diff --git a/install-dist/release-docs/LICENSE b/install-dist/release-docs/LICENSE index 0014317824..f12f0b0d78 100644 --- a/install-dist/release-docs/LICENSE +++ b/install-dist/release-docs/LICENSE @@ -253,7 +253,6 @@ The text of each license is also included in licenses/LICENSE-[project].txt. https://central.sonatype.com/artifact/com.github.luben/zstd-jni/1.5.5-1 -> BSD-2-Clause https://central.sonatype.com/artifact/org.latencyutils/LatencyUtils/2.0.3 -> BSD-2-Clause - https://central.sonatype.com/artifact/org.postgresql/postgresql/42.4.3 -> BSD-2-Clause ======================================================================== Third party Apache 2.0 licenses @@ -282,7 +281,6 @@ non-Apache-2.0 license text is required for a bundled component. https://central.sonatype.com/artifact/com.chenlb.mmseg4j/mmseg4j-core/1.10.0 -> Apache 2.0 https://central.sonatype.com/artifact/com.clearspring.analytics/stream/2.5.2 -> Apache 2.0 https://central.sonatype.com/artifact/com.codahale.metrics/metrics-core/3.0.2 -> Apache 2.0 - https://central.sonatype.com/artifact/com.datastax.cassandra/cassandra-driver-core/3.6.0 -> Apache 2.0 https://central.sonatype.com/artifact/com.fasterxml.jackson.core/jackson-annotations/2.13.0 -> Apache 2.0 https://central.sonatype.com/artifact/com.fasterxml.jackson.core/jackson-annotations/2.14.0-rc1 -> Apache 2.0 https://central.sonatype.com/artifact/com.fasterxml.jackson.core/jackson-annotations/2.15.2 -> Apache 2.0 @@ -514,7 +512,6 @@ non-Apache-2.0 license text is required for a bundled component. https://central.sonatype.com/artifact/net.openhft/chronicle-threads/2.20.111 -> Apache 2.0 https://central.sonatype.com/artifact/net.openhft/chronicle-wire/2.20.117 -> Apache 2.0 https://central.sonatype.com/artifact/org.ansj/ansj_seg/5.1.6 -> Apache 2.0 - https://central.sonatype.com/artifact/org.apache.cassandra/cassandra-all/4.0.10 -> Apache 2.0 https://central.sonatype.com/artifact/org.apache.commons/commons-collections4/4.4 -> Apache 2.0 https://central.sonatype.com/artifact/org.apache.commons/commons-compress/1.21 -> Apache 2.0 https://central.sonatype.com/artifact/org.apache.commons/commons-configuration2/2.8.0 -> Apache 2.0 diff --git a/install-dist/release-docs/NOTICE b/install-dist/release-docs/NOTICE index 775f03241c..22ca2676dd 100644 --- a/install-dist/release-docs/NOTICE +++ b/install-dist/release-docs/NOTICE @@ -1112,24 +1112,6 @@ BSD - Scala License Scala Library -======================================================================== - -cassandra NOTICE - -======================================================================== - -Apache Cassandra -Copyright 2009-2022 The Apache Software Foundation - -This product includes software developed by The Apache Software -Foundation (http://www.apache.org/). - -Android Code -Copyright 2005-2008 The Android Open Source Project -This product includes software developed as part of -The Android Open Source Project (http://source.android.com). - - ======================================================================== Groovy NOTICE @@ -1758,28 +1740,6 @@ Components, which can be obtained at: * https://github.com/Polymer/polymer -======================================================================== - -postgres NOTICE - -======================================================================== - -This product contains a modified portion of 'ASM', an open source -Java Bytecode library, which can be obtained at: - - * LICENSE: - * agent/src/main/resources/io/perfmark/agent/third_party/asm/LICENSE (BSD style License) - * HOMEPAGE: - * https://asm.ow2.io/ - - -PostgreSQL Database Management System -(formerly known as Postgres, then as Postgres95) - -Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group - -Portions Copyright (c) 1994, The Regents of the University of California - ======================================================================== proto-google-common-protos NOTICE diff --git a/install-dist/release-docs/licenses/LICENSE-cassandra-all-4.0.10.txt b/install-dist/release-docs/licenses/LICENSE-cassandra-all-4.0.10.txt deleted file mode 100644 index 1b0f46f767..0000000000 --- a/install-dist/release-docs/licenses/LICENSE-cassandra-all-4.0.10.txt +++ /dev/null @@ -1,240 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. - - - APACHE CASSANDRA SUBCOMPONENTS: - - Apache Cassandra includes a number of subcomponents with - separate copyright notices and license terms. Your use of the source - code for these subcomponents is subject to the terms and - conditions of the following licenses. - - This product bundles a file (AbstractIterator.java) from Chronicle-Bytes, - copyright higherfrequencytrading.com, which is available under an - Apache License version 2. - - This product bundles a file (AbstractIterator.java) from Guava, - copyright The Guava Authors, which is available under an - Apache License version 2. - - This product bundles a file (LongTimSort.java) from Android libcore, - copyright The Android Open Source Project, which is available under an - Apache License version 2. - - This product bundles several files (LongTimSort.java) from PATRICIA Trie - copyright Roger Kapsi and Sam Berlin, which is available under an - Apache License version 2. - - This product bundles a file (VIntCoding.java) from Protocol Buffers - copyright Google Inc., which is available under a BSD license. - - Thus product bundles material adapted from Cassandra, The Definitive Guide. - Published by O'Reilly Media, Inc. Copyright Jeff Carpenter and Eben Hewitt - and used with their permission. - - This product bundles The Project Gutenberg EBook of Adventures of - Huckleberry Finn, Complete by Mark Twain (Samuel Clemens), which is in - the public domain. - - This product bundles code (internalOffer) that is written by Doug Lea and - Martin Buchholz available under a Creative Commons zero license. diff --git a/install-dist/release-docs/licenses/LICENSE-cassandra-driver-core-3.6.0.txt b/install-dist/release-docs/licenses/LICENSE-cassandra-driver-core-3.6.0.txt deleted file mode 100644 index d645695673..0000000000 --- a/install-dist/release-docs/licenses/LICENSE-cassandra-driver-core-3.6.0.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. diff --git a/install-dist/release-docs/licenses/LICENSE-postgresql-42.4.3.txt b/install-dist/release-docs/licenses/LICENSE-postgresql-42.4.3.txt deleted file mode 100644 index daa7e320f2..0000000000 --- a/install-dist/release-docs/licenses/LICENSE-postgresql-42.4.3.txt +++ /dev/null @@ -1,33 +0,0 @@ -Copyright (c) 1997, PostgreSQL Global Development Group -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -Additional License files can be found in the 'licenses' folder located in the same directory as the LICENSE file (i.e. this file) - -- Software produced outside the ASF which is available under other licenses (not Apache-2.0) - -BSD-2-Clause -* com.ongres.scram:client:2.1 -* com.ongres.scram:common:2.1 -* com.ongres.stringprep:saslprep:1.1 -* com.ongres.stringprep:stringprep:1.1 diff --git a/install-dist/scripts/dependency/known-dependencies.txt b/install-dist/scripts/dependency/known-dependencies.txt index 326ac3dd76..3b05fbba11 100644 --- a/install-dist/scripts/dependency/known-dependencies.txt +++ b/install-dist/scripts/dependency/known-dependencies.txt @@ -44,8 +44,6 @@ byte-buddy-agent-1.10.5.jar byte-buddy-agent-1.11.6.jar caffeine-2.3.1.jar caffeine-2.5.6.jar -cassandra-all-4.0.10.jar -cassandra-driver-core-3.6.0.jar checker-compat-qual-2.5.5.jar checker-qual-2.0.0.jar checker-qual-3.12.0.jar @@ -486,7 +484,6 @@ perfmark-api-0.23.0.jar perfmark-api-0.25.0.jar picocli-4.3.2.jar pinyin4j-2.5.0.jar -postgresql-42.4.3.jar powermock-api-mockito2-2.0.0-RC.3.jar powermock-api-support-2.0.0-RC.3.jar powermock-classloading-base-2.0.0-RC.3.jar From 97f83895191fca071e9777b8297a81a56faeb5a9 Mon Sep 17 00:00:00 2001 From: legendPei <804141866@qq.com> Date: Sat, 25 Jul 2026 16:41:49 +0800 Subject: [PATCH 05/15] feat(server): clean legacy backend remnants --- README.md | 25 ++++++------ docker/hbase/README.md | 2 +- .../org/apache/hugegraph/cmd/InitStore.java | 38 ++++--------------- 3 files changed, 22 insertions(+), 43 deletions(-) diff --git a/README.md b/README.md index f24f6f7bfd..25b2f40f6d 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ achieved through the powerful [Gremlin](https://tinkerpop.apache.org/gremlin.htm - **Schema Metadata Management**: VertexLabel, EdgeLabel, PropertyKey, and IndexLabel - **Multi-type Indexes**: Exact query, range query, and complex conditions combination query -- **Plug-in Backend Store Framework**: Mainly supports `RocksDB`/`HStore` + `HBase`; other backends available in [legacy versions](https://hugegraph.apache.org/docs/download/download/) ≤ `1.5.0` (MySQL/PostgreSQL/Cassandra...) +- **Plug-in Backend Store Framework**: Supports `RocksDB`, `HStore`, `HBase`, and `Memory`. Versions earlier than `1.7.0` included additional, now-removed backends. - **Big Data Integration**: Seamless integration with `Flink`/`Spark`/`HDFS` - **Complete Graph Ecosystem**: In/out-memory Graph Computing + Graph Visualization & Tools + Graph Learning & AI - **Dual Query Language Support**: [Gremlin](https://tinkerpop.apache.org/gremlin.html) (via [Apache TinkerPop 3](https://tinkerpop.apache.org/)) and [Cypher](https://en.wikipedia.org/wiki/Cypher_(query_language)) (OpenCypher) @@ -78,11 +78,11 @@ HugeGraph supports both **standalone** and **distributed** deployments: ┌────────────────────────────────┼────────────────────────────────┐ │ │ │ ┌────────────▼────────────┐ ┌───────────────▼───────────────┐ ┌───────────▼──────────┐ -│ Standalone Mode │ │ Distributed Mode │ │ Legacy Backends │ -│ ┌───────────────────┐ │ │ ┌─────────────────────────┐ │ │ (≤v1.5) │ -│ │ RocksDB │ │ │ │ HugeGraph-PD │ │ │ MySQL │ PostgreSQL │ -│ │ (embedded) │ │ │ │ (Raft, 3-5 nodes) │ │ │ Cassandra │ -│ └───────────────────┘ │ │ │ :8620/:8686 │ │ │ HBase (≤v1.7) │ +│ Standalone Mode │ │ Distributed Mode │ │ Supported Backends │ +│ ┌───────────────────┐ │ │ ┌─────────────────────────┐ │ │ RocksDB │ Memory │ +│ │ RocksDB │ │ │ │ HugeGraph-PD │ │ │ HBase │ HStore │ +│ │ (embedded) │ │ │ │ (Raft, 3-5 nodes) │ │ │ │ +│ └───────────────────┘ │ │ │ :8620/:8686 │ │ │ │ │ │ │ └────────────┬────────────┘ │ └──────────────────────┘ │ Use Case: │ │ │ │ │ Development/Testing │ │ ┌────────────▼────────────┐ │ @@ -148,18 +148,19 @@ flowchart TB PD <--> STORE end - subgraph Legacy["Legacy Backends (≤v1.5)"] - MYSQL[(MySQL)] - PG[(PostgreSQL)] - CASS[(Cassandra)] - HBASE[(HBase, ≤v1.7)] + subgraph Backends["Supported Backends"] + HBASE[(HBase)] + HSTORE[(HStore)] + MEMORY[(Memory)] end end Clients --> Server CORE --> ROCKS CORE --> PD - CORE -.-> Legacy + CORE --> HBASE + CORE --> HSTORE + CORE --> MEMORY style Server fill:#e1f5ff style Distributed fill:#fff4e1 diff --git a/docker/hbase/README.md b/docker/hbase/README.md index fd72514602..aa6fcd2870 100644 --- a/docker/hbase/README.md +++ b/docker/hbase/README.md @@ -158,7 +158,7 @@ After either path is up, run the shared tests below. - Base URL: `http://localhost:8080` - Graph target name: `hugegraph` -- Storage backend: persistent (HBase/Cassandra/RocksDB) +- Storage backend: persistent (HBase/RocksDB/HStore) --- diff --git a/hugegraph-server/hugegraph-dist/src/main/java/org/apache/hugegraph/cmd/InitStore.java b/hugegraph-server/hugegraph-dist/src/main/java/org/apache/hugegraph/cmd/InitStore.java index f68dfd1325..fc13706ad5 100644 --- a/hugegraph-server/hugegraph-dist/src/main/java/org/apache/hugegraph/cmd/InitStore.java +++ b/hugegraph-server/hugegraph-dist/src/main/java/org/apache/hugegraph/cmd/InitStore.java @@ -18,12 +18,10 @@ package org.apache.hugegraph.cmd; import java.util.ArrayList; -import java.util.Collection; import java.util.List; import java.util.Map; import java.util.Objects; -import org.apache.commons.collections.map.MultiValueMap; import org.apache.hugegraph.HugeFactory; import org.apache.hugegraph.HugeGraph; import org.apache.hugegraph.auth.StandardAuthenticator; @@ -49,17 +47,6 @@ public class InitStore { // A shorter interval can cause initialization state mismatches private static final long RETRY_INTERVAL = 5000; - private static final MultiValueMap EXCEPTIONS = new MultiValueMap(); - - static { - EXCEPTIONS.put("OperationTimedOutException", - "Timed out waiting for server response"); - EXCEPTIONS.put("NoHostAvailableException", - "All host(s) tried for query failed"); - EXCEPTIONS.put("InvalidQueryException", "does not exist"); - EXCEPTIONS.put("InvalidQueryException", "unconfigured table"); - } - public static void main(String[] args) throws Exception { E.checkArgument(args.length == 1, "HugeGraph init-store need to pass the config file " + @@ -132,30 +119,21 @@ private static HugeGraph initGraph(String configPath) throws Exception { private static void initBackend(final HugeGraph graph) throws InterruptedException { int retries = RETRIES; - retry: - do { + while (true) { try { graph.initBackend(); } catch (Exception e) { String clz = e.getClass().getSimpleName(); String message = e.getMessage(); - if (EXCEPTIONS.containsKey(clz) && retries > 0) { - @SuppressWarnings("unchecked") - Collection keywords = EXCEPTIONS.getCollection(clz); - for (String keyword : keywords) { - if (message.contains(keyword)) { - LOG.info("Init failed with exception '{} : {}', " + - "retry {}...", - clz, message, RETRIES - retries + 1); - - Thread.sleep(RETRY_INTERVAL); - continue retry; - } - } + if (retries-- > 0) { + LOG.info("Init failed with exception '{} : {}', retry {}...", + clz, message, RETRIES - retries); + Thread.sleep(RETRY_INTERVAL); + continue; } throw e; } - break; - } while (retries-- > 0); + return; + } } } From 60369873c776d04419a89ab4351332cd20744cbb Mon Sep 17 00:00:00 2001 From: legendPei <804141866@qq.com> Date: Sat, 25 Jul 2026 16:45:16 +0800 Subject: [PATCH 06/15] feat(server): clarify legacy backend support --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 25b2f40f6d..d8d966ddb3 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ achieved through the powerful [Gremlin](https://tinkerpop.apache.org/gremlin.htm - **Schema Metadata Management**: VertexLabel, EdgeLabel, PropertyKey, and IndexLabel - **Multi-type Indexes**: Exact query, range query, and complex conditions combination query -- **Plug-in Backend Store Framework**: Supports `RocksDB`, `HStore`, `HBase`, and `Memory`. Versions earlier than `1.7.0` included additional, now-removed backends. +- **Plug-in Backend Store Framework**: Since `1.7.0`, supported backends are `RocksDB`, `HStore`, `HBase`, and `Memory`. Historical versions earlier than `1.7.0` also supported MySQL, PostgreSQL, Cassandra, ScyllaDB, and Palo. - **Big Data Integration**: Seamless integration with `Flink`/`Spark`/`HDFS` - **Complete Graph Ecosystem**: In/out-memory Graph Computing + Graph Visualization & Tools + Graph Learning & AI - **Dual Query Language Support**: [Gremlin](https://tinkerpop.apache.org/gremlin.html) (via [Apache TinkerPop 3](https://tinkerpop.apache.org/)) and [Cypher](https://en.wikipedia.org/wiki/Cypher_(query_language)) (OpenCypher) From 61b2142abfff4acb4cf323bb9b9d860b4f19415d Mon Sep 17 00:00:00 2001 From: legendPei <804141866@qq.com> Date: Sun, 26 Jul 2026 18:23:34 +0800 Subject: [PATCH 07/15] feat(core): mark hbase removal in 2.0 --- .../apache/hugegraph/backend/store/BackendProviderFactory.java | 1 + 1 file changed, 1 insertion(+) diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendProviderFactory.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendProviderFactory.java index d3751c11ba..ac1e0018ce 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendProviderFactory.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendProviderFactory.java @@ -37,6 +37,7 @@ * since 1.7.0, only "hstore, rocksdb, hbase, memory" are supported for backend. * if you want to use cassandra, mysql, postgresql, cockroachdb or palo as backend, * please find a version before 1.7.0 of apache hugegraph for your application. + * TODO: Remove hbase backend support in 2.0. */ public class BackendProviderFactory { From 480748cbcdc1226089f53130f56e980e48f0da4f Mon Sep 17 00:00:00 2001 From: legendPei <804141866@qq.com> Date: Sun, 26 Jul 2026 20:07:00 +0800 Subject: [PATCH 08/15] feat(server): address legacy backend review --- hugegraph-server/hugegraph-dist/pom.xml | 36 +- .../org/apache/hugegraph/cmd/InitStore.java | 27 +- .../apache/hugegraph/cmd/InitStoreTest.java | 61 +++ .../org/apache/hugegraph/backend/Shard.java | 2 +- .../apache/hugegraph/options/CoreOptions.java | 4 +- .../org/apache/hugegraph/query/Condition.java | 2 +- install-dist/release-docs/LICENSE | 51 --- install-dist/release-docs/NOTICE | 90 ---- .../licenses/LICENSE-HdrHistogram-2.1.9.txt | 1 - .../licenses/LICENSE-ST4-4.0.8.txt | 1 - .../licenses/LICENSE-airline-0.8.txt | 202 --------- .../licenses/LICENSE-antlr-runtime-3.5.2.txt | 26 -- .../release-docs/licenses/LICENSE-asm-7.1.txt | 1 - .../licenses/LICENSE-asm-analysis-5.0.3.txt | 29 -- .../licenses/LICENSE-asm-commons-5.0.3.txt | 29 -- .../licenses/LICENSE-asm-tree-5.0.3.txt | 29 -- .../licenses/LICENSE-asm-util-5.0.3.txt | 29 -- .../licenses/LICENSE-caffeine-2.5.6.txt | 202 --------- .../LICENSE-chronicle-bytes-2.20.111.txt | 202 --------- .../LICENSE-chronicle-core-2.20.126.txt | 202 --------- .../LICENSE-chronicle-queue-5.20.123.txt | 202 --------- .../LICENSE-chronicle-threads-2.20.111.txt | 202 --------- .../LICENSE-chronicle-wire-2.20.117.txt | 202 --------- .../licenses/LICENSE-commons-cli-1.1.txt | 202 --------- .../licenses/LICENSE-commons-codec-1.11.txt | 202 --------- .../licenses/LICENSE-commons-codec-1.9.txt | 202 --------- .../licenses/LICENSE-commons-lang3-3.11.txt | 202 --------- .../licenses/LICENSE-commons-math3-3.2.txt | 387 ------------------ .../LICENSE-concurrent-trees-2.4.0.txt | 202 --------- .../licenses/LICENSE-guava-27.0-jre.txt | 202 --------- .../licenses/LICENSE-high-scale-lib-1.0.6.txt | 1 - .../licenses/LICENSE-hppc-0.8.1.txt | 202 --------- .../LICENSE-java-cup-runtime-11b-20160615.txt | 7 - .../licenses/LICENSE-javax.inject-1.txt | 202 --------- .../licenses/LICENSE-jctools-core-3.1.0.txt | 202 --------- .../licenses/LICENSE-jffi-1.2.16-native.txt | 202 --------- .../licenses/LICENSE-jffi-1.2.16.txt | 202 --------- .../licenses/LICENSE-jflex-1.8.2.txt | 21 - .../licenses/LICENSE-jnr-ffi-2.1.7.txt | 202 --------- .../licenses/LICENSE-jnr-x86asm-1.0.2.txt | 1 - .../licenses/LICENSE-json-simple-1.1.txt | 202 --------- .../licenses/LICENSE-metrics-core-3.1.5.txt | 202 --------- .../licenses/LICENSE-metrics-jvm-3.1.5.txt | 202 --------- .../LICENSE-metrics-logback-3.1.5.txt | 202 --------- .../licenses/LICENSE-mxdump-0.14.txt | 202 --------- .../LICENSE-netty-all-4.1.44.Final.txt | 202 --------- ...tcnative-boringssl-static-2.0.36.Final.txt | 201 --------- .../licenses/LICENSE-ohc-core-j8-0.5.1.txt | 202 --------- .../licenses/LICENSE-psjava-0.1.19.txt | 1 - .../LICENSE-reporter-config-base-3.0.3.txt | 202 --------- .../LICENSE-reporter-config3-3.0.3.txt | 202 --------- .../licenses/LICENSE-sigar-1.6.4.txt | 202 --------- .../licenses/LICENSE-sjk-cli-0.14.txt | 202 --------- .../licenses/LICENSE-sjk-core-0.14.txt | 202 --------- .../licenses/LICENSE-sjk-json-0.14.txt | 202 --------- .../licenses/LICENSE-sjk-stacktrace-0.14.txt | 202 --------- .../licenses/LICENSE-snappy-java-1.1.2.6.txt | 202 --------- .../LICENSE-snowball-stemmer-1.3.0.581.1.txt | 1 - .../licenses/LICENSE-stream-2.5.2.txt | 202 --------- .../licenses/LICENSE-zstd-jni-1.5.5-1.txt | 1 - .../scripts/dependency/known-dependencies.txt | 80 +--- pom.xml | 1 - 62 files changed, 107 insertions(+), 8083 deletions(-) create mode 100644 hugegraph-server/hugegraph-dist/src/test/java/org/apache/hugegraph/cmd/InitStoreTest.java delete mode 100644 install-dist/release-docs/licenses/LICENSE-HdrHistogram-2.1.9.txt delete mode 100644 install-dist/release-docs/licenses/LICENSE-ST4-4.0.8.txt delete mode 100644 install-dist/release-docs/licenses/LICENSE-airline-0.8.txt delete mode 100644 install-dist/release-docs/licenses/LICENSE-antlr-runtime-3.5.2.txt delete mode 100644 install-dist/release-docs/licenses/LICENSE-asm-7.1.txt delete mode 100644 install-dist/release-docs/licenses/LICENSE-asm-analysis-5.0.3.txt delete mode 100644 install-dist/release-docs/licenses/LICENSE-asm-commons-5.0.3.txt delete mode 100644 install-dist/release-docs/licenses/LICENSE-asm-tree-5.0.3.txt delete mode 100644 install-dist/release-docs/licenses/LICENSE-asm-util-5.0.3.txt delete mode 100644 install-dist/release-docs/licenses/LICENSE-caffeine-2.5.6.txt delete mode 100644 install-dist/release-docs/licenses/LICENSE-chronicle-bytes-2.20.111.txt delete mode 100644 install-dist/release-docs/licenses/LICENSE-chronicle-core-2.20.126.txt delete mode 100644 install-dist/release-docs/licenses/LICENSE-chronicle-queue-5.20.123.txt delete mode 100644 install-dist/release-docs/licenses/LICENSE-chronicle-threads-2.20.111.txt delete mode 100644 install-dist/release-docs/licenses/LICENSE-chronicle-wire-2.20.117.txt delete mode 100644 install-dist/release-docs/licenses/LICENSE-commons-cli-1.1.txt delete mode 100644 install-dist/release-docs/licenses/LICENSE-commons-codec-1.11.txt delete mode 100644 install-dist/release-docs/licenses/LICENSE-commons-codec-1.9.txt delete mode 100644 install-dist/release-docs/licenses/LICENSE-commons-lang3-3.11.txt delete mode 100644 install-dist/release-docs/licenses/LICENSE-commons-math3-3.2.txt delete mode 100644 install-dist/release-docs/licenses/LICENSE-concurrent-trees-2.4.0.txt delete mode 100644 install-dist/release-docs/licenses/LICENSE-guava-27.0-jre.txt delete mode 100644 install-dist/release-docs/licenses/LICENSE-high-scale-lib-1.0.6.txt delete mode 100644 install-dist/release-docs/licenses/LICENSE-hppc-0.8.1.txt delete mode 100644 install-dist/release-docs/licenses/LICENSE-java-cup-runtime-11b-20160615.txt delete mode 100644 install-dist/release-docs/licenses/LICENSE-javax.inject-1.txt delete mode 100644 install-dist/release-docs/licenses/LICENSE-jctools-core-3.1.0.txt delete mode 100644 install-dist/release-docs/licenses/LICENSE-jffi-1.2.16-native.txt delete mode 100644 install-dist/release-docs/licenses/LICENSE-jffi-1.2.16.txt delete mode 100644 install-dist/release-docs/licenses/LICENSE-jflex-1.8.2.txt delete mode 100644 install-dist/release-docs/licenses/LICENSE-jnr-ffi-2.1.7.txt delete mode 100644 install-dist/release-docs/licenses/LICENSE-jnr-x86asm-1.0.2.txt delete mode 100644 install-dist/release-docs/licenses/LICENSE-json-simple-1.1.txt delete mode 100644 install-dist/release-docs/licenses/LICENSE-metrics-core-3.1.5.txt delete mode 100644 install-dist/release-docs/licenses/LICENSE-metrics-jvm-3.1.5.txt delete mode 100644 install-dist/release-docs/licenses/LICENSE-metrics-logback-3.1.5.txt delete mode 100644 install-dist/release-docs/licenses/LICENSE-mxdump-0.14.txt delete mode 100644 install-dist/release-docs/licenses/LICENSE-netty-all-4.1.44.Final.txt delete mode 100644 install-dist/release-docs/licenses/LICENSE-netty-tcnative-boringssl-static-2.0.36.Final.txt delete mode 100644 install-dist/release-docs/licenses/LICENSE-ohc-core-j8-0.5.1.txt delete mode 100644 install-dist/release-docs/licenses/LICENSE-psjava-0.1.19.txt delete mode 100644 install-dist/release-docs/licenses/LICENSE-reporter-config-base-3.0.3.txt delete mode 100644 install-dist/release-docs/licenses/LICENSE-reporter-config3-3.0.3.txt delete mode 100644 install-dist/release-docs/licenses/LICENSE-sigar-1.6.4.txt delete mode 100644 install-dist/release-docs/licenses/LICENSE-sjk-cli-0.14.txt delete mode 100644 install-dist/release-docs/licenses/LICENSE-sjk-core-0.14.txt delete mode 100644 install-dist/release-docs/licenses/LICENSE-sjk-json-0.14.txt delete mode 100644 install-dist/release-docs/licenses/LICENSE-sjk-stacktrace-0.14.txt delete mode 100644 install-dist/release-docs/licenses/LICENSE-snappy-java-1.1.2.6.txt delete mode 100644 install-dist/release-docs/licenses/LICENSE-snowball-stemmer-1.3.0.581.1.txt delete mode 100644 install-dist/release-docs/licenses/LICENSE-stream-2.5.2.txt delete mode 100644 install-dist/release-docs/licenses/LICENSE-zstd-jni-1.5.5-1.txt diff --git a/hugegraph-server/hugegraph-dist/pom.xml b/hugegraph-server/hugegraph-dist/pom.xml index e18d416529..c4575bc877 100644 --- a/hugegraph-server/hugegraph-dist/pom.xml +++ b/hugegraph-server/hugegraph-dist/pom.xml @@ -66,17 +66,6 @@ hugegraph-rocksdb ${revision} - - org.apache.hugegraph - hugegraph-hbase - ${revision} - - - org.apache.hugegraph - hugegraph-hstore - ${revision} - - org.apache.tinkerpop gremlin-console @@ -95,6 +84,11 @@ grpc-stub ${grpc.version} + + junit + junit + test + @@ -277,6 +271,26 @@ + + supported-backends + + + !rocksdb-only + + + + + org.apache.hugegraph + hugegraph-hbase + ${revision} + + + org.apache.hugegraph + hugegraph-hstore + ${revision} + + + rocksdb-only diff --git a/hugegraph-server/hugegraph-dist/src/main/java/org/apache/hugegraph/cmd/InitStore.java b/hugegraph-server/hugegraph-dist/src/main/java/org/apache/hugegraph/cmd/InitStore.java index fc13706ad5..4391edb438 100644 --- a/hugegraph-server/hugegraph-dist/src/main/java/org/apache/hugegraph/cmd/InitStore.java +++ b/hugegraph-server/hugegraph-dist/src/main/java/org/apache/hugegraph/cmd/InitStore.java @@ -42,11 +42,6 @@ public class InitStore { private static final Logger LOG = Log.logger(InitStore.class); - // Retries may be needed when backend initialization is under high load - private static final int RETRIES = 10; - // A shorter interval can cause initialization state mismatches - private static final long RETRY_INTERVAL = 5000; - public static void main(String[] args) throws Exception { E.checkArgument(args.length == 1, "HugeGraph init-store need to pass the config file " + @@ -116,24 +111,8 @@ private static HugeGraph initGraph(String configPath) throws Exception { return graph; } - private static void initBackend(final HugeGraph graph) - throws InterruptedException { - int retries = RETRIES; - while (true) { - try { - graph.initBackend(); - } catch (Exception e) { - String clz = e.getClass().getSimpleName(); - String message = e.getMessage(); - if (retries-- > 0) { - LOG.info("Init failed with exception '{} : {}', retry {}...", - clz, message, RETRIES - retries); - Thread.sleep(RETRY_INTERVAL); - continue; - } - throw e; - } - return; - } + private static void initBackend(final HugeGraph graph) { + // Only explicitly transient backend failures can be retried safely + graph.initBackend(); } } diff --git a/hugegraph-server/hugegraph-dist/src/test/java/org/apache/hugegraph/cmd/InitStoreTest.java b/hugegraph-server/hugegraph-dist/src/test/java/org/apache/hugegraph/cmd/InitStoreTest.java new file mode 100644 index 0000000000..bf16bb3f15 --- /dev/null +++ b/hugegraph-server/hugegraph-dist/src/test/java/org/apache/hugegraph/cmd/InitStoreTest.java @@ -0,0 +1,61 @@ +/* + * 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.cmd; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.lang.reflect.Proxy; +import java.util.concurrent.atomic.AtomicInteger; + +import org.apache.hugegraph.HugeGraph; +import org.junit.Assert; +import org.junit.Test; + +public class InitStoreTest { + + @Test + public void testInitBackendFailsFastForPermanentException() throws Exception { + AtomicInteger invocations = new AtomicInteger(); + IllegalArgumentException exception = + new IllegalArgumentException("Invalid backend configuration"); + HugeGraph graph = (HugeGraph) Proxy.newProxyInstance( + HugeGraph.class.getClassLoader(), new Class[]{HugeGraph.class}, + (proxy, invokedMethod, args) -> { + if (invokedMethod.getName().equals("initBackend")) { + invocations.incrementAndGet(); + throw exception; + } + return null; + }); + + Method method = InitStore.class.getDeclaredMethod("initBackend", + HugeGraph.class); + method.setAccessible(true); + long start = System.nanoTime(); + try { + method.invoke(null, graph); + Assert.fail("Expected initialization to fail"); + } catch (InvocationTargetException e) { + Assert.assertSame(exception, e.getCause()); + } + long elapsed = (System.nanoTime() - start) / 1_000_000L; + Assert.assertTrue("Expected initialization to fail without retrying", + elapsed < 1000L); + Assert.assertEquals(1, invocations.get()); + } +} diff --git a/hugegraph-struct/src/main/java/org/apache/hugegraph/backend/Shard.java b/hugegraph-struct/src/main/java/org/apache/hugegraph/backend/Shard.java index 7d69166c63..f467aed8f4 100644 --- a/hugegraph-struct/src/main/java/org/apache/hugegraph/backend/Shard.java +++ b/hugegraph-struct/src/main/java/org/apache/hugegraph/backend/Shard.java @@ -20,7 +20,7 @@ package org.apache.hugegraph.backend; /** - * Shard is used for backend storage (like cassandra, hbase) scanning + * Shard is used for backend storage scanning * operations. Each shard represents a range of tokens for a node. * Reading data from a given shard does not cross multiple nodes. */ diff --git a/hugegraph-struct/src/main/java/org/apache/hugegraph/options/CoreOptions.java b/hugegraph-struct/src/main/java/org/apache/hugegraph/options/CoreOptions.java index caf0146bb9..e11f76d349 100644 --- a/hugegraph-struct/src/main/java/org/apache/hugegraph/options/CoreOptions.java +++ b/hugegraph-struct/src/main/java/org/apache/hugegraph/options/CoreOptions.java @@ -47,7 +47,7 @@ public class CoreOptions extends OptionHolder { public static final ConfigOption STORE = new ConfigOption<>( "store", - "The database name like Cassandra Keyspace.", + "The backend database name.", disallowEmpty(), "hugegraph" ); @@ -67,7 +67,7 @@ public class CoreOptions extends OptionHolder { public static final ConfigOption SERIALIZER = new ConfigOption<>( "serializer", - "The serializer for backend store, like: text/binary/cassandra.", + "The serializer for backend store, like: text/binary.", disallowEmpty(), "text" ); diff --git a/hugegraph-struct/src/main/java/org/apache/hugegraph/query/Condition.java b/hugegraph-struct/src/main/java/org/apache/hugegraph/query/Condition.java index 0d1b7ad05b..415405a1bd 100644 --- a/hugegraph-struct/src/main/java/org/apache/hugegraph/query/Condition.java +++ b/hugegraph-struct/src/main/java/org/apache/hugegraph/query/Condition.java @@ -343,7 +343,7 @@ public enum RelationType implements BiPredicate { assert v2 != null; /* * TODO: we still have no way to determine accurately, since - * some backends may scan with token(column) like cassandra. + * some backends may scan using a partition token. */ return true; }); diff --git a/install-dist/release-docs/LICENSE b/install-dist/release-docs/LICENSE index f12f0b0d78..ee47f55e58 100644 --- a/install-dist/release-docs/LICENSE +++ b/install-dist/release-docs/LICENSE @@ -243,7 +243,6 @@ The following components are provided under the CC0 1.0 License. See project lin The text of each license is also included in licenses/LICENSE-[project].txt. https://central.sonatype.com/artifact/org.hdrhistogram/HdrHistogram/2.1.12 -> CC0 1.0 - https://central.sonatype.com/artifact/org.hdrhistogram/HdrHistogram/2.1.9 -> CC0 1.0 ======================================================================== Third party BSD-2-Clause licenses @@ -251,7 +250,6 @@ Third party BSD-2-Clause licenses The following components are provided under the BSD-2-Clause License. See project link for details. The text of each license is also included in licenses/LICENSE-[project].txt. - https://central.sonatype.com/artifact/com.github.luben/zstd-jni/1.5.5-1 -> BSD-2-Clause https://central.sonatype.com/artifact/org.latencyutils/LatencyUtils/2.0.3 -> BSD-2-Clause ======================================================================== @@ -261,8 +259,6 @@ The following components are provided under the Apache 2.0 License. See project Per-component LICENSE-[project].txt files are included only when additional non-Apache-2.0 license text is required for a bundled component. - https://central.sonatype.com/artifact/com.addthis.metrics/reporter-config-base/3.0.3 -> Apache 2.0 - https://central.sonatype.com/artifact/com.addthis.metrics/reporter-config3/3.0.3 -> Apache 2.0 https://central.sonatype.com/artifact/com.alibaba/fastjson/1.2.83 -> Apache 2.0 https://central.sonatype.com/artifact/com.alipay.sofa.common/sofa-common-tools/1.0.12 -> Apache 2.0 https://central.sonatype.com/artifact/com.alipay.sofa.lookout/lookout-api/1.4.1 -> Apache 2.0 @@ -277,9 +273,7 @@ non-Apache-2.0 license text is required for a bundled component. https://central.sonatype.com/artifact/com.alipay.sofa/tracer-core/3.0.8 -> Apache 2.0 https://central.sonatype.com/artifact/com.beust/jcommander/1.30 -> Apache 2.0 https://central.sonatype.com/artifact/com.carrotsearch/hppc/0.7.1 -> Apache 2.0 - https://central.sonatype.com/artifact/com.carrotsearch/hppc/0.8.1 -> Apache 2.0 https://central.sonatype.com/artifact/com.chenlb.mmseg4j/mmseg4j-core/1.10.0 -> Apache 2.0 - https://central.sonatype.com/artifact/com.clearspring.analytics/stream/2.5.2 -> Apache 2.0 https://central.sonatype.com/artifact/com.codahale.metrics/metrics-core/3.0.2 -> Apache 2.0 https://central.sonatype.com/artifact/com.fasterxml.jackson.core/jackson-annotations/2.13.0 -> Apache 2.0 https://central.sonatype.com/artifact/com.fasterxml.jackson.core/jackson-annotations/2.14.0-rc1 -> Apache 2.0 @@ -309,10 +303,7 @@ non-Apache-2.0 license text is required for a bundled component. https://central.sonatype.com/artifact/com.fasterxml.jackson.module/jackson-module-jaxb-annotations/2.15.2 -> Apache 2.0 https://central.sonatype.com/artifact/com.fasterxml.jackson.module/jackson-module-parameter-names/2.12.6 -> Apache 2.0 https://central.sonatype.com/artifact/com.github.ben-manes.caffeine/caffeine/2.3.1 -> Apache 2.0 - https://central.sonatype.com/artifact/com.github.ben-manes.caffeine/caffeine/2.5.6 -> Apache 2.0 https://central.sonatype.com/artifact/com.github.jbellis/jamm/0.3.2 -> Apache 2.0 - https://central.sonatype.com/artifact/com.github.jnr/jffi/1.2.16 -> Apache 2.0 - https://central.sonatype.com/artifact/com.github.jnr/jnr-ffi/2.1.7 -> Apache 2.0 https://central.sonatype.com/artifact/com.github.mifmif/generex/1.0.2 -> Apache 2.0 https://central.sonatype.com/artifact/com.github.stephenc.findbugs/findbugs-annotations/1.3.9-1 -> Apache 2.0 https://central.sonatype.com/artifact/com.github.stephenc.jcip/jcip-annotations/1.0-1 -> Apache 2.0 @@ -331,7 +322,6 @@ non-Apache-2.0 license text is required for a bundled component. https://central.sonatype.com/artifact/com.google.errorprone/error_prone_annotations/2.4.0 -> Apache 2.0 https://central.sonatype.com/artifact/com.google.guava/failureaccess/1.0.1 -> Apache 2.0 https://central.sonatype.com/artifact/com.google.guava/guava/25.1-jre -> Apache 2.0 - https://central.sonatype.com/artifact/com.google.guava/guava/27.0-jre -> Apache 2.0 https://central.sonatype.com/artifact/com.google.guava/guava/30.0-jre -> Apache 2.0 https://central.sonatype.com/artifact/com.google.guava/guava/30.1-android -> Apache 2.0 https://central.sonatype.com/artifact/com.google.guava/guava/31.0.1-android -> Apache 2.0 @@ -340,8 +330,6 @@ non-Apache-2.0 license text is required for a bundled component. https://central.sonatype.com/artifact/com.google.j2objc/j2objc-annotations/1.1 -> Apache 2.0 https://central.sonatype.com/artifact/com.google.j2objc/j2objc-annotations/1.3 -> Apache 2.0 https://central.sonatype.com/artifact/com.google.j2objc/j2objc-annotations/2.8 -> Apache 2.0 - https://central.sonatype.com/artifact/com.googlecode.concurrent-trees/concurrent-trees/2.4.0 -> Apache 2.0 - https://central.sonatype.com/artifact/com.googlecode.json-simple/json-simple/1.1 -> Apache 2.0 https://central.sonatype.com/artifact/com.hankcs/hanlp/portable-1.8.3 -> Apache 2.0 https://central.sonatype.com/artifact/com.huaban/jieba-analysis/1.0.2 -> Apache 2.0 https://central.sonatype.com/artifact/com.janeluo/ikanalyzer/2012_u6 -> Apache 2.0 @@ -362,11 +350,8 @@ non-Apache-2.0 license text is required for a bundled component. https://central.sonatype.com/artifact/com.taobao.arthas/arthas-packaging/3.7.1 -> Apache 2.0 https://central.sonatype.com/artifact/com.vaadin.external.google/android-json/0.0.20131108.vaadin1 -> Apache 2.0 https://central.sonatype.com/artifact/commons-beanutils/commons-beanutils/1.9.4 -> Apache 2.0 - https://central.sonatype.com/artifact/commons-cli/commons-cli/1.1 -> Apache 2.0 - https://central.sonatype.com/artifact/commons-codec/commons-codec/1.11 -> Apache 2.0 https://central.sonatype.com/artifact/commons-codec/commons-codec/1.13 -> Apache 2.0 https://central.sonatype.com/artifact/commons-codec/commons-codec/1.15 -> Apache 2.0 - https://central.sonatype.com/artifact/commons-codec/commons-codec/1.9 -> Apache 2.0 https://central.sonatype.com/artifact/commons-collections/commons-collections/3.2.2 -> Apache 2.0 https://central.sonatype.com/artifact/commons-configuration/commons-configuration/1.10 -> Apache 2.0 https://central.sonatype.com/artifact/commons-io/commons-io/2.12.0 -> Apache 2.0 @@ -376,14 +361,10 @@ non-Apache-2.0 license text is required for a bundled component. https://central.sonatype.com/artifact/commons-logging/commons-logging/1.1.1 -> Apache 2.0 https://central.sonatype.com/artifact/commons-logging/commons-logging/1.2 -> Apache 2.0 https://central.sonatype.com/artifact/info.picocli/picocli/4.3.2 -> Apache 2.0 - https://central.sonatype.com/artifact/io.airlift/airline/0.8 -> Apache 2.0 https://central.sonatype.com/artifact/io.dropwizard.metrics/metrics-annotation/4.2.4 -> Apache 2.0 - https://central.sonatype.com/artifact/io.dropwizard.metrics/metrics-core/3.1.5 -> Apache 2.0 https://central.sonatype.com/artifact/io.dropwizard.metrics/metrics-core/4.0.2 -> Apache 2.0 https://central.sonatype.com/artifact/io.dropwizard.metrics/metrics-core/4.2.4 -> Apache 2.0 https://central.sonatype.com/artifact/io.dropwizard.metrics/metrics-jersey3/4.2.4 -> Apache 2.0 - https://central.sonatype.com/artifact/io.dropwizard.metrics/metrics-jvm/3.1.5 -> Apache 2.0 - https://central.sonatype.com/artifact/io.dropwizard.metrics/metrics-logback/3.1.5 -> Apache 2.0 https://central.sonatype.com/artifact/io.etcd/jetcd-common/0.5.9 -> Apache 2.0 https://central.sonatype.com/artifact/io.etcd/jetcd-core/0.5.9 -> Apache 2.0 https://central.sonatype.com/artifact/io.fabric8/kubernetes-client/5.6.0 -> Apache 2.0 @@ -440,7 +421,6 @@ non-Apache-2.0 license text is required for a bundled component. https://central.sonatype.com/artifact/io.micrometer/micrometer-core/1.7.12 -> Apache 2.0 https://central.sonatype.com/artifact/io.micrometer/micrometer-registry-prometheus/1.7.12 -> Apache 2.0 https://central.sonatype.com/artifact/io.netty/netty-all/4.1.42.Final -> Apache 2.0 - https://central.sonatype.com/artifact/io.netty/netty-all/4.1.44.Final -> Apache 2.0 https://central.sonatype.com/artifact/io.netty/netty-all/4.1.61.Final -> Apache 2.0 https://central.sonatype.com/artifact/io.netty/netty-buffer/4.1.52.Final -> Apache 2.0 https://central.sonatype.com/artifact/io.netty/netty-buffer/4.1.72.Final -> Apache 2.0 @@ -461,7 +441,6 @@ non-Apache-2.0 license text is required for a bundled component. https://central.sonatype.com/artifact/io.netty/netty-resolver/4.1.52.Final -> Apache 2.0 https://central.sonatype.com/artifact/io.netty/netty-resolver/4.1.72.Final -> Apache 2.0 https://central.sonatype.com/artifact/io.netty/netty-tcnative-boringssl-static/2.0.25.Final -> Apache 2.0 - https://central.sonatype.com/artifact/io.netty/netty-tcnative-boringssl-static/2.0.36.Final -> Apache 2.0 https://central.sonatype.com/artifact/io.netty/netty-tcnative-classes/2.0.46.Final -> Apache 2.0 https://central.sonatype.com/artifact/io.netty/netty-transport-native-unix-common/4.1.72.Final -> Apache 2.0 https://central.sonatype.com/artifact/io.netty/netty-transport/4.1.52.Final -> Apache 2.0 @@ -491,7 +470,6 @@ non-Apache-2.0 license text is required for a bundled component. https://central.sonatype.com/artifact/it.unimi.dsi/fastutil/8.5.9 -> Apache 2.0 https://central.sonatype.com/artifact/jakarta.inject/jakarta.inject-api/2.0.0 -> Apache 2.0 https://central.sonatype.com/artifact/jakarta.validation/jakarta.validation-api/3.0.0 -> Apache 2.0 - https://central.sonatype.com/artifact/javax.inject/javax.inject/1 -> Apache 2.0 https://central.sonatype.com/artifact/javax.validation/validation-api/1.1.0.Final -> Apache 2.0 https://central.sonatype.com/artifact/joda-time/joda-time/2.10.8 -> Apache 2.0 https://central.sonatype.com/artifact/net.bytebuddy/byte-buddy-agent/1.10.20 -> Apache 2.0 @@ -506,20 +484,13 @@ non-Apache-2.0 license text is required for a bundled component. https://central.sonatype.com/artifact/net.minidev/accessors-smart/1.2 -> Apache 2.0 https://central.sonatype.com/artifact/net.minidev/json-smart/2.3 -> Apache 2.0 https://central.sonatype.com/artifact/net.objecthunter/exp4j/0.4.8 -> Apache 2.0 - https://central.sonatype.com/artifact/net.openhft/chronicle-bytes/2.20.111 -> Apache 2.0 - https://central.sonatype.com/artifact/net.openhft/chronicle-core/2.20.126 -> Apache 2.0 - https://central.sonatype.com/artifact/net.openhft/chronicle-queue/5.20.123 -> Apache 2.0 - https://central.sonatype.com/artifact/net.openhft/chronicle-threads/2.20.111 -> Apache 2.0 - https://central.sonatype.com/artifact/net.openhft/chronicle-wire/2.20.117 -> Apache 2.0 https://central.sonatype.com/artifact/org.ansj/ansj_seg/5.1.6 -> Apache 2.0 https://central.sonatype.com/artifact/org.apache.commons/commons-collections4/4.4 -> Apache 2.0 https://central.sonatype.com/artifact/org.apache.commons/commons-compress/1.21 -> Apache 2.0 https://central.sonatype.com/artifact/org.apache.commons/commons-configuration2/2.8.0 -> Apache 2.0 - https://central.sonatype.com/artifact/org.apache.commons/commons-lang3/3.11 -> Apache 2.0 https://central.sonatype.com/artifact/org.apache.commons/commons-lang3/3.12.0 -> Apache 2.0 https://central.sonatype.com/artifact/org.apache.commons/commons-lang3/3.13.0 -> Apache 2.0 https://central.sonatype.com/artifact/org.apache.commons/commons-lang3/3.18.0 -> Apache 2.0 - https://central.sonatype.com/artifact/org.apache.commons/commons-math3/3.2 -> Apache 2.0 https://central.sonatype.com/artifact/org.apache.commons/commons-pool2/2.0 -> Apache 2.0 https://central.sonatype.com/artifact/org.apache.commons/commons-text/1.10.0 -> Apache 2.0 https://central.sonatype.com/artifact/org.apache.commons/commons-text/1.9 -> Apache 2.0 @@ -603,7 +574,6 @@ non-Apache-2.0 license text is required for a bundled component. https://central.sonatype.com/artifact/org.apache.yetus/audience-annotations/0.5.0 -> Apache 2.0 https://central.sonatype.com/artifact/org.apiguardian/apiguardian-api/1.1.0 -> Apache 2.0 https://central.sonatype.com/artifact/org.assertj/assertj-core/3.19.0 -> Apache 2.0 - https://central.sonatype.com/artifact/org.caffinitas.ohc/ohc-core-j8/0.5.1 -> Apache 2.0 https://central.sonatype.com/artifact/org.caffinitas.ohc/ohc-core/0.7.4 -> Apache 2.0 https://central.sonatype.com/artifact/org.codehaus.groovy/groovy-cli-picocli/2.5.14 -> Apache 2.0 https://central.sonatype.com/artifact/org.codehaus.groovy/groovy-console/2.5.14 -> Apache 2.0 @@ -635,17 +605,11 @@ non-Apache-2.0 license text is required for a bundled component. https://central.sonatype.com/artifact/org.eclipse.jetty/jetty-util/9.4.46.v20220331 -> Apache 2.0 https://central.sonatype.com/artifact/org.eclipse.jetty/jetty-webapp/9.4.46.v20220331 -> Apache 2.0 https://central.sonatype.com/artifact/org.eclipse.jetty/jetty-xml/9.4.46.v20220331 -> Apache 2.0 - https://central.sonatype.com/artifact/org.fusesource/sigar/1.6.4 -> Apache 2.0 - https://central.sonatype.com/artifact/org.gridkit.jvmtool/mxdump/0.14 -> Apache 2.0 https://central.sonatype.com/artifact/org.gridkit.jvmtool/sjk-agent/0.22 -> Apache 2.0 - https://central.sonatype.com/artifact/org.gridkit.jvmtool/sjk-cli/0.14 -> Apache 2.0 https://central.sonatype.com/artifact/org.gridkit.jvmtool/sjk-cli/0.22 -> Apache 2.0 - https://central.sonatype.com/artifact/org.gridkit.jvmtool/sjk-core/0.14 -> Apache 2.0 https://central.sonatype.com/artifact/org.gridkit.jvmtool/sjk-core/0.22 -> Apache 2.0 https://central.sonatype.com/artifact/org.gridkit.jvmtool/sjk-hflame/0.22 -> Apache 2.0 - https://central.sonatype.com/artifact/org.gridkit.jvmtool/sjk-json/0.14 -> Apache 2.0 https://central.sonatype.com/artifact/org.gridkit.jvmtool/sjk-json/0.22 -> Apache 2.0 - https://central.sonatype.com/artifact/org.gridkit.jvmtool/sjk-stacktrace/0.14 -> Apache 2.0 https://central.sonatype.com/artifact/org.gridkit.jvmtool/sjk-stacktrace/0.22 -> Apache 2.0 https://central.sonatype.com/artifact/org.gridkit.lab/jvm-attach-api/1.5 -> Apache 2.0 https://central.sonatype.com/artifact/org.javassist/javassist/3.21.0-GA -> Apache 2.0 @@ -653,7 +617,6 @@ non-Apache-2.0 license text is required for a bundled component. https://central.sonatype.com/artifact/org.javassist/javassist/3.28.0-GA -> Apache 2.0 https://central.sonatype.com/artifact/org.javatuples/javatuples/1.2 -> Apache 2.0 https://central.sonatype.com/artifact/org.jctools/jctools-core/2.1.1 -> Apache 2.0 - https://central.sonatype.com/artifact/org.jctools/jctools-core/3.1.0 -> Apache 2.0 https://central.sonatype.com/artifact/org.jetbrains.kotlin/kotlin-stdlib-common/1.5.31 -> Apache 2.0 https://central.sonatype.com/artifact/org.jetbrains.kotlin/kotlin-stdlib-jdk7/1.6.10 -> Apache 2.0 https://central.sonatype.com/artifact/org.jetbrains.kotlin/kotlin-stdlib-jdk8/1.6.10 -> Apache 2.0 @@ -729,7 +692,6 @@ non-Apache-2.0 license text is required for a bundled component. https://central.sonatype.com/artifact/org.springframework/spring-jcl/5.3.27 -> Apache 2.0 https://central.sonatype.com/artifact/org.springframework/spring-web/5.3.20 -> Apache 2.0 https://central.sonatype.com/artifact/org.springframework/spring-webmvc/5.3.20 -> Apache 2.0 - https://central.sonatype.com/artifact/org.xerial.snappy/snappy-java/1.1.2.6 -> Apache 2.0 https://central.sonatype.com/artifact/org.xmlunit/xmlunit-core/2.8.4 -> Apache 2.0 https://central.sonatype.com/artifact/org.yaml/snakeyaml/1.18 -> Apache 2.0 https://central.sonatype.com/artifact/org.yaml/snakeyaml/1.26 -> Apache 2.0 @@ -745,23 +707,14 @@ The following components are provided under the BSD License. See project link fo The text of each license is also included in licenses/LICENSE-[project].txt. https://central.sonatype.com/artifact/com.belerweb/pinyin4j/2.5.0 -> BSD - https://central.sonatype.com/artifact/com.github.rholder/snowball-stemmer/1.3.0.581.1 -> BSD https://central.sonatype.com/artifact/com.jcabi/jcabi-log/0.14 -> BSD https://central.sonatype.com/artifact/com.jcabi/jcabi-manifests/1.1 -> BSD https://central.sonatype.com/artifact/com.thoughtworks.xstream/xstream/1.4.10 -> BSD - https://central.sonatype.com/artifact/de.jflex/jflex/1.8.2 -> BSD https://central.sonatype.com/artifact/dk.brics.automaton/automaton/1.11-8 -> BSD https://central.sonatype.com/artifact/jline/jline/2.14.6 -> BSD - https://central.sonatype.com/artifact/org.antlr/ST4/4.0.8 -> BSD - https://central.sonatype.com/artifact/org.antlr/antlr-runtime/3.5.2 -> BSD https://central.sonatype.com/artifact/org.hamcrest/hamcrest-core/1.3 -> BSD - https://central.sonatype.com/artifact/org.ow2.asm/asm-analysis/5.0.3 -> BSD - https://central.sonatype.com/artifact/org.ow2.asm/asm-commons/5.0.3 -> BSD - https://central.sonatype.com/artifact/org.ow2.asm/asm-tree/5.0.3 -> BSD - https://central.sonatype.com/artifact/org.ow2.asm/asm-util/5.0.3 -> BSD https://central.sonatype.com/artifact/org.ow2.asm/asm/5.0.4 -> BSD https://central.sonatype.com/artifact/org.ow2.asm/asm/6.0 -> BSD - https://central.sonatype.com/artifact/org.ow2.asm/asm/7.1 -> BSD ======================================================================== Third party MIT licenses @@ -769,8 +722,6 @@ Third party MIT licenses The following components are provided under the MIT License. See project link for details. The text of each license is also included in licenses/LICENSE-[project].txt. - https://central.sonatype.com/artifact/com.boundary/high-scale-lib/1.0.6 -> MIT - https://central.sonatype.com/artifact/com.github.jnr/jnr-x86asm/1.0.2 -> MIT https://central.sonatype.com/artifact/com.lihaoyi/fastparse_2.12/2.0.4 -> MIT https://central.sonatype.com/artifact/com.lihaoyi/sourcecode_2.12/0.1.4 -> MIT https://central.sonatype.com/artifact/io.github.classgraph/classgraph/4.8.162 -> MIT @@ -786,7 +737,6 @@ The text of each license is also included in licenses/LICENSE-[project].txt. https://central.sonatype.com/artifact/org.mockito/mockito-core/3.9.0 -> MIT https://central.sonatype.com/artifact/org.mockito/mockito-junit-jupiter/3.9.0 -> MIT https://central.sonatype.com/artifact/org.projectlombok/lombok/1.18.24 -> MIT - https://central.sonatype.com/artifact/org.psjava/psjava/0.1.19 -> MIT https://central.sonatype.com/artifact/org.slf4j/jcl-over-slf4j/1.7.25 -> MIT https://central.sonatype.com/artifact/org.slf4j/jul-to-slf4j/1.7.36 -> MIT https://central.sonatype.com/artifact/org.slf4j/slf4j-api/1.7.21 -> MIT @@ -881,7 +831,6 @@ Third party Historical Permission Notice and Disclaimer licenses The following components are provided under the Historical Permission Notice and Disclaimer License. See project link for details. The text of each license is also included in licenses/LICENSE-[project].txt. - https://central.sonatype.com/artifact/com.github.vbmacher/java-cup-runtime/11b-20160615 -> Historical Permission Notice and Disclaimer ======================================================================== Third party CDDL licenses diff --git a/install-dist/release-docs/NOTICE b/install-dist/release-docs/NOTICE index 22ca2676dd..a1de25d4d0 100644 --- a/install-dist/release-docs/NOTICE +++ b/install-dist/release-docs/NOTICE @@ -28,18 +28,6 @@ DataStax) and the following individuals: * Stephen Mallette * Pavel Yaskevich -======================================================================== - -airline NOTICE - -======================================================================== - -Copyright Notices - -Copyright 2011 Dain Sundstrom -Copyright 2010 Cedric Beust - - ======================================================================== animal-sniffer-annotations NOTICE @@ -1054,23 +1042,6 @@ This product includes software developed at The Apache Software Foundation (http://www.apache.org/). -======================================================================== - - Commons-math3 NOTICE - -======================================================================== - -Apache Commons Math -Copyright 2001-2015 The Apache Software Foundation - -This product includes software developed at -The Apache Software Foundation (http://www.apache.org/). - -This product includes software developed for Orekit by -CS Systèmes d'Information (http://www.c-s.fr/) -Copyright 2010-2012 CS Systèmes d'Information - - ======================================================================== Commons-text NOTICE @@ -1442,18 +1413,6 @@ JCommander Copyright Notices Copyright 2010 Cedric Beust -======================================================================== - -jflex NOTICE - -======================================================================== - -JFlex - Copying, Warranty & License - -Copyright (c) Gerwin Klein, Steve Rowe, Régis Décamps, Google LLC. -All rights reserved. - - ======================================================================== junit NOTICE @@ -1750,44 +1709,6 @@ Copyright 2016, Google Inc. All rights reserved. -======================================================================== - -psjava NOTICE - -======================================================================== - -Copyright (c) 2013 psjava authors - - -======================================================================== - -snappy-java NOTICE - -======================================================================== - -This product includes software developed by Google - Snappy: http://code.google.com/p/snappy/ (New BSD License) - -This product includes software developed by Apache - PureJavaCrc32C from apache-hadoop-common http://hadoop.apache.org/ - (Apache 2.0 license) - -This library contains statically linked libstdc++. This inclusion is allowed by -"GCC Runtime Library Exception" -http://gcc.gnu.org/onlinedocs/libstdc++/manual/license.html - -== Contributors == - * Tatu Saloranta - * Providing benchmark suite - * Alec Wysoker - * Performance and memory usage improvement - -Third-Party Notices and Licenses: - -- Hadoop: Apache Hadoop is used as a dependency - License: Apache License 2.0 - Source/Reference: https://github.com/apache/hadoop/blob/trunk/NOTICE.txt - ======================================================================== swagger NOTICE @@ -1800,17 +1721,6 @@ Swagger Core - ${pom.name} is licensed under Apache 2.0 license. Copy of the Apache 2.0 license can be found in `LICENSE` file. -======================================================================== - -zstd-jni NOTICE - -======================================================================== - -Zstd-jni: JNI bindings to Zstd Library - -Copyright (c) 2015-present, Luben Karavelov/ All rights reserved. - - ======================================================================== zt-zip NOTICE diff --git a/install-dist/release-docs/licenses/LICENSE-HdrHistogram-2.1.9.txt b/install-dist/release-docs/licenses/LICENSE-HdrHistogram-2.1.9.txt deleted file mode 100644 index a8e9f77c81..0000000000 --- a/install-dist/release-docs/licenses/LICENSE-HdrHistogram-2.1.9.txt +++ /dev/null @@ -1 +0,0 @@ -http://creativecommons.org/publicdomain/zero/1.0/ diff --git a/install-dist/release-docs/licenses/LICENSE-ST4-4.0.8.txt b/install-dist/release-docs/licenses/LICENSE-ST4-4.0.8.txt deleted file mode 100644 index d6653532df..0000000000 --- a/install-dist/release-docs/licenses/LICENSE-ST4-4.0.8.txt +++ /dev/null @@ -1 +0,0 @@ -http://antlr.org/license.html diff --git a/install-dist/release-docs/licenses/LICENSE-airline-0.8.txt b/install-dist/release-docs/licenses/LICENSE-airline-0.8.txt deleted file mode 100644 index d645695673..0000000000 --- a/install-dist/release-docs/licenses/LICENSE-airline-0.8.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. diff --git a/install-dist/release-docs/licenses/LICENSE-antlr-runtime-3.5.2.txt b/install-dist/release-docs/licenses/LICENSE-antlr-runtime-3.5.2.txt deleted file mode 100644 index a5216ef20a..0000000000 --- a/install-dist/release-docs/licenses/LICENSE-antlr-runtime-3.5.2.txt +++ /dev/null @@ -1,26 +0,0 @@ -[The "BSD license"] -Copyright (c) 2013 Terence Parr -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - 3. The name of the author may not be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/install-dist/release-docs/licenses/LICENSE-asm-7.1.txt b/install-dist/release-docs/licenses/LICENSE-asm-7.1.txt deleted file mode 100644 index c6528b04a7..0000000000 --- a/install-dist/release-docs/licenses/LICENSE-asm-7.1.txt +++ /dev/null @@ -1 +0,0 @@ -http://asm.ow2.org/license.html diff --git a/install-dist/release-docs/licenses/LICENSE-asm-analysis-5.0.3.txt b/install-dist/release-docs/licenses/LICENSE-asm-analysis-5.0.3.txt deleted file mode 100644 index 5e019cf964..0000000000 --- a/install-dist/release-docs/licenses/LICENSE-asm-analysis-5.0.3.txt +++ /dev/null @@ -1,29 +0,0 @@ - diff --git a/install-dist/release-docs/licenses/LICENSE-asm-commons-5.0.3.txt b/install-dist/release-docs/licenses/LICENSE-asm-commons-5.0.3.txt deleted file mode 100644 index 5e019cf964..0000000000 --- a/install-dist/release-docs/licenses/LICENSE-asm-commons-5.0.3.txt +++ /dev/null @@ -1,29 +0,0 @@ - diff --git a/install-dist/release-docs/licenses/LICENSE-asm-tree-5.0.3.txt b/install-dist/release-docs/licenses/LICENSE-asm-tree-5.0.3.txt deleted file mode 100644 index 5e019cf964..0000000000 --- a/install-dist/release-docs/licenses/LICENSE-asm-tree-5.0.3.txt +++ /dev/null @@ -1,29 +0,0 @@ - diff --git a/install-dist/release-docs/licenses/LICENSE-asm-util-5.0.3.txt b/install-dist/release-docs/licenses/LICENSE-asm-util-5.0.3.txt deleted file mode 100644 index 5e019cf964..0000000000 --- a/install-dist/release-docs/licenses/LICENSE-asm-util-5.0.3.txt +++ /dev/null @@ -1,29 +0,0 @@ - diff --git a/install-dist/release-docs/licenses/LICENSE-caffeine-2.5.6.txt b/install-dist/release-docs/licenses/LICENSE-caffeine-2.5.6.txt deleted file mode 100644 index d645695673..0000000000 --- a/install-dist/release-docs/licenses/LICENSE-caffeine-2.5.6.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. diff --git a/install-dist/release-docs/licenses/LICENSE-chronicle-bytes-2.20.111.txt b/install-dist/release-docs/licenses/LICENSE-chronicle-bytes-2.20.111.txt deleted file mode 100644 index d645695673..0000000000 --- a/install-dist/release-docs/licenses/LICENSE-chronicle-bytes-2.20.111.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. diff --git a/install-dist/release-docs/licenses/LICENSE-chronicle-core-2.20.126.txt b/install-dist/release-docs/licenses/LICENSE-chronicle-core-2.20.126.txt deleted file mode 100644 index d645695673..0000000000 --- a/install-dist/release-docs/licenses/LICENSE-chronicle-core-2.20.126.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. diff --git a/install-dist/release-docs/licenses/LICENSE-chronicle-queue-5.20.123.txt b/install-dist/release-docs/licenses/LICENSE-chronicle-queue-5.20.123.txt deleted file mode 100644 index d645695673..0000000000 --- a/install-dist/release-docs/licenses/LICENSE-chronicle-queue-5.20.123.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. diff --git a/install-dist/release-docs/licenses/LICENSE-chronicle-threads-2.20.111.txt b/install-dist/release-docs/licenses/LICENSE-chronicle-threads-2.20.111.txt deleted file mode 100644 index d645695673..0000000000 --- a/install-dist/release-docs/licenses/LICENSE-chronicle-threads-2.20.111.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. diff --git a/install-dist/release-docs/licenses/LICENSE-chronicle-wire-2.20.117.txt b/install-dist/release-docs/licenses/LICENSE-chronicle-wire-2.20.117.txt deleted file mode 100644 index d645695673..0000000000 --- a/install-dist/release-docs/licenses/LICENSE-chronicle-wire-2.20.117.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. diff --git a/install-dist/release-docs/licenses/LICENSE-commons-cli-1.1.txt b/install-dist/release-docs/licenses/LICENSE-commons-cli-1.1.txt deleted file mode 100644 index 57bc88a15a..0000000000 --- a/install-dist/release-docs/licenses/LICENSE-commons-cli-1.1.txt +++ /dev/null @@ -1,202 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. - diff --git a/install-dist/release-docs/licenses/LICENSE-commons-codec-1.11.txt b/install-dist/release-docs/licenses/LICENSE-commons-codec-1.11.txt deleted file mode 100644 index 75b52484ea..0000000000 --- a/install-dist/release-docs/licenses/LICENSE-commons-codec-1.11.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. diff --git a/install-dist/release-docs/licenses/LICENSE-commons-codec-1.9.txt b/install-dist/release-docs/licenses/LICENSE-commons-codec-1.9.txt deleted file mode 100644 index 75b52484ea..0000000000 --- a/install-dist/release-docs/licenses/LICENSE-commons-codec-1.9.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. diff --git a/install-dist/release-docs/licenses/LICENSE-commons-lang3-3.11.txt b/install-dist/release-docs/licenses/LICENSE-commons-lang3-3.11.txt deleted file mode 100644 index d645695673..0000000000 --- a/install-dist/release-docs/licenses/LICENSE-commons-lang3-3.11.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. diff --git a/install-dist/release-docs/licenses/LICENSE-commons-math3-3.2.txt b/install-dist/release-docs/licenses/LICENSE-commons-math3-3.2.txt deleted file mode 100644 index 0333373a6a..0000000000 --- a/install-dist/release-docs/licenses/LICENSE-commons-math3-3.2.txt +++ /dev/null @@ -1,387 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. - - -APACHE COMMONS MATH DERIVATIVE WORKS: - -The Apache commons-math library includes a number of subcomponents -whose implementation is derived from original sources written -in C or Fortran. License terms of the original sources -are reproduced below. - -=============================================================================== -For the lmder, lmpar and qrsolv Fortran routine from minpack and translated in -the LevenbergMarquardtOptimizer class in package -org.apache.commons.math3.optimization.general -Original source copyright and license statement: - -Minpack Copyright Notice (1999) University of Chicago. All rights reserved - -Redistribution and use in source and binary forms, with or -without modification, are permitted provided that the -following conditions are met: - -1. Redistributions of source code must retain the above -copyright notice, this list of conditions and the following -disclaimer. - -2. Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following -disclaimer in the documentation and/or other materials -provided with the distribution. - -3. The end-user documentation included with the -redistribution, if any, must include the following -acknowledgment: - - "This product includes software developed by the - University of Chicago, as Operator of Argonne National - Laboratory. - -Alternately, this acknowledgment may appear in the software -itself, if and wherever such third-party acknowledgments -normally appear. - -4. WARRANTY DISCLAIMER. THE SOFTWARE IS SUPPLIED "AS IS" -WITHOUT WARRANTY OF ANY KIND. THE COPYRIGHT HOLDER, THE -UNITED STATES, THE UNITED STATES DEPARTMENT OF ENERGY, AND -THEIR EMPLOYEES: (1) DISCLAIM ANY WARRANTIES, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO ANY IMPLIED WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE -OR NON-INFRINGEMENT, (2) DO NOT ASSUME ANY LEGAL LIABILITY -OR RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR -USEFULNESS OF THE SOFTWARE, (3) DO NOT REPRESENT THAT USE OF -THE SOFTWARE WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS, (4) -DO NOT WARRANT THAT THE SOFTWARE WILL FUNCTION -UNINTERRUPTED, THAT IT IS ERROR-FREE OR THAT ANY ERRORS WILL -BE CORRECTED. - -5. LIMITATION OF LIABILITY. IN NO EVENT WILL THE COPYRIGHT -HOLDER, THE UNITED STATES, THE UNITED STATES DEPARTMENT OF -ENERGY, OR THEIR EMPLOYEES: BE LIABLE FOR ANY INDIRECT, -INCIDENTAL, CONSEQUENTIAL, SPECIAL OR PUNITIVE DAMAGES OF -ANY KIND OR NATURE, INCLUDING BUT NOT LIMITED TO LOSS OF -PROFITS OR LOSS OF DATA, FOR ANY REASON WHATSOEVER, WHETHER -SUCH LIABILITY IS ASSERTED ON THE BASIS OF CONTRACT, TORT -(INCLUDING NEGLIGENCE OR STRICT LIABILITY), OR OTHERWISE, -EVEN IF ANY OF SAID PARTIES HAS BEEN WARNED OF THE -POSSIBILITY OF SUCH LOSS OR DAMAGES. -=============================================================================== - -Copyright and license statement for the odex Fortran routine developed by -E. Hairer and G. Wanner and translated in GraggBulirschStoerIntegrator class -in package org.apache.commons.math3.ode.nonstiff: - - -Copyright (c) 2004, Ernst Hairer - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -- Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - -- Redistributions in binary form must reproduce the above copyright -notice, this list of conditions and the following disclaimer in the -documentation and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -=============================================================================== - -Copyright and license statement for the original lapack fortran routines -translated in EigenDecompositionImpl class in package -org.apache.commons.math3.linear: - -Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. - -$COPYRIGHT$ - -Additional copyrights may follow - -$HEADER$ - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -- Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -- Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer listed - in this license in the documentation and/or other materials - provided with the distribution. - -- Neither the name of the copyright holders nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -=============================================================================== - -Copyright and license statement for the original Mersenne twister C -routines translated in MersenneTwister class in package -org.apache.commons.math3.random: - - Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - 3. The names of its contributors may not be used to endorse or promote - products derived from this software without specific prior written - permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=============================================================================== - -The class "org.apache.commons.math3.exception.util.LocalizedFormatsTest" is -an adapted version of "OrekitMessagesTest" test class for the Orekit library -The "org.apache.commons.math3.analysis.interpolation.HermiteInterpolator" -has been imported from the Orekit space flight dynamics library. - -Th Orekit library is described at: - https://www.orekit.org/forge/projects/orekit -The original files are distributed under the terms of the Apache 2 license -which is: Copyright 2010 CS Communication & Systèmes diff --git a/install-dist/release-docs/licenses/LICENSE-concurrent-trees-2.4.0.txt b/install-dist/release-docs/licenses/LICENSE-concurrent-trees-2.4.0.txt deleted file mode 100644 index d645695673..0000000000 --- a/install-dist/release-docs/licenses/LICENSE-concurrent-trees-2.4.0.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. diff --git a/install-dist/release-docs/licenses/LICENSE-guava-27.0-jre.txt b/install-dist/release-docs/licenses/LICENSE-guava-27.0-jre.txt deleted file mode 100644 index d645695673..0000000000 --- a/install-dist/release-docs/licenses/LICENSE-guava-27.0-jre.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. diff --git a/install-dist/release-docs/licenses/LICENSE-high-scale-lib-1.0.6.txt b/install-dist/release-docs/licenses/LICENSE-high-scale-lib-1.0.6.txt deleted file mode 100644 index 0f0efd7fa5..0000000000 --- a/install-dist/release-docs/licenses/LICENSE-high-scale-lib-1.0.6.txt +++ /dev/null @@ -1 +0,0 @@ -http://www.opensource.org/licenses/mit-license.php diff --git a/install-dist/release-docs/licenses/LICENSE-hppc-0.8.1.txt b/install-dist/release-docs/licenses/LICENSE-hppc-0.8.1.txt deleted file mode 100644 index d645695673..0000000000 --- a/install-dist/release-docs/licenses/LICENSE-hppc-0.8.1.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. diff --git a/install-dist/release-docs/licenses/LICENSE-java-cup-runtime-11b-20160615.txt b/install-dist/release-docs/licenses/LICENSE-java-cup-runtime-11b-20160615.txt deleted file mode 100644 index f6160bc4f9..0000000000 --- a/install-dist/release-docs/licenses/LICENSE-java-cup-runtime-11b-20160615.txt +++ /dev/null @@ -1,7 +0,0 @@ -CUP Parser Generator Copyright Notice, License, and Disclaimer -Copyright 1996-2015 by Scott Hudson, Frank Flannery, C. Scott Ananian, Michael Petter - -Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both the copyright notice and this permission notice and warranty disclaimer appear in supporting documentation, and that the names of the authors or their employers not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. - -The authors and their employers disclaim all warranties with regard to this software, including all implied warranties of merchantability and fitness. In no event shall the authors or their employers be liable for any special, indirect or consequential damages or any damages whatsoever resulting from loss of use, data or profits, whether in an action of contract, negligence or other tortious action, arising out of or in connection with the use or performance of this software. -This is an open source [license](https://opensource.org/license/historical-php/). diff --git a/install-dist/release-docs/licenses/LICENSE-javax.inject-1.txt b/install-dist/release-docs/licenses/LICENSE-javax.inject-1.txt deleted file mode 100644 index d645695673..0000000000 --- a/install-dist/release-docs/licenses/LICENSE-javax.inject-1.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. diff --git a/install-dist/release-docs/licenses/LICENSE-jctools-core-3.1.0.txt b/install-dist/release-docs/licenses/LICENSE-jctools-core-3.1.0.txt deleted file mode 100644 index d645695673..0000000000 --- a/install-dist/release-docs/licenses/LICENSE-jctools-core-3.1.0.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. diff --git a/install-dist/release-docs/licenses/LICENSE-jffi-1.2.16-native.txt b/install-dist/release-docs/licenses/LICENSE-jffi-1.2.16-native.txt deleted file mode 100644 index d645695673..0000000000 --- a/install-dist/release-docs/licenses/LICENSE-jffi-1.2.16-native.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. diff --git a/install-dist/release-docs/licenses/LICENSE-jffi-1.2.16.txt b/install-dist/release-docs/licenses/LICENSE-jffi-1.2.16.txt deleted file mode 100644 index d645695673..0000000000 --- a/install-dist/release-docs/licenses/LICENSE-jffi-1.2.16.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. diff --git a/install-dist/release-docs/licenses/LICENSE-jflex-1.8.2.txt b/install-dist/release-docs/licenses/LICENSE-jflex-1.8.2.txt deleted file mode 100644 index 8f3b927ffa..0000000000 --- a/install-dist/release-docs/licenses/LICENSE-jflex-1.8.2.txt +++ /dev/null @@ -1,21 +0,0 @@ -JFlex - Copying, Warranty & License -=================================== - -JFlex is free software, since version 1.5 published under the terms of this -3-clause BSD-style license. - -There is absolutely NO WARRANTY for JFlex, its code and its documentation. - - - -Copyright (c) Gerwin Klein, Steve Rowe, Régis Decamps. -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the names of the authors nor the names of JFlex contributors may be used to endorse or promote products derived from this software without specific prior written permission. - - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/install-dist/release-docs/licenses/LICENSE-jnr-ffi-2.1.7.txt b/install-dist/release-docs/licenses/LICENSE-jnr-ffi-2.1.7.txt deleted file mode 100644 index d645695673..0000000000 --- a/install-dist/release-docs/licenses/LICENSE-jnr-ffi-2.1.7.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. diff --git a/install-dist/release-docs/licenses/LICENSE-jnr-x86asm-1.0.2.txt b/install-dist/release-docs/licenses/LICENSE-jnr-x86asm-1.0.2.txt deleted file mode 100644 index 0f0efd7fa5..0000000000 --- a/install-dist/release-docs/licenses/LICENSE-jnr-x86asm-1.0.2.txt +++ /dev/null @@ -1 +0,0 @@ -http://www.opensource.org/licenses/mit-license.php diff --git a/install-dist/release-docs/licenses/LICENSE-json-simple-1.1.txt b/install-dist/release-docs/licenses/LICENSE-json-simple-1.1.txt deleted file mode 100644 index d645695673..0000000000 --- a/install-dist/release-docs/licenses/LICENSE-json-simple-1.1.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. diff --git a/install-dist/release-docs/licenses/LICENSE-metrics-core-3.1.5.txt b/install-dist/release-docs/licenses/LICENSE-metrics-core-3.1.5.txt deleted file mode 100644 index d645695673..0000000000 --- a/install-dist/release-docs/licenses/LICENSE-metrics-core-3.1.5.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. diff --git a/install-dist/release-docs/licenses/LICENSE-metrics-jvm-3.1.5.txt b/install-dist/release-docs/licenses/LICENSE-metrics-jvm-3.1.5.txt deleted file mode 100644 index d645695673..0000000000 --- a/install-dist/release-docs/licenses/LICENSE-metrics-jvm-3.1.5.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. diff --git a/install-dist/release-docs/licenses/LICENSE-metrics-logback-3.1.5.txt b/install-dist/release-docs/licenses/LICENSE-metrics-logback-3.1.5.txt deleted file mode 100644 index d645695673..0000000000 --- a/install-dist/release-docs/licenses/LICENSE-metrics-logback-3.1.5.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. diff --git a/install-dist/release-docs/licenses/LICENSE-mxdump-0.14.txt b/install-dist/release-docs/licenses/LICENSE-mxdump-0.14.txt deleted file mode 100644 index d645695673..0000000000 --- a/install-dist/release-docs/licenses/LICENSE-mxdump-0.14.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. diff --git a/install-dist/release-docs/licenses/LICENSE-netty-all-4.1.44.Final.txt b/install-dist/release-docs/licenses/LICENSE-netty-all-4.1.44.Final.txt deleted file mode 100644 index d645695673..0000000000 --- a/install-dist/release-docs/licenses/LICENSE-netty-all-4.1.44.Final.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. diff --git a/install-dist/release-docs/licenses/LICENSE-netty-tcnative-boringssl-static-2.0.36.Final.txt b/install-dist/release-docs/licenses/LICENSE-netty-tcnative-boringssl-static-2.0.36.Final.txt deleted file mode 100644 index 261eeb9e9f..0000000000 --- a/install-dist/release-docs/licenses/LICENSE-netty-tcnative-boringssl-static-2.0.36.Final.txt +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. diff --git a/install-dist/release-docs/licenses/LICENSE-ohc-core-j8-0.5.1.txt b/install-dist/release-docs/licenses/LICENSE-ohc-core-j8-0.5.1.txt deleted file mode 100644 index d645695673..0000000000 --- a/install-dist/release-docs/licenses/LICENSE-ohc-core-j8-0.5.1.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. diff --git a/install-dist/release-docs/licenses/LICENSE-psjava-0.1.19.txt b/install-dist/release-docs/licenses/LICENSE-psjava-0.1.19.txt deleted file mode 100644 index a82040a188..0000000000 --- a/install-dist/release-docs/licenses/LICENSE-psjava-0.1.19.txt +++ /dev/null @@ -1 +0,0 @@ -http://opensource.org/licenses/MIT diff --git a/install-dist/release-docs/licenses/LICENSE-reporter-config-base-3.0.3.txt b/install-dist/release-docs/licenses/LICENSE-reporter-config-base-3.0.3.txt deleted file mode 100644 index d645695673..0000000000 --- a/install-dist/release-docs/licenses/LICENSE-reporter-config-base-3.0.3.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. diff --git a/install-dist/release-docs/licenses/LICENSE-reporter-config3-3.0.3.txt b/install-dist/release-docs/licenses/LICENSE-reporter-config3-3.0.3.txt deleted file mode 100644 index d645695673..0000000000 --- a/install-dist/release-docs/licenses/LICENSE-reporter-config3-3.0.3.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. diff --git a/install-dist/release-docs/licenses/LICENSE-sigar-1.6.4.txt b/install-dist/release-docs/licenses/LICENSE-sigar-1.6.4.txt deleted file mode 100644 index d645695673..0000000000 --- a/install-dist/release-docs/licenses/LICENSE-sigar-1.6.4.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. diff --git a/install-dist/release-docs/licenses/LICENSE-sjk-cli-0.14.txt b/install-dist/release-docs/licenses/LICENSE-sjk-cli-0.14.txt deleted file mode 100644 index d645695673..0000000000 --- a/install-dist/release-docs/licenses/LICENSE-sjk-cli-0.14.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. diff --git a/install-dist/release-docs/licenses/LICENSE-sjk-core-0.14.txt b/install-dist/release-docs/licenses/LICENSE-sjk-core-0.14.txt deleted file mode 100644 index d645695673..0000000000 --- a/install-dist/release-docs/licenses/LICENSE-sjk-core-0.14.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. diff --git a/install-dist/release-docs/licenses/LICENSE-sjk-json-0.14.txt b/install-dist/release-docs/licenses/LICENSE-sjk-json-0.14.txt deleted file mode 100644 index d645695673..0000000000 --- a/install-dist/release-docs/licenses/LICENSE-sjk-json-0.14.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. diff --git a/install-dist/release-docs/licenses/LICENSE-sjk-stacktrace-0.14.txt b/install-dist/release-docs/licenses/LICENSE-sjk-stacktrace-0.14.txt deleted file mode 100644 index d645695673..0000000000 --- a/install-dist/release-docs/licenses/LICENSE-sjk-stacktrace-0.14.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. diff --git a/install-dist/release-docs/licenses/LICENSE-snappy-java-1.1.2.6.txt b/install-dist/release-docs/licenses/LICENSE-snappy-java-1.1.2.6.txt deleted file mode 100644 index d645695673..0000000000 --- a/install-dist/release-docs/licenses/LICENSE-snappy-java-1.1.2.6.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. diff --git a/install-dist/release-docs/licenses/LICENSE-snowball-stemmer-1.3.0.581.1.txt b/install-dist/release-docs/licenses/LICENSE-snowball-stemmer-1.3.0.581.1.txt deleted file mode 100644 index fdb80824fd..0000000000 --- a/install-dist/release-docs/licenses/LICENSE-snowball-stemmer-1.3.0.581.1.txt +++ /dev/null @@ -1 +0,0 @@ -http://www.opensource.org/licenses/bsd-license.html diff --git a/install-dist/release-docs/licenses/LICENSE-stream-2.5.2.txt b/install-dist/release-docs/licenses/LICENSE-stream-2.5.2.txt deleted file mode 100644 index d645695673..0000000000 --- a/install-dist/release-docs/licenses/LICENSE-stream-2.5.2.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. diff --git a/install-dist/release-docs/licenses/LICENSE-zstd-jni-1.5.5-1.txt b/install-dist/release-docs/licenses/LICENSE-zstd-jni-1.5.5-1.txt deleted file mode 100644 index 37a227c838..0000000000 --- a/install-dist/release-docs/licenses/LICENSE-zstd-jni-1.5.5-1.txt +++ /dev/null @@ -1 +0,0 @@ -https://opensource.org/licenses/BSD-2-Clause diff --git a/install-dist/scripts/dependency/known-dependencies.txt b/install-dist/scripts/dependency/known-dependencies.txt index 3b05fbba11..157da1c064 100644 --- a/install-dist/scripts/dependency/known-dependencies.txt +++ b/install-dist/scripts/dependency/known-dependencies.txt @@ -1,10 +1,4 @@ -HdrHistogram-2.1.12.jar -HdrHistogram-2.1.9.jar -LatencyUtils-2.0.3.jar -RoaringBitmap-0.9.38.jar -ST4-4.0.8.jar accessors-smart-1.2.jar -airline-0.8.jar android-json-0.0.20131108.vaadin1.jar animal-sniffer-annotations-1.14.jar animal-sniffer-annotations-1.18.jar @@ -13,7 +7,6 @@ annotations-13.0.jar annotations-24.0.1.jar annotations-4.1.1.4.jar ansj_seg-5.1.6.jar -antlr-runtime-3.5.2.jar aopalliance-repackaged-3.0.1.jar apiguardian-api-1.1.0.jar arthas-agent-attach-3.6.4.jar @@ -22,19 +15,14 @@ arthas-packaging-3.6.4.jar arthas-packaging-3.7.1.jar asm-5.0.4.jar asm-6.0.jar -asm-7.1.jar -asm-analysis-5.0.3.jar asm-analysis-9.2.jar -asm-commons-5.0.3.jar asm-commons-9.2.jar -asm-tree-5.0.3.jar asm-tree-9.2.jar -asm-util-5.0.3.jar assertj-core-3.19.0.jar ast-9.0-9.0.20190305.jar audience-annotations-0.13.0.jar -auto-service-annotations-1.0.jar automaton-1.11-8.jar +auto-service-annotations-1.0.jar bolt-1.6.2.jar bolt-1.6.4.jar byte-buddy-1.10.20.jar @@ -43,25 +31,16 @@ byte-buddy-agent-1.10.20.jar byte-buddy-agent-1.10.5.jar byte-buddy-agent-1.11.6.jar caffeine-2.3.1.jar -caffeine-2.5.6.jar checker-compat-qual-2.5.5.jar checker-qual-2.0.0.jar checker-qual-3.12.0.jar checker-qual-3.33.0.jar checker-qual-3.5.0.jar -chronicle-bytes-2.20.111.jar -chronicle-core-2.20.126.jar -chronicle-queue-5.20.123.jar -chronicle-threads-2.20.111.jar -chronicle-wire-2.20.117.jar classgraph-4.8.162.jar commons-beanutils-1.9.4.jar -commons-cli-1.1.jar commons-cli-1.5.0.jar -commons-codec-1.11.jar commons-codec-1.13.jar commons-codec-1.15.jar -commons-codec-1.9.jar commons-collections-3.2.2.jar commons-collections4-4.4.jar commons-compress-1.21.jar @@ -72,17 +51,14 @@ commons-io-2.12.0.jar commons-io-2.7.jar commons-io-2.8.0.jar commons-lang-2.6.jar -commons-lang3-3.11.jar commons-lang3-3.12.0.jar commons-lang3-3.13.0.jar commons-lang3-3.18.0.jar commons-logging-1.1.1.jar commons-logging-1.2.jar -commons-math3-3.2.jar commons-pool2-2.0.jar commons-text-1.10.0.jar commons-text-1.9.jar -concurrent-trees-2.4.0.jar cypher-gremlin-extensions-1.0.4.jar disruptor-3.3.7.jar disruptor-3.4.1.jar @@ -156,7 +132,6 @@ grpc-stub-1.47.0.jar gson-2.8.6.jar gson-2.8.9.jar guava-25.1-jre.jar -guava-27.0-jre.jar guava-30.0-jre.jar guava-30.1-android.jar guava-31.0.1-android.jar @@ -168,8 +143,8 @@ hanlp-portable-1.8.3.jar hbase-client-2.6.5.jar hbase-common-2.6.5.jar hbase-endpoint-2.6.5.jar -hbase-hadoop-compat-2.6.5.jar hbase-hadoop2-compat-2.6.5.jar +hbase-hadoop-compat-2.6.5.jar hbase-logging-2.6.5.jar hbase-metrics-2.6.5.jar hbase-metrics-api-2.6.5.jar @@ -182,14 +157,13 @@ hbase-shaded-netty-4.1.13.jar hbase-shaded-protobuf-4.1.13.jar hbase-unsafe-4.1.13.jar hbase-zookeeper-2.6.5.jar +HdrHistogram-2.1.12.jar hessian-3.3.6.jar hessian-3.3.7.jar -high-scale-lib-1.0.6.jar hk2-api-3.0.1.jar hk2-locator-3.0.1.jar hk2-utils-3.0.1.jar hppc-0.7.1.jar -hppc-0.8.1.jar htrace-core4-4.1.0-incubating.jar httpclient-4.5.13.jar httpcore-4.4.13.jar @@ -240,19 +214,17 @@ jakarta.xml.bind-api-2.3.3.jar jakarta.xml.bind-api-3.0.0.jar jamm-0.3.2.jar jansi-2.4.0.jar -java-cup-runtime-11b-20160615.jar javapoet-1.8.0.jar javassist-3.21.0-GA.jar javassist-3.24.0-GA.jar javassist-3.25.0-GA.jar javassist-3.28.0-GA.jar javatuples-1.2.jar -javax-websocket-client-impl-9.4.46.v20220331.jar -javax-websocket-server-impl-9.4.46.v20220331.jar javax.activation-api-1.2.0.jar javax.annotation-api-1.3.2.jar -javax.inject-1.jar javax.json-1.0.jar +javax-websocket-client-impl-9.4.46.v20220331.jar +javax-websocket-server-impl-9.4.46.v20220331.jar jaxb-api-2.3.1.jar jaxb-core-3.0.2.jar jaxb-impl-3.0.2.jar @@ -266,7 +238,6 @@ jcommander-1.30.jar jcseg-core-2.2.0.jar jcseg-core-2.6.2.jar jctools-core-2.1.1.jar -jctools-core-3.1.0.jar jedis-2.5.1.jar jersey-apache-connector-3.0.3.jar jersey-client-3.0.3.jar @@ -298,9 +269,6 @@ jetty-util-9.4.46.v20220331.jar jetty-util-ajax-9.4.46.v20220331.jar jetty-webapp-9.4.46.v20220331.jar jetty-xml-9.4.46.v20220331.jar -jffi-1.2.16-native.jar -jffi-1.2.16.jar -jflex-1.8.2.jar jieba-analysis-1.0.2.jar jjwt-api-0.11.2.jar jjwt-api-0.11.5.jar @@ -312,17 +280,14 @@ jline-2.14.6.jar jna-5.12.1.jar jna-5.5.0.jar jna-5.7.0.jar -jnr-ffi-2.1.7.jar -jnr-x86asm-1.0.2.jar joda-time-2.10.8.jar joni-2.2.1.jar jraft-core-1.3.11.jar jraft-core-1.3.13.jar jraft-core-1.3.9.jar +jsonassert-1.5.0.jar json-path-2.5.0.jar -json-simple-1.1.jar json-smart-2.3.jar -jsonassert-1.5.0.jar jsr305-3.0.1.jar jsr305-3.0.2.jar jul-to-slf4j-1.7.36.jar @@ -374,6 +339,7 @@ kubernetes-model-policy-5.6.0.jar kubernetes-model-rbac-5.6.0.jar kubernetes-model-scheduling-5.6.0.jar kubernetes-model-storageclass-5.6.0.jar +LatencyUtils-2.0.3.jar listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar log4j-api-2.15.0.jar log4j-api-2.17.0.jar @@ -413,30 +379,25 @@ lz4-java-1.4.0.jar lz4-java-1.8.1.jar metrics-annotation-4.2.4.jar metrics-core-3.0.2.jar -metrics-core-3.1.5.jar metrics-core-4.0.2.jar metrics-core-4.2.4.jar metrics-jersey3-4.2.4.jar -metrics-jvm-3.1.5.jar -metrics-logback-3.1.5.jar micrometer-core-1.7.12.jar micrometer-registry-prometheus-1.7.12.jar mmseg4j-core-1.10.0.jar mockito-core-3.3.3.jar mockito-core-3.9.0.jar mockito-junit-jupiter-3.9.0.jar -mxdump-0.14.jar netty-all-4.1.42.Final.jar -netty-all-4.1.44.Final.jar netty-all-4.1.61.Final.jar netty-buffer-4.1.52.Final.jar netty-buffer-4.1.72.Final.jar netty-codec-4.1.52.Final.jar netty-codec-4.1.72.Final.jar -netty-codec-http-4.1.52.Final.jar -netty-codec-http-4.1.72.Final.jar netty-codec-http2-4.1.52.Final.jar netty-codec-http2-4.1.72.Final.jar +netty-codec-http-4.1.52.Final.jar +netty-codec-http-4.1.72.Final.jar netty-codec-socks-4.1.52.Final.jar netty-codec-socks-4.1.72.Final.jar netty-common-4.1.52.Final.jar @@ -450,7 +411,6 @@ netty-resolver-4.1.130.Final.jar netty-resolver-4.1.52.Final.jar netty-resolver-4.1.72.Final.jar netty-tcnative-boringssl-static-2.0.25.Final.jar -netty-tcnative-boringssl-static-2.0.36.Final.jar netty-tcnative-classes-2.0.46.Final.jar netty-transport-4.1.52.Final.jar netty-transport-4.1.72.Final.jar @@ -462,7 +422,6 @@ nlp-lang-1.7.7.jar objenesis-2.6.jar objenesis-3.2.jar ohc-core-0.7.4.jar -ohc-core-j8-0.5.1.jar okhttp-3.12.12.jar okhttp-4.10.0.jar okio-1.15.0.jar @@ -493,21 +452,19 @@ powermock-module-junit4-2.0.0-RC.3.jar powermock-module-junit4-common-2.0.0-RC.3.jar powermock-module-junit4-rule-2.0.0-RC.3.jar powermock-reflect-2.0.0-RC.3.jar -proto-google-common-protos-1.17.0.jar -proto-google-common-protos-2.0.1.jar protobuf-java-3.11.0.jar protobuf-java-3.17.2.jar protobuf-java-3.21.7.jar protobuf-java-3.5.1.jar protobuf-java-util-3.17.2.jar +proto-google-common-protos-1.17.0.jar +proto-google-common-protos-2.0.1.jar protostuff-api-1.6.0.jar protostuff-collectionschema-1.6.0.jar protostuff-core-1.6.0.jar protostuff-runtime-1.6.0.jar -psjava-0.1.19.jar -reporter-config-base-3.0.3.jar -reporter-config3-3.0.3.jar rewriting-9.0-9.0.20190305.jar +RoaringBitmap-0.9.38.jar rocksdbjni-6.29.5.jar rocksdbjni-7.7.3.jar rocksdbjni-8.10.2.jar @@ -515,22 +472,17 @@ scala-java8-compat_2.12-0.8.0.jar scala-library-2.12.7.jar scala-reflect-2.12.7.jar shims-0.9.38.jar -sigar-1.6.4.jar -simpleclient-0.10.0.jar simpleclient_common-0.10.0.jar +simpleclient-0.10.0.jar sjk-agent-0.22.jar -sjk-cli-0.14.jar sjk-cli-0.22.jar -sjk-core-0.14.jar sjk-core-0.22.jar sjk-hflame-0.22.jar -sjk-jfr-standalone-0.7.jar sjk-jfr5-0.5.jar sjk-jfr6-0.7.jar -sjk-json-0.14.jar +sjk-jfr-standalone-0.7.jar sjk-json-0.22.jar sjk-nps-0.9.jar -sjk-stacktrace-0.14.jar sjk-stacktrace-0.22.jar slf4j-api-1.7.21.jar slf4j-api-1.7.25.jar @@ -542,8 +494,6 @@ snakeyaml-1.26.jar snakeyaml-1.27.jar snakeyaml-1.28.jar snakeyaml-2.2.jar -snappy-java-1.1.2.6.jar -snowball-stemmer-1.3.0.581.1.jar sofa-common-tools-1.0.12.jar sofa-rpc-all-5.7.6.jar sourcecode_2.12-0.1.4.jar @@ -579,7 +529,6 @@ spring-security-core-5.8.3.jar spring-security-crypto-5.8.3.jar spring-web-5.3.20.jar spring-webmvc-5.3.20.jar -stream-2.5.2.jar swagger-annotations-1.5.18.jar swagger-annotations-jakarta-2.2.18.jar swagger-core-1.5.18.jar @@ -608,5 +557,4 @@ xstream-1.4.10.jar zjsonpatch-0.3.0.jar zookeeper-3.8.6.jar zookeeper-jute-3.8.6.jar -zstd-jni-1.5.5-1.jar zt-zip-1.14.jar diff --git a/pom.xml b/pom.xml index 045a24ad56..3581d0346f 100644 --- a/pom.xml +++ b/pom.xml @@ -212,7 +212,6 @@ **/rocksdb-*/** **/hbase-*/** - **/apache-cassandra-*/** **/pid **/tmp/** From b361395022158a18959d078a8f2bafd64a7b3142 Mon Sep 17 00:00:00 2001 From: legendPei <804141866@qq.com> Date: Sun, 26 Jul 2026 22:05:36 +0800 Subject: [PATCH 09/15] feat(server): address pmc review comments --- .serena/memories/architecture_and_modules.md | 8 ++-- .../implementation_patterns_and_guidelines.md | 3 +- .serena/memories/project_overview.md | 3 +- .serena/project.yml | 7 +--- hugegraph-server/hugegraph-core/pom.xml | 5 +++ .../security/HugeSecurityManager.java | 4 +- .../security/HugeSecurityManagerTest.java | 40 +++++++++++++++++++ .../apache/hugegraph/cmd/InitStoreTest.java | 4 -- .../unit/core/SecurityManagerTest.java | 6 +++ 9 files changed, 59 insertions(+), 21 deletions(-) create mode 100644 hugegraph-server/hugegraph-core/src/test/java/org/apache/hugegraph/security/HugeSecurityManagerTest.java diff --git a/.serena/memories/architecture_and_modules.md b/.serena/memories/architecture_and_modules.md index 8d6c85888e..a74d658209 100644 --- a/.serena/memories/architecture_and_modules.md +++ b/.serena/memories/architecture_and_modules.md @@ -5,19 +5,19 @@ ### 1. Client Layer - Gremlin/Cypher queries, REST APIs, Swagger UI -### 2. Server Layer (hugegraph-server, 13 submodules) +### 2. Server Layer (hugegraph-server, 8 submodules) - **REST API** (hugegraph-api): GraphAPI, SchemaAPI, GremlinAPI, CypherAPI, AuthAPI, GraphSpaceAPI (distributed only), ManagerAPI (distributed only) - **Graph Engine** (hugegraph-core): Schema (with TTL update), traversal, task scheduling, GraphSpace multi-tenancy - **Backend Interface**: Pluggable via `BackendStore` ### 3. Storage Layer - RocksDB (default/embedded), HStore (distributed/production) -- Legacy (≤1.5.0, deprecated, excluded from context): MySQL, PostgreSQL, Cassandra, ScyllaDB, HBase, Palo +- HBase (deprecated; planned for removal in 2.0) ## Module Structure (7 top-level modules) -### hugegraph-server (13 submodules) -`hugegraph-core`, `hugegraph-api` (includes `opencypher/`, `space/`), `hugegraph-dist`, `hugegraph-test`, `hugegraph-example`, plus backends: `hugegraph-rocksdb`, `hugegraph-hstore`, `hugegraph-hbase`, `hugegraph-mysql`, `hugegraph-postgresql`, `hugegraph-cassandra`, `hugegraph-scylladb`, `hugegraph-palo` +### hugegraph-server (8 submodules) +`hugegraph-core`, `hugegraph-api` (includes `opencypher/`, `space/`), `hugegraph-dist`, `hugegraph-test`, `hugegraph-example`, plus backends: `hugegraph-rocksdb`, `hugegraph-hstore`, `hugegraph-hbase` ### hugegraph-pd (8 submodules) Placement Driver: `hg-pd-core`, `hg-pd-service`, `hg-pd-client`, `hg-pd-common`, `hg-pd-grpc`, `hg-pd-cli`, `hg-pd-dist`, `hg-pd-test` diff --git a/.serena/memories/implementation_patterns_and_guidelines.md b/.serena/memories/implementation_patterns_and_guidelines.md index c2b98313e2..d04e33ce56 100644 --- a/.serena/memories/implementation_patterns_and_guidelines.md +++ b/.serena/memories/implementation_patterns_and_guidelines.md @@ -4,8 +4,7 @@ - Backends implement `BackendStore` interface from `hugegraph-core` - Each backend = separate Maven module under `hugegraph-server/` - Configured via `hugegraph.properties` → `backend` property -- **Active backends (focus here)**: RocksDB (default/embedded), HStore (distributed) -- **Legacy backends** (deprecated, excluded from Serena context): MySQL, PostgreSQL, Cassandra, ScyllaDB, HBase, Palo +- **Supported backends**: RocksDB (default/embedded), HStore (distributed), HBase (deprecated; planned for removal in 2.0) ## GraphSpace Multi-Tenancy - Core: `hugegraph-core/.../space/` (GraphSpace, SchemaTemplate, Service, register/) diff --git a/.serena/memories/project_overview.md b/.serena/memories/project_overview.md index c494aaed44..6375a3104e 100644 --- a/.serena/memories/project_overview.md +++ b/.serena/memories/project_overview.md @@ -19,8 +19,7 @@ Apache HugeGraph is a fast-speed, highly-scalable graph database supporting 10+ - **Graph Framework**: Apache TinkerPop 3.5.1 - **RPC**: gRPC + Protocol Buffers - **API Docs**: Swagger (io.swagger.core.v3) -- **Storage**: RocksDB (default/embedded), HStore (distributed/production) -- **Legacy backends** (≤1.5.0): MySQL, PostgreSQL, Cassandra, ScyllaDB, HBase, Palo +- **Storage**: RocksDB (default/embedded), HStore (distributed/production), HBase (deprecated; planned for removal in 2.0) ## Version - Current: 1.7.0 (`${revision}` property, Maven flatten plugin) diff --git a/.serena/project.yml b/.serena/project.yml index 3329e5b5af..efcbf00551 100644 --- a/.serena/project.yml +++ b/.serena/project.yml @@ -35,12 +35,7 @@ ignore_all_files_in_gitignore: true # Same syntax as gitignore, so you can use * and **. # Note: global ignored_paths from serena_config.yml are also applied additively. ignored_paths: - # --- Deprecated backends (focus on RocksDB/HStore only) --- - - "hugegraph-server/hugegraph-cassandra/**" - - "hugegraph-server/hugegraph-scylladb/**" - - "hugegraph-server/hugegraph-mysql/**" - - "hugegraph-server/hugegraph-postgresql/**" - - "hugegraph-server/hugegraph-palo/**" + # --- HBase is deprecated and planned for removal in 2.0 --- - "hugegraph-server/hugegraph-hbase/**" # --- gRPC generated Java (235k lines, never hand-edited, regenerated by mvn compile) --- - "hugegraph-pd/hg-pd-grpc/src/main/java/**" diff --git a/hugegraph-server/hugegraph-core/pom.xml b/hugegraph-server/hugegraph-core/pom.xml index 14f5274cb4..b2519633a9 100644 --- a/hugegraph-server/hugegraph-core/pom.xml +++ b/hugegraph-server/hugegraph-core/pom.xml @@ -118,6 +118,11 @@ org.apache.tinkerpop gremlin-driver + + junit + junit + test + org.apache.fury fury-core diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/security/HugeSecurityManager.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/security/HugeSecurityManager.java index 25fb7f88b1..204320d400 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/security/HugeSecurityManager.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/security/HugeSecurityManager.java @@ -63,9 +63,7 @@ public class HugeSecurityManager extends SecurityManager { "line.separator", "file.separator", // Sofa - "java.specification.version", - "socksProxyHost", - "file.encoding" + "java.specification.version" ); private static final Map> ASYNC_TASKS = ImmutableMap.of( diff --git a/hugegraph-server/hugegraph-core/src/test/java/org/apache/hugegraph/security/HugeSecurityManagerTest.java b/hugegraph-server/hugegraph-core/src/test/java/org/apache/hugegraph/security/HugeSecurityManagerTest.java new file mode 100644 index 0000000000..5b1e32e5d6 --- /dev/null +++ b/hugegraph-server/hugegraph-core/src/test/java/org/apache/hugegraph/security/HugeSecurityManagerTest.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.hugegraph.security; + +import java.lang.reflect.Field; +import java.util.Set; + +import org.junit.Assert; +import org.junit.Test; + +public class HugeSecurityManagerTest { + + @Test + public void testWhiteSystemPropertiesExcludeRemovedBackends() throws Exception { + Field field = HugeSecurityManager.class.getDeclaredField( + "WHITE_SYSTEM_PROPERTIES"); + field.setAccessible(true); + + @SuppressWarnings("unchecked") + Set properties = (Set) field.get(null); + Assert.assertFalse(properties.contains("socksProxyHost")); + Assert.assertFalse(properties.contains("file.encoding")); + Assert.assertTrue(properties.contains("java.specification.version")); + } +} diff --git a/hugegraph-server/hugegraph-dist/src/test/java/org/apache/hugegraph/cmd/InitStoreTest.java b/hugegraph-server/hugegraph-dist/src/test/java/org/apache/hugegraph/cmd/InitStoreTest.java index bf16bb3f15..cf11df45f9 100644 --- a/hugegraph-server/hugegraph-dist/src/test/java/org/apache/hugegraph/cmd/InitStoreTest.java +++ b/hugegraph-server/hugegraph-dist/src/test/java/org/apache/hugegraph/cmd/InitStoreTest.java @@ -46,16 +46,12 @@ public void testInitBackendFailsFastForPermanentException() throws Exception { Method method = InitStore.class.getDeclaredMethod("initBackend", HugeGraph.class); method.setAccessible(true); - long start = System.nanoTime(); try { method.invoke(null, graph); Assert.fail("Expected initialization to fail"); } catch (InvocationTargetException e) { Assert.assertSame(exception, e.getCause()); } - long elapsed = (System.nanoTime() - start) / 1_000_000L; - Assert.assertTrue("Expected initialization to fail without retrying", - elapsed < 1000L); Assert.assertEquals(1, invocations.get()); } } diff --git a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/SecurityManagerTest.java b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/SecurityManagerTest.java index 1facaf2f43..a30f35cb31 100644 --- a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/SecurityManagerTest.java +++ b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/core/SecurityManagerTest.java @@ -282,6 +282,12 @@ public void testProperties() { System.getProperty("java.version"); result = runGremlinJob("System.getProperty(\"java.version\")"); assertError(result, "Not allowed to access system property(java.version) via Gremlin"); + + result = runGremlinJob("System.getProperty(\"socksProxyHost\")"); + assertError(result, "Not allowed to access system property(socksProxyHost) via Gremlin"); + + result = runGremlinJob("System.getProperty(\"file.encoding\")"); + assertError(result, "Not allowed to access system property(file.encoding) via Gremlin"); } @Test From f1150c0e8096198baf353bd6c573d6ea580b975e Mon Sep 17 00:00:00 2001 From: legendPei <804141866@qq.com> Date: Sun, 26 Jul 2026 23:38:56 +0800 Subject: [PATCH 10/15] feat(server): clarify backend support lifecycle --- .serena/project.yml | 2 +- README.md | 44 ++++++++++++++++++++++--------- docker/hbase/README.md | 2 ++ hugegraph-server/AGENTS.md | 6 ++--- hugegraph-server/README.md | 2 +- install-dist/release-docs/LICENSE | 1 + install-dist/release-docs/NOTICE | 4 +-- 7 files changed, 41 insertions(+), 20 deletions(-) diff --git a/.serena/project.yml b/.serena/project.yml index efcbf00551..d97a3e60db 100644 --- a/.serena/project.yml +++ b/.serena/project.yml @@ -40,7 +40,7 @@ ignored_paths: # --- gRPC generated Java (235k lines, never hand-edited, regenerated by mvn compile) --- - "hugegraph-pd/hg-pd-grpc/src/main/java/**" - "hugegraph-store/hg-store-grpc/src/main/java/**" - # --- License/legal files (585 txt files, only touched when adding dependencies) --- + # --- License/legal files (maintained through the release/dependency workflow) --- - "install-dist/release-docs/licenses/**" - "install-dist/scripts/dependency/known-dependencies.txt" # --- Rarely modified tests/examples --- diff --git a/README.md b/README.md index d8d966ddb3..c92e614b3f 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ achieved through the powerful [Gremlin](https://tinkerpop.apache.org/gremlin.htm - **Schema Metadata Management**: VertexLabel, EdgeLabel, PropertyKey, and IndexLabel - **Multi-type Indexes**: Exact query, range query, and complex conditions combination query -- **Plug-in Backend Store Framework**: Since `1.7.0`, supported backends are `RocksDB`, `HStore`, `HBase`, and `Memory`. Historical versions earlier than `1.7.0` also supported MySQL, PostgreSQL, Cassandra, ScyllaDB, and Palo. +- **Plug-in Backend Store Framework**: Since `1.7.0`, the maintained production backends are `RocksDB` and `HStore`; `HBase` remains available but is deprecated and planned for removal in 2.0. `Memory` is a test-only backend. Historical HugeGraph `≤1.5` releases support MySQL, PostgreSQL, Cassandra, ScyllaDB, and Palo. Their implementations are no longer in the current mainline, so users who need them must operate and maintain a compatible historical release themselves. - **Big Data Integration**: Seamless integration with `Flink`/`Spark`/`HDFS` - **Complete Graph Ecosystem**: In/out-memory Graph Computing + Graph Visualization & Tools + Graph Learning & AI - **Dual Query Language Support**: [Gremlin](https://tinkerpop.apache.org/gremlin.html) (via [Apache TinkerPop 3](https://tinkerpop.apache.org/)) and [Cypher](https://en.wikipedia.org/wiki/Cypher_(query_language)) (OpenCypher) @@ -77,13 +77,13 @@ HugeGraph supports both **standalone** and **distributed** deployments: │ ┌────────────────────────────────┼────────────────────────────────┐ │ │ │ -┌────────────▼────────────┐ ┌───────────────▼───────────────┐ ┌───────────▼──────────┐ -│ Standalone Mode │ │ Distributed Mode │ │ Supported Backends │ -│ ┌───────────────────┐ │ │ ┌─────────────────────────┐ │ │ RocksDB │ Memory │ -│ │ RocksDB │ │ │ │ HugeGraph-PD │ │ │ HBase │ HStore │ -│ │ (embedded) │ │ │ │ (Raft, 3-5 nodes) │ │ │ │ -│ └───────────────────┘ │ │ │ :8620/:8686 │ │ │ │ -│ │ │ └────────────┬────────────┘ │ └──────────────────────┘ +┌────────────▼────────────┐ ┌───────────────▼───────────────┐ +│ Standalone Mode │ │ Distributed Mode │ +│ ┌───────────────────┐ │ │ ┌─────────────────────────┐ │ +│ │ RocksDB │ │ │ │ HugeGraph-PD │ │ +│ │ (embedded) │ │ │ │ (Raft, 3-5 nodes) │ │ +│ └───────────────────┘ │ │ │ :8620/:8686 │ │ +│ │ │ └────────────┬────────────┘ │ │ Use Case: │ │ │ │ │ Development/Testing │ │ ┌────────────▼────────────┐ │ │ Single Node │ │ │ HugeGraph-Store │ │ @@ -96,6 +96,20 @@ HugeGraph supports both **standalone** and **distributed** deployments: │ │ │ Data Scale: < 1000 TB │ └───────────────────────────────┘ + + ┌──────────────── Current Backends ────────────────────┐ + │ RocksDB (default, embedded) and HStore (distributed) │ + └──────────────────────────────────────────────────────┘ + ┌────────────── Deprecated Backend ────────────────────┐ + │ HBase (planned for removal in 2.0) │ + └──────────────────────────────────────────────────────┘ + ┌────────────── Test-only Backend ─────────────────────┐ + │ Memory │ + └──────────────────────────────────────────────────────┘ + ┌──────────── Historical Backends (≤1.5) ──────────────┐ + │ MySQL, PostgreSQL, Cassandra, ScyllaDB, and Palo │ + │ Use and maintain a compatible historical release. │ + └──────────────────────────────────────────────────────┘ ``` ### Deployment Mode Comparison @@ -148,19 +162,23 @@ flowchart TB PD <--> STORE end - subgraph Backends["Supported Backends"] - HBASE[(HBase)] - HSTORE[(HStore)] - MEMORY[(Memory)] + subgraph Backends["Current Backends"] + HSTORE[(HStore
Distributed)] + end + + subgraph Deprecated["Deprecated Backend"] + HBASE[(HBase
Planned for removal in 2.0)] end end + MEMORY[(Memory
Test-only)] + HISTORY["Historical Backends (≤1.5)
MySQL, PostgreSQL, Cassandra, ScyllaDB, Palo
Use and maintain a compatible historical release"] + Clients --> Server CORE --> ROCKS CORE --> PD CORE --> HBASE CORE --> HSTORE - CORE --> MEMORY style Server fill:#e1f5ff style Distributed fill:#fff4e1 diff --git a/docker/hbase/README.md b/docker/hbase/README.md index aa6fcd2870..914805066a 100644 --- a/docker/hbase/README.md +++ b/docker/hbase/README.md @@ -2,6 +2,8 @@ This guide covers running HugeGraph with HBase backend. +> **Deprecation notice:** The HBase backend is deprecated and is planned for removal in HugeGraph 2.0. Existing deployments should plan a migration to a maintained backend. + > All commands below run from the repository root (this project folder). Use this once at the start of your terminal session: diff --git a/hugegraph-server/AGENTS.md b/hugegraph-server/AGENTS.md index 0365dd6965..0b6da40820 100644 --- a/hugegraph-server/AGENTS.md +++ b/hugegraph-server/AGENTS.md @@ -8,7 +8,7 @@ HugeGraph Server is the graph engine layer of Apache HugeGraph, consisting of: - **REST API Layer** (hugegraph-api): RESTful APIs for graph operations, Gremlin/Cypher queries, schema management, and authentication - **Graph Engine Layer** (hugegraph-core): TinkerPop 3 implementation, schema management, traversal optimization, task scheduling - **Backend Interface**: Abstraction layer for pluggable storage backends -- **Storage Backend Implementations**: RocksDB (default), HStore (distributed), HBase, and Memory +- **Storage Backend Implementations**: RocksDB (default), HStore (distributed), HBase (deprecated; planned for removal in 2.0), and Memory (test-only) Technology: Java 11+, Maven 3.5+, Apache TinkerPop 3.5.1, Jersey 3.0 (REST), gRPC (distributed communication) @@ -49,7 +49,7 @@ mvn checkstyle:check **Backend profiles** (combine with test profiles): - `memory`: In-memory backend (default for tests) - `rocksdb`: RocksDB backend -- `hbase`: HBase backend +- `hbase`: HBase backend (deprecated; planned for removal in 2.0) - `hstore`: HStore backend ```bash @@ -86,7 +86,7 @@ hugegraph-server/ ├── hugegraph-api # REST API, Gremlin/Cypher endpoints, authentication ├── hugegraph-rocksdb # RocksDB backend (default, embedded) ├── hugegraph-hstore # HStore backend (distributed, production) -├── hugegraph-hbase # HBase backend +├── hugegraph-hbase # HBase backend (deprecated; planned for removal in 2.0) ├── hugegraph-dist # Distribution packaging, scripts, configs ├── hugegraph-test # All test suites └── hugegraph-example # Example code diff --git a/hugegraph-server/README.md b/hugegraph-server/README.md index ef6c9f111d..69dbb37908 100644 --- a/hugegraph-server/README.md +++ b/hugegraph-server/README.md @@ -8,7 +8,7 @@ HugeGraph Server consists of two layers of functionality: the graph engine layer - Backend Interface: Implements the storage of graph data to the backend. - Storage Layer: - - Storage Backend: Supports multiple built-in storage backends (RocksDB/Memory/HStore/HBase/...) and allows users to extend custom backends without modifying the existing source code. + - Storage Backend: Includes RocksDB (default, embedded), HStore (distributed), HBase (deprecated and planned for removal in 2.0), and the test-only Memory backend. Users can extend custom backends without modifying the existing source code. ## Docker diff --git a/install-dist/release-docs/LICENSE b/install-dist/release-docs/LICENSE index ee47f55e58..06a31044eb 100644 --- a/install-dist/release-docs/LICENSE +++ b/install-dist/release-docs/LICENSE @@ -353,6 +353,7 @@ non-Apache-2.0 license text is required for a bundled component. https://central.sonatype.com/artifact/commons-codec/commons-codec/1.13 -> Apache 2.0 https://central.sonatype.com/artifact/commons-codec/commons-codec/1.15 -> Apache 2.0 https://central.sonatype.com/artifact/commons-collections/commons-collections/3.2.2 -> Apache 2.0 + https://central.sonatype.com/artifact/commons-cli/commons-cli/1.5.0 -> Apache 2.0 https://central.sonatype.com/artifact/commons-configuration/commons-configuration/1.10 -> Apache 2.0 https://central.sonatype.com/artifact/commons-io/commons-io/2.12.0 -> Apache 2.0 https://central.sonatype.com/artifact/commons-io/commons-io/2.7 -> Apache 2.0 diff --git a/install-dist/release-docs/NOTICE b/install-dist/release-docs/NOTICE index a1de25d4d0..99e69b7f11 100644 --- a/install-dist/release-docs/NOTICE +++ b/install-dist/release-docs/NOTICE @@ -907,10 +907,10 @@ The Apache Software Foundation (http://www.apache.org/). ======================================================================== Apache Commons CLI -Copyright 2001-2015 The Apache Software Foundation +Copyright 2002-2021 The Apache Software Foundation This product includes software developed at -The Apache Software Foundation (http://www.apache.org/). +The Apache Software Foundation (https://www.apache.org/). ======================================================================== From 257be17dba253b5e7d9b99fb760635a0daae9d91 Mon Sep 17 00:00:00 2001 From: legendPei <804141866@qq.com> Date: Sun, 26 Jul 2026 23:58:04 +0800 Subject: [PATCH 11/15] feat(server): document backend evolution --- README.md | 2 +- hugegraph-server/README.md | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c92e614b3f..b2f8b73e4a 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ achieved through the powerful [Gremlin](https://tinkerpop.apache.org/gremlin.htm - **Schema Metadata Management**: VertexLabel, EdgeLabel, PropertyKey, and IndexLabel - **Multi-type Indexes**: Exact query, range query, and complex conditions combination query -- **Plug-in Backend Store Framework**: Since `1.7.0`, the maintained production backends are `RocksDB` and `HStore`; `HBase` remains available but is deprecated and planned for removal in 2.0. `Memory` is a test-only backend. Historical HugeGraph `≤1.5` releases support MySQL, PostgreSQL, Cassandra, ScyllaDB, and Palo. Their implementations are no longer in the current mainline, so users who need them must operate and maintain a compatible historical release themselves. +- **Plug-in Backend Store Framework**: Since `1.7.0`, the maintained production backends are `RocksDB` and `HStore`; HBase is `legacy` and planned for removal in 2.0, while Memory is test-only. See the [backend evolution and historical compatibility guide](hugegraph-server/README.md#backend-evolution-and-compatibility) for `≤1.5` backends and self-maintenance guidance. - **Big Data Integration**: Seamless integration with `Flink`/`Spark`/`HDFS` - **Complete Graph Ecosystem**: In/out-memory Graph Computing + Graph Visualization & Tools + Graph Learning & AI - **Dual Query Language Support**: [Gremlin](https://tinkerpop.apache.org/gremlin.html) (via [Apache TinkerPop 3](https://tinkerpop.apache.org/)) and [Cypher](https://en.wikipedia.org/wiki/Cypher_(query_language)) (OpenCypher) diff --git a/hugegraph-server/README.md b/hugegraph-server/README.md index 69dbb37908..fbb0c010ac 100644 --- a/hugegraph-server/README.md +++ b/hugegraph-server/README.md @@ -10,6 +10,28 @@ HugeGraph Server consists of two layers of functionality: the graph engine layer - Storage Layer: - Storage Backend: Includes RocksDB (default, embedded), HStore (distributed), HBase (deprecated and planned for removal in 2.0), and the test-only Memory backend. Users can extend custom backends without modifying the existing source code. +## Backend Evolution and Compatibility + +The current mainline does not include implementations for the historical backends. The following timeline distinguishes current support from legacy compatibility guidance: + +```text +Historical releases (≤1.5) + MySQL / PostgreSQL / Cassandra / ScyllaDB / Palo + └─ The implementations are not in the current mainline. Users who need + them must operate and maintain a compatible historical release. + +Current releases (1.7–1.x) + RocksDB ─ maintained; default embedded backend + HStore ─ maintained; distributed backend + HBase ─ legacy; deprecated; planned for removal in 2.0 + Memory ─ test-only backend + +2.0+ + HBase ─ removed; no compatibility guarantee +``` + +This timeline is compatibility guidance only. It does not restore the historical implementations to the current source tree or distribution packages. + ## Docker ### Standalone Mode From ddac0a6ef05fabcc22ff0da723d9836445dff49d Mon Sep 17 00:00:00 2001 From: legendPei <804141866@qq.com> Date: Mon, 27 Jul 2026 10:28:01 +0800 Subject: [PATCH 12/15] fix(hstore): remove test utility dependency --- .../store/hstore/HstoreSessionsImpl.java | 6 +-- .../store/hstore/HstoreSessionsImplTest.java | 39 +++++++++++++++++++ 2 files changed, 42 insertions(+), 3 deletions(-) create mode 100644 hugegraph-server/hugegraph-hstore/src/test/java/org/apache/hugegraph/backend/store/hstore/HstoreSessionsImplTest.java diff --git a/hugegraph-server/hugegraph-hstore/src/main/java/org/apache/hugegraph/backend/store/hstore/HstoreSessionsImpl.java b/hugegraph-server/hugegraph-hstore/src/main/java/org/apache/hugegraph/backend/store/hstore/HstoreSessionsImpl.java index 2f98d03745..e619aff4fb 100755 --- a/hugegraph-server/hugegraph-hstore/src/main/java/org/apache/hugegraph/backend/store/hstore/HstoreSessionsImpl.java +++ b/hugegraph-server/hugegraph-hstore/src/main/java/org/apache/hugegraph/backend/store/hstore/HstoreSessionsImpl.java @@ -53,7 +53,6 @@ import org.apache.hugegraph.store.client.grpc.KvCloseableIterator; import org.apache.hugegraph.store.client.util.HgStoreClientConst; import org.apache.hugegraph.store.grpc.common.ScanOrderType; -import org.apache.hugegraph.testutil.Assert; import org.apache.hugegraph.type.define.GraphMode; import org.apache.hugegraph.util.Bytes; import org.apache.hugegraph.util.E; @@ -128,8 +127,9 @@ public void open() throws Exception { synchronized (infoInitializedGraph) { if (!infoInitializedGraph.contains(this.graphName)) { Integer partitionCount = this.config.get(HstoreOptions.PARTITION_COUNT); - Assert.assertTrue("The value of hstore.partition_count" + - " cannot be less than 0.", partitionCount > -1); + E.checkArgument(partitionCount > -1, + "The value of hstore.partition_count " + + "cannot be less than 0."); defaultPdClient.setGraph(Metapb.Graph.newBuilder() .setGraphName(this.graphName) .setPartitionCount(partitionCount) diff --git a/hugegraph-server/hugegraph-hstore/src/test/java/org/apache/hugegraph/backend/store/hstore/HstoreSessionsImplTest.java b/hugegraph-server/hugegraph-hstore/src/test/java/org/apache/hugegraph/backend/store/hstore/HstoreSessionsImplTest.java new file mode 100644 index 0000000000..69f2591e25 --- /dev/null +++ b/hugegraph-server/hugegraph-hstore/src/test/java/org/apache/hugegraph/backend/store/hstore/HstoreSessionsImplTest.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.hugegraph.backend.store.hstore; + +import java.io.IOException; +import java.io.InputStream; +import java.nio.charset.StandardCharsets; + +import org.junit.Assert; +import org.junit.Test; + +public class HstoreSessionsImplTest { + + @Test + public void testProductionClassDoesNotReferenceTestAssert() throws IOException { + String className = HstoreSessionsImpl.class.getSimpleName() + ".class"; + try (InputStream stream = HstoreSessionsImpl.class.getResourceAsStream(className)) { + Assert.assertNotNull(stream); + String classFile = new String(stream.readAllBytes(), StandardCharsets.ISO_8859_1); + Assert.assertFalse(classFile.contains( + "org/apache/hugegraph/testutil/Assert")); + } + } +} From 28d1f98b50a401d2f981d3e6027afd7b397f71b6 Mon Sep 17 00:00:00 2001 From: imbajin Date: Mon, 27 Jul 2026 15:36:47 +0800 Subject: [PATCH 13/15] docs(server): simplify backend timeline - replace the verbose backend list with a three-stage timeline - center transitions between the 1.0, 1.5, and 2.x milestones - retain historical, deprecated, and test-only guidance --- hugegraph-server/README.md | 67 ++++++++------------------------------ 1 file changed, 13 insertions(+), 54 deletions(-) diff --git a/hugegraph-server/README.md b/hugegraph-server/README.md index fbb0c010ac..819bece457 100644 --- a/hugegraph-server/README.md +++ b/hugegraph-server/README.md @@ -15,22 +15,19 @@ HugeGraph Server consists of two layers of functionality: the graph engine layer The current mainline does not include implementations for the historical backends. The following timeline distinguishes current support from legacy compatibility guidance: ```text -Historical releases (≤1.5) - MySQL / PostgreSQL / Cassandra / ScyllaDB / Palo - └─ The implementations are not in the current mainline. Users who need - them must operate and maintain a compatible historical release. - -Current releases (1.7–1.x) - RocksDB ─ maintained; default embedded backend - HStore ─ maintained; distributed backend - HBase ─ legacy; deprecated; planned for removal in 2.0 - Memory ─ test-only backend - -2.0+ - HBase ─ removed; no compatibility guarantee +┌─────────────────────────┐ ┌─────────────────────────┐ ┌─────────────────────────┐ +│ 1.0 │ │ 1.5 │ │ 2.x │ +│ Historical era │ │ Compatibility boundary │ │ Future roadmap │ +│ │ │ ↓ │ │ │ +│ MySQL · PostgreSQL │────▶│ 1.7–2.0 mainline │────▶│ RocksDB · HStore │ +│ Cassandra · ScyllaDB │ │ RocksDB · HStore │ │ │ +│ Palo · HBase │ │ HBase: deprecated │ │ (HBase: removed) │ +└─────────────────────────┘ └─────────────────────────┘ └─────────────────────────┘ ``` -This timeline is compatibility guidance only. It does not restore the historical implementations to the current source tree or distribution packages. +Memory remains a test-only backend throughout. Historical backend users must operate and +maintain a compatible release; these implementations are not restored to the current source +tree or distribution packages. ## Docker @@ -55,43 +52,5 @@ See [docker/README.md](../docker/README.md) for the full setup guide. ## RISC-V Development and Testing -The end-to-end RISC-V CI validation currently runs on 64-bit `linux/riscv64` LP64D with -Ubuntu 24.04 and glibc 2.39. It covers HugeGraph Server and the embedded RocksDB backend. -PD, Store, HStore, other backends, musl/Alpine, and 32-bit RISC-V are out of scope. - -The dedicated [RISC-V Server CI](../.github/workflows/riscv64-ci.yml) runs a RocksDB-only -native build and runtime smoke test in an isolated QEMU environment. It uses the -checksum-pinned Alibaba Dragonwell 11 Extended Server VM and installs `libatomic1` for the -packaged RocksDB JNI library. QEMU is for correctness testing and is not a performance -benchmark. - -The packaged `rocksdbjni:8.10.2` RISC-V ELF references glibc symbols through -`GLIBC_2.30`. This is an inferred minimum for that JNI artifact only, not a validated -compatibility floor for the complete HugeGraph, Dragonwell, and system-library runtime. - -The repository Dockerfile and published HugeGraph image do not include RISC-V support. -Image publication requires separate multi-architecture design and validation. - -For the same validation on a native Debian-derived RISC-V system, use Dragonwell 11 -Extended `11.0.31.28.11` with the archive checksum declared in the CI workflow, then -install the build and runtime dependencies: - -```bash -sudo apt-get update -sudo apt-get install -y ca-certificates curl jq libatomic1 libgcc-s1 libstdc++6 \ - lsof maven procps protobuf-compiler protobuf-compiler-grpc-java-plugin -``` - -After selecting Dragonwell as `JAVA_HOME`, build and verify the RocksDB-only distribution: - -```bash -test "$(uname -m)" = riscv64 -"$JAVA_HOME/bin/java" -XshowSettings:vm -version -mvn clean package -Drocksdb-only -pl hugegraph-server/hugegraph-dist -am \ - -P riscv64-protobuf-tools \ - -Dmaven.test.skip=true -Dmaven.javadoc.skip=true -hugegraph-server/hugegraph-dist/src/assembly/travis/check-rocksdb-only-dist.sh \ - hugegraph-server/apache-hugegraph-server-*/ -hugegraph-server/hugegraph-dist/src/assembly/travis/run-native-runtime-smoke-test.sh \ - hugegraph-server/apache-hugegraph-server-*/ -``` +The [RISC-V Server CI](../.github/workflows/riscv64-ci.yml) validates a RocksDB-only Server build and runtime smoke test on 64-bit Linux RISC-V through QEMU. It is a correctness check, +not a performance benchmark. (other backends & non-64-bit Linux RISC-V environments are out of scope) From 6f17f14ff91d38cfef16371f9583983962d100aa Mon Sep 17 00:00:00 2001 From: imbajin Date: Mon, 27 Jul 2026 16:36:00 +0800 Subject: [PATCH 14/15] docs(readme): simplify backend architecture - streamline the deployment diagram around RocksDB and PD plus HStore - move lifecycle details behind the server compatibility guide - mark HBase test usage as deprecated compatibility --- .serena/memories/task_completion_checklist.md | 2 +- README.md | 109 +++++------------- 2 files changed, 31 insertions(+), 80 deletions(-) diff --git a/.serena/memories/task_completion_checklist.md b/.serena/memories/task_completion_checklist.md index 5e8ec4d82e..bcee316d5a 100644 --- a/.serena/memories/task_completion_checklist.md +++ b/.serena/memories/task_completion_checklist.md @@ -9,7 +9,7 @@ mvn clean compile -Dmaven.javadoc.skip=true # Compile warnings ``` ## 2. Testing -- Choose backend: `memory` (fast), `rocksdb` (realistic), `hbase` (distributed) +- Choose backend: `memory` (fast), `rocksdb` (realistic), `hbase` (deprecated compatibility) - Single test: `-Dtest=ClassName` works with all profiles - Bug fix → existing tests; New feature → write tests; Refactor → affected module tests diff --git a/README.md b/README.md index b2f8b73e4a..3cc5c90fb7 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ achieved through the powerful [Gremlin](https://tinkerpop.apache.org/gremlin.htm - **Schema Metadata Management**: VertexLabel, EdgeLabel, PropertyKey, and IndexLabel - **Multi-type Indexes**: Exact query, range query, and complex conditions combination query -- **Plug-in Backend Store Framework**: Since `1.7.0`, the maintained production backends are `RocksDB` and `HStore`; HBase is `legacy` and planned for removal in 2.0, while Memory is test-only. See the [backend evolution and historical compatibility guide](hugegraph-server/README.md#backend-evolution-and-compatibility) for `≤1.5` backends and self-maintenance guidance. +- **Plug-in Backend Store Framework**: RocksDB powers standalone deployments and HStore powers distributed clusters. See the [backend evolution guide](hugegraph-server/README.md#backend-evolution-and-compatibility) for compatibility details. - **Big Data Integration**: Seamless integration with `Flink`/`Spark`/`HDFS` - **Complete Graph Ecosystem**: In/out-memory Graph Computing + Graph Visualization & Tools + Graph Learning & AI - **Dual Query Language Support**: [Gremlin](https://tinkerpop.apache.org/gremlin.html) (via [Apache TinkerPop 3](https://tinkerpop.apache.org/)) and [Cypher](https://en.wikipedia.org/wiki/Cypher_(query_language)) (OpenCypher) @@ -57,67 +57,38 @@ Complete **HugeGraph** ecosystem components: HugeGraph supports both **standalone** and **distributed** deployments: ``` - ┌─────────────────────────────────────────────────────┐ - │ Client Layer │ - │ Gremlin Console │ REST API │ Cypher │ SDK/Tools │ - └─────────────────────────┬───────────────────────────┘ - │ - ┌─────────────────────────▼───────────────────────────┐ - │ HugeGraph Server (:8080) │ - │ ┌──────────┐ ┌──────────┐ ┌──────────────────┐ │ - │ │ REST API │ │ Gremlin │ │ Cypher Engine │ │ - │ │(Jersey 3)│ │ (TP 3.5) │ │ (OpenCypher) │ │ - │ └────┬─────┘ └────┬─────┘ └────────┬─────────┘ │ - │ └─────────────┼─────────────────┘ │ - │ ┌────────▼────────┐ │ - │ │ Graph Engine │ │ - │ │(hugegraph-core) │ │ - │ └────────┬────────┘ │ - └─────────────────────┼───────────────────────────────┘ - │ - ┌────────────────────────────────┼────────────────────────────────┐ - │ │ │ -┌────────────▼────────────┐ ┌───────────────▼───────────────┐ -│ Standalone Mode │ │ Distributed Mode │ -│ ┌───────────────────┐ │ │ ┌─────────────────────────┐ │ -│ │ RocksDB │ │ │ │ HugeGraph-PD │ │ -│ │ (embedded) │ │ │ │ (Raft, 3-5 nodes) │ │ -│ └───────────────────┘ │ │ │ :8620/:8686 │ │ -│ │ │ └────────────┬────────────┘ │ -│ Use Case: │ │ │ │ -│ Development/Testing │ │ ┌────────────▼────────────┐ │ -│ Single Node │ │ │ HugeGraph-Store │ │ -│ │ │ │ (Raft + RocksDB) │ │ -│ Data Scale: < 1TB │ │ │ (3+ nodes) :8520 │ │ -└─────────────────────────┘ │ └─────────────────────────┘ │ - │ │ - │ Use Case: │ - │ Production/HA/Cluster │ - │ │ - │ Data Scale: < 1000 TB │ - └───────────────────────────────┘ - - ┌──────────────── Current Backends ────────────────────┐ - │ RocksDB (default, embedded) and HStore (distributed) │ - └──────────────────────────────────────────────────────┘ - ┌────────────── Deprecated Backend ────────────────────┐ - │ HBase (planned for removal in 2.0) │ - └──────────────────────────────────────────────────────┘ - ┌────────────── Test-only Backend ─────────────────────┐ - │ Memory │ - └──────────────────────────────────────────────────────┘ - ┌──────────── Historical Backends (≤1.5) ──────────────┐ - │ MySQL, PostgreSQL, Cassandra, ScyllaDB, and Palo │ - │ Use and maintain a compatible historical release. │ - └──────────────────────────────────────────────────────┘ + ┌─────────────────────────────────────┐ + │ Client Layer │ + │ Gremlin Console · REST API · Cypher │ + │ SDK / Tools │ + └──────────────────┬──────────────────┘ + │ + ┌────────────────▼────────────────┐ + │ HugeGraph Server (:8080) │ + │ REST API · Gremlin · Cypher │ + │ Graph Engine (Core) │ + └────────────────┬────────────────┘ + │ + ┌─────────────────────┴─────────────────────┐ + │ │ + ┌──────────▼──────────┐ ┌──────────▼───────────┐ + │ Standalone Mode │ │ Distributed Mode │ + │ RocksDB │ │ HugeGraph-PD + HStore│ + │ default · embedded │ │ Raft cluster │ + │ │ │ │ + │ development/testing │ │ production / HA │ + │ single node · < 1TB │ │ cluster · < 1000 TB │ + └─────────────────────┘ └──────────────────────┘ ``` +See the [backend evolution guide](hugegraph-server/README.md#backend-evolution-and-compatibility) for lifecycle and historical compatibility guidance. + ### Deployment Mode Comparison | Mode | Components | Use Case | Data Scale | High Availability | |------|------------|----------|------------|-------------------| | **Standalone** | Server + RocksDB | Development, Testing, Single Node | < 1TB | Basic | -| **Distributed** | Server + PD (3-5 nodes) + Store (3+ nodes) | Production, HA, Horizontal Scaling | < 1000 TB | Yes | +| **Distributed** | Server + PD + HStore | Production, HA, Horizontal Scaling | < 1000 TB | Yes | ### Module Overview @@ -133,12 +104,7 @@ HugeGraph supports both **standalone** and **distributed** deployments: ```mermaid flowchart TB - subgraph Clients["Client Layer"] - GC[Gremlin Console] - REST[REST Client] - CYPHER[Cypher Client] - SDK[SDK/Tools] - end + CLIENTS["Client Layer
Gremlin Console · REST Client · Cypher Client · SDK/Tools"] subgraph Server["HugeGraph Server :8080"] API[REST API
Jersey 3] @@ -157,28 +123,13 @@ flowchart TB end subgraph Distributed["Distributed Mode"] - PD[HugeGraph-PD
Raft Cluster
:8620/:8686] - STORE[HugeGraph-Store
Raft + RocksDB
:8520] - PD <--> STORE - end - - subgraph Backends["Current Backends"] - HSTORE[(HStore
Distributed)] - end - - subgraph Deprecated["Deprecated Backend"] - HBASE[(HBase
Planned for removal in 2.0)] + PD_HSTORE[PD + HStore
Raft Cluster] end end - MEMORY[(Memory
Test-only)] - HISTORY["Historical Backends (≤1.5)
MySQL, PostgreSQL, Cassandra, ScyllaDB, Palo
Use and maintain a compatible historical release"] - - Clients --> Server + CLIENTS --> Server CORE --> ROCKS - CORE --> PD - CORE --> HBASE - CORE --> HSTORE + CORE --> PD_HSTORE style Server fill:#e1f5ff style Distributed fill:#fff4e1 From fa65e25f0442e9b9aab23c818f5d05dbf6947ded Mon Sep 17 00:00:00 2001 From: imbajin Date: Mon, 27 Jul 2026 16:40:14 +0800 Subject: [PATCH 15/15] docs(readme): restore architecture detail - retain the server and backend component boxes in the ASCII diagram - show HugeGraph-PD and HStore as separate distributed components - keep removed legacy backends out of the current topology --- README.md | 61 +++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 39 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 3cc5c90fb7..adf9792776 100644 --- a/README.md +++ b/README.md @@ -57,28 +57,45 @@ Complete **HugeGraph** ecosystem components: HugeGraph supports both **standalone** and **distributed** deployments: ``` - ┌─────────────────────────────────────┐ - │ Client Layer │ - │ Gremlin Console · REST API · Cypher │ - │ SDK / Tools │ - └──────────────────┬──────────────────┘ - │ - ┌────────────────▼────────────────┐ - │ HugeGraph Server (:8080) │ - │ REST API · Gremlin · Cypher │ - │ Graph Engine (Core) │ - └────────────────┬────────────────┘ - │ - ┌─────────────────────┴─────────────────────┐ - │ │ - ┌──────────▼──────────┐ ┌──────────▼───────────┐ - │ Standalone Mode │ │ Distributed Mode │ - │ RocksDB │ │ HugeGraph-PD + HStore│ - │ default · embedded │ │ Raft cluster │ - │ │ │ │ - │ development/testing │ │ production / HA │ - │ single node · < 1TB │ │ cluster · < 1000 TB │ - └─────────────────────┘ └──────────────────────┘ + ┌─────────────────────────────────────────────────────┐ + │ Client Layer │ + │ Gremlin Console │ REST API │ Cypher │ SDK/Tools │ + └─────────────────────────┬───────────────────────────┘ + │ + ┌─────────────────────────▼───────────────────────────┐ + │ HugeGraph Server (:8080) │ + │ ┌──────────┐ ┌──────────┐ ┌──────────────────┐ │ + │ │ REST API │ │ Gremlin │ │ Cypher Engine │ │ + │ │(Jersey 3)│ │ (TP 3.5) │ │ (OpenCypher) │ │ + │ └────┬─────┘ └────┬─────┘ └────────┬─────────┘ │ + │ └─────────────┼─────────────────┘ │ + │ ┌────────▼────────┐ │ + │ │ Graph Engine │ │ + │ │(hugegraph-core) │ │ + │ └────────┬────────┘ │ + └─────────────────────┼───────────────────────────────┘ + │ + ┌─────────────────┴─────────────────┐ + │ │ + ┌──────────────▼──────────────┐ ┌──────────────▼──────────────┐ + │ Standalone Mode │ │ Distributed Mode │ + │ ┌───────────────────────┐ │ │ ┌───────────────────────┐ │ + │ │ RocksDB │ │ │ │ HugeGraph-PD │ │ + │ │ (embedded) │ │ │ │ (Raft, 3-5 nodes) │ │ + │ └───────────────────────┘ │ │ │ :8620/:8686 │ │ + │ │ │ └───────────┬───────────┘ │ + │ Use Case: │ │ │ │ + │ Development/Testing │ │ ┌───────────▼───────────┐ │ + │ Single Node │ │ │ HStore │ │ + │ │ │ │ (Raft, 3+ nodes) │ │ + │ Data Scale: < 1TB │ │ │ :8520 │ │ + └─────────────────────────────┘ │ └───────────────────────┘ │ + │ │ + │ Use Case: │ + │ Production/HA/Cluster │ + │ │ + │ Data Scale: < 1000 TB │ + └─────────────────────────────┘ ``` See the [backend evolution guide](hugegraph-server/README.md#backend-evolution-and-compatibility) for lifecycle and historical compatibility guidance.