You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hugegraph.apache.org by je...@apache.org on 2022/11/23 13:16:24 UTC

[incubator-hugegraph] 02/02: refact(cassandra): update pom & ApiVersion & fix style

This is an automated email from the ASF dual-hosted git repository.

jermy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-hugegraph.git

commit d340420341ede1eeb7d36f6e7f7cfdc386844ed6
Author: imbajin <ji...@apache.org>
AuthorDate: Tue Nov 22 18:37:10 2022 +0800

    refact(cassandra): update pom & ApiVersion & fix  style
    
    TODO: and we need also check the 0.69 in pom
---
 hugegraph-api/pom.xml                              |  1 +
 .../org/apache/hugegraph/version/ApiVersion.java   | 43 +++++------
 .../datastax/driver/core/querybuilder/Clauses.java | 17 ++---
 .../store/cassandra/CassandraEntryIterator.java    | 21 +++---
 .../backend/store/cassandra/CassandraMetrics.java  |  9 +--
 .../store/cassandra/CassandraSessionPool.java      |  2 +-
 .../backend/store/cassandra/CassandraShard.java    | 18 ++---
 .../backend/store/cassandra/CassandraStore.java    | 27 +++----
 .../backend/store/cassandra/CassandraTable.java    |  9 +--
 .../backend/store/cassandra/CassandraTables.java   | 31 ++++----
 .../org/apache/hugegraph/version/CoreVersion.java  |  7 +-
 hugegraph-dist/src/assembly/static/bin/hugegraph   |  2 +-
 pom.xml                                            | 86 +++++-----------------
 13 files changed, 100 insertions(+), 173 deletions(-)

diff --git a/hugegraph-api/pom.xml b/hugegraph-api/pom.xml
index bdf5c3e59..381a9430c 100644
--- a/hugegraph-api/pom.xml
+++ b/hugegraph-api/pom.xml
@@ -185,6 +185,7 @@
                             </addDefaultSpecificationEntries>
                         </manifest>
                         <manifestEntries>
+                            <!-- TODO: update it -->
                             <Implementation-Version>0.69.0.0</Implementation-Version>
                         </manifestEntries>
                     </archive>
diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/version/ApiVersion.java b/hugegraph-api/src/main/java/org/apache/hugegraph/version/ApiVersion.java
index 7265d3b6b..7c793989f 100644
--- a/hugegraph-api/src/main/java/org/apache/hugegraph/version/ApiVersion.java
+++ b/hugegraph-api/src/main/java/org/apache/hugegraph/version/ApiVersion.java
@@ -24,38 +24,35 @@ import org.apache.hugegraph.util.VersionUtil.Version;
 
 public final class ApiVersion {
 
-    /**
+    /*
      * API Version change log
-     *
+     * <p>
      * version 0.2:
      * [0.2] HugeGraph-527: First add the version to the hugegraph module
      * [0.3] HugeGraph-525: Add versions check of components and api
-     * [0.4] HugeGraph-162: Add schema builder to separate client and
-     *       inner interface.
+     * [0.4] HugeGraph-162: Add schema builder to separate client and inner interface.
      * [0.5] HugeGraph-498: Support three kind of id strategy
-     *
+     * <p>
      * version 0.3:
-     *
-     * [0.6] HugeGraph-614: Add update api of VL/EL to support append and
-     *       eliminate action
+     * <p>
+     * [0.6] HugeGraph-614: Add update api of VL/EL to support append and eliminate action
      * [0.7] HugeGraph-245: Add nullable-props for vertex label and edge label
      * [0.8] HugeGraph-396: Continue to improve variables implementation
-     * [0.9] HugeGraph-894: Add vertex/edge update api to add property and
-     *       remove property
+     * [0.9] HugeGraph-894: Add vertex/edge update api to add property and remove property
      * [0.10] HugeGraph-919: Add condition query for vertex/edge list API
-     *
+     * <p>
      * version 0.4:
-     * [0.11] HugeGraph-938: Remove useless indexnames field in VL/EL API
+     * [0.11] HugeGraph-938: Remove useless index-names field in VL/EL API
      * [0.12] HugeGraph-589: Add schema id for all schema element
      * [0.13] HugeGraph-956: Support customize string/number id strategy
-     *
+     * <p>
      * version 0.5:
      * [0.14] HugeGraph-1085: Add enable_label_index to VL/EL
      * [0.15] HugeGraph-1105: Support paging for large amounts of records
      * [0.16] HugeGraph-944: Support rest shortest path, k-out, k-neighbor
      * [0.17] HugeGraph-944: Support rest shortest path, k-out, k-neighbor
      * [0.18] HugeGraph-81: Change argument "checkVertex" to "check_vertex"
-     *
+     * <p>
      * version 0.6:
      * [0.19] HugeGraph-1195: Support eliminate userdata on schema
      * [0.20] HugeGraph-1210: Add paths api to find paths between two nodes
@@ -67,13 +64,13 @@ public final class ApiVersion {
      * [0.26] HugeGraph-1273: Add some monitoring counters to integrate with
      *        gremlin's monitoring framework
      * [0.27] HugeGraph-889: Use asynchronous mechanism to do schema deletion
-     *
+     * <p>
      * version 0.8:
      * [0.28] Issue-153: Add task-cancel API
      * [0.29] Issue-39: Add rays and rings RESTful API
      * [0.30] Issue-32: Change index create API to return indexLabel and task id
      * [0.31] Issue-182: Support restore graph in restoring and merging mode
-     *
+     * <p>
      * version 0.9:
      * [0.32] Issue-250: Keep depth and degree consistent for traverser api
      * [0.33] Issue-305: Implement customized paths and crosspoints RESTful API
@@ -81,21 +78,21 @@ public final class ApiVersion {
      * [0.35] Issue-287: Support pagination when do index query
      * [0.36] Issue-360: Support paging for scan api
      * [0.37] Issue-391: Add skip_super_node for shortest path
-     * [0.38] Issue-274: Add personalrank and neighborrank RESTful API
-     *
+     * [0.38] Issue-274: Add personal-rank and neighbor-rank RESTful API
+     * <p>
      * version 0.10:
      * [0.39] Issue-522: Add profile RESTful API
      * [0.40] Issue-523: Add source_in_ring args for rings RESTful API
      * [0.41] Issue-493: Support batch updating properties by multiple strategy
      * [0.42] Issue-176: Let gremlin error response consistent with RESTful's
-     * [0.43] Issue-270 & 398: support shard-index and vertex + sortkey prefix,
+     * [0.43] Issue-270 & 398: support shard-index and vertex + sort-key prefix,
      *        and split range to rangeInt, rangeFloat, rangeLong and rangeDouble
      * [0.44] Issue-633: Support unique index
      * [0.45] Issue-673: Add 'OVERRIDE' update strategy
      * [0.46] Issue-618 & 694: Support UUID id type
      * [0.47] Issue-691: Support aggregate property
      * [0.48] Issue-686: Support get schema by names
-     *
+     * <p>
      * version 0.11:
      * [0.49] Issue-670: Support fusiform similarity API
      * [0.50] Issue-746: Support userdata for index label
@@ -121,11 +118,15 @@ public final class ApiVersion {
      * [0.69] Issue-1748: Support Cypher query RESTful API
      */
 
-    // The second parameter of Version.of() is for IDE running without JAR
+    /**
+     * The second parameter of Version.of() is for IDE running without JAR
+     * TODO: what shall we set for this version? (consider the basic compatibility)
+     */
     public static final Version VERSION = Version.of(ApiVersion.class, "0.69");
 
     public static void check() {
         // Check version of hugegraph-core. Firstly do check from version 0.3
+        // TODO: what shall we set for this version? (consider the basic compatibility)
         VersionUtil.check(CoreVersion.VERSION, "0.13", "0.14", CoreVersion.NAME);
     }
 }
diff --git a/hugegraph-cassandra/src/main/java/com/datastax/driver/core/querybuilder/Clauses.java b/hugegraph-cassandra/src/main/java/com/datastax/driver/core/querybuilder/Clauses.java
index a4fa3768e..81b88c1c4 100644
--- a/hugegraph-cassandra/src/main/java/com/datastax/driver/core/querybuilder/Clauses.java
+++ b/hugegraph-cassandra/src/main/java/com/datastax/driver/core/querybuilder/Clauses.java
@@ -28,8 +28,7 @@ import com.datastax.driver.core.querybuilder.Clause.ContainsKeyClause;
 public class Clauses {
 
     public static boolean needAllowFiltering(Clause clause) {
-        return ContainsKeyClause.class.isInstance(clause) ||
-               ContainsClause.class.isInstance(clause);
+        return clause instanceof ContainsKeyClause || clause instanceof ContainsClause;
     }
 
     public static Clause and(Clause left, Clause right) {
@@ -42,9 +41,9 @@ public class Clauses {
 
     static class BinClause extends Clause {
 
-        private Clause left;
-        private String op;
-        private Clause right;
+        private final Clause left;
+        private final String op;
+        private final Clause right;
 
         public BinClause(Clause left, String op, Clause right) {
             this.left = left;
@@ -64,11 +63,7 @@ public class Clauses {
 
         @Override
         boolean containsBindMarker() {
-            if (Utils.containsBindMarker(this.left) ||
-                Utils.containsBindMarker(this.right)) {
-                return true;
-            }
-            return false;
+            return Utils.containsBindMarker(this.left) || Utils.containsBindMarker(this.right);
         }
 
         @Override
@@ -89,7 +84,7 @@ public class Clauses {
     static class AndClause extends BinClause {
 
         public AndClause(Clause left, Clause right) {
-            super(left, "AND",  right);
+            super(left, "AND", right);
         }
     }
 }
diff --git a/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraEntryIterator.java b/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraEntryIterator.java
index 48d0ca2ad..a46b327f0 100644
--- a/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraEntryIterator.java
+++ b/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraEntryIterator.java
@@ -28,6 +28,7 @@ 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;
@@ -39,7 +40,7 @@ public class CassandraEntryIterator extends BackendEntryIterator {
     private final Iterator<Row> rows;
     private final BiFunction<BackendEntry, Row, BackendEntry> merger;
 
-    private int fetchdPageSize;
+    private int fetchedPageSize;
     private long expected;
     private BackendEntry next;
 
@@ -50,7 +51,7 @@ public class CassandraEntryIterator extends BackendEntryIterator {
         this.rows = results.iterator();
         this.merger = merger;
 
-        this.fetchdPageSize = results.getAvailableWithoutFetching();
+        this.fetchedPageSize = results.getAvailableWithoutFetching();
         this.next = null;
 
         if (query.paging()) {
@@ -60,20 +61,20 @@ public class CassandraEntryIterator extends BackendEntryIterator {
             this.expected = PageState.fromString(query.page()).offset();
             this.skipPageOffset(query.page());
             // Check the number of available rows
-            E.checkState(this.fetchdPageSize <= query.limit(),
+            E.checkState(this.fetchedPageSize <= query.limit(),
                          "Unexpected fetched page size: %s",
-                         this.fetchdPageSize);
+                         this.fetchedPageSize);
             if (results.isFullyFetched()) {
                 /*
                  * All results fetched
                  * NOTE: it may be enough or not enough for the entire page
                  */
-                this.expected = this.fetchdPageSize;
+                this.expected = this.fetchedPageSize;
             } else {
                 /*
-                 * Not fully fetched, that's fetchdPageSize == query.limit(),
+                 * Not fully fetched, that's fetchedPageSize == query.limit(),
                  *
-                 * NOTE: but there may be fetchdPageSize < query.limit(), means
+                 * 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)`
@@ -104,10 +105,10 @@ public class CassandraEntryIterator extends BackendEntryIterator {
             this.expected--;
             Row row = this.rows.next();
             if (this.query.paging()) {
-                // Update fetchdPageSize if auto fetch the next page
+                // Update fetchedPageSize if auto fetch the next page
                 if (this.expected > 0L && this.availableLocal() == 0) {
                     if (this.rows.hasNext()) {
-                        this.fetchdPageSize = this.availableLocal();
+                        this.fetchedPageSize = this.availableLocal();
                     }
                 }
             }
@@ -167,7 +168,7 @@ public class CassandraEntryIterator extends BackendEntryIterator {
             ExecutionInfo previous = infos.get(infos.size() - 2);
             PagingState page = previous.getPagingState();
             position = page.toBytes();
-            offset = this.fetchdPageSize - extra;
+            offset = this.fetchedPageSize - extra;
         } else {
             PagingState page = this.results.getExecutionInfo().getPagingState();
             if (page == null || this.expected > 0L) {
diff --git a/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraMetrics.java b/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraMetrics.java
index 4429e315d..92e8814b0 100644
--- a/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraMetrics.java
+++ b/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraMetrics.java
@@ -24,7 +24,6 @@ import java.lang.management.MemoryUsage;
 import java.net.Inet4Address;
 import java.net.Inet6Address;
 import java.net.InetAddress;
-import java.util.Collections;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -34,9 +33,6 @@ 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.tinkerpop.gremlin.util.NumberHelper;
-import org.slf4j.Logger;
-
 import org.apache.hugegraph.backend.store.BackendMetrics;
 import org.apache.hugegraph.backend.store.BackendStoreProvider;
 import org.apache.hugegraph.backend.store.BackendTable;
@@ -48,6 +44,9 @@ 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;
@@ -94,7 +93,7 @@ public class CassandraMetrics implements BackendMetrics {
     }
 
     protected List<String> tables() {
-        return Collections.unmodifiableList(this.tables);
+        return this.tables;
     }
 
     protected Map<String, Object> getMetricsByHost(String host) {
diff --git a/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraSessionPool.java b/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraSessionPool.java
index 1df3aadc1..b61a16ec9 100644
--- a/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraSessionPool.java
+++ b/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraSessionPool.java
@@ -139,7 +139,7 @@ public class CassandraSessionPool extends BackendSessionPool {
 
     /**
      * The Session class is a wrapper of driver Session
-     * Expect every thread hold a its own session(wrapper)
+     * Expect every thread hold its own session(wrapper)
      */
     public final class Session extends AbstractBackendSession {
 
diff --git a/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraShard.java b/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraShard.java
index 03bb64519..21bb93219 100644
--- a/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraShard.java
+++ b/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraShard.java
@@ -58,7 +58,8 @@ 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 https://github.com/2013Commons/hive-cassandra/
+ * Refer to AbstractColumnFamilyInputFormat from:
+ * <a href="https://github.com/2013Commons/hive-cassandra/">...</a>
  */
 public class CassandraShard {
 
@@ -89,10 +90,8 @@ public class CassandraShard {
      */
     public List<Shard> 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<Runnable>());
+        ExecutorService executor = new ThreadPoolExecutor(0, 128, 60L, TimeUnit.SECONDS,
+                                                          new LinkedBlockingQueue<>());
 
         List<Shard> splits = new ArrayList<>();
         try {
@@ -140,10 +139,8 @@ public class CassandraShard {
     public List<Shard> getSplits(String start, String end,
                                  int splitPartitions, int splitSize) {
 
-        ExecutorService executor = new ThreadPoolExecutor(
-                0, 128, 60L,
-                TimeUnit.SECONDS,
-                new LinkedBlockingQueue<Runnable>());
+        ExecutorService executor = new ThreadPoolExecutor(0, 128, 60L, TimeUnit.SECONDS,
+                                                          new LinkedBlockingQueue<>());
 
         List<Shard> splits = new ArrayList<>();
         try {
@@ -249,8 +246,7 @@ public class CassandraShard {
         /*
          * 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 smallest granularity of partition count available from
-         * CASSANDRA-7688.
+         * Assume the smallest granularity of partition count available from CASSANDRA-7688.
          */
         if (splitCount == 0) {
             return ImmutableMap.of(tokenRange, (long) 128);
diff --git a/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraStore.java b/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraStore.java
index 43fe35a67..111825a19 100644
--- a/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraStore.java
+++ b/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraStore.java
@@ -47,6 +47,7 @@ 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 com.datastax.driver.core.Cluster;
 import com.datastax.driver.core.KeyspaceMetadata;
 import com.datastax.driver.core.Session;
@@ -55,8 +56,7 @@ 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<CassandraSessionPool.Session> {
+public abstract class CassandraStore extends AbstractBackendStore<CassandraSessionPool.Session> {
 
     private static final Logger LOG = Log.logger(CassandraStore.class);
 
@@ -463,7 +463,7 @@ public abstract class CassandraStore
 
         if (session.txState() != TxState.COMMITT_FAIL &&
             session.txState() != TxState.CLEAN) {
-            LOG.warn("Store {} expect state COMMITT_FAIL/COMMITTING/CLEAN " +
+            LOG.warn("Store {} expect state COMMIT_FAIL/COMMITTING/CLEAN " +
                      "than {} when rollback()", this.store, session.txState());
         }
 
@@ -485,12 +485,8 @@ public abstract class CassandraStore
     }
 
     protected boolean existsTable(String table) {
-        KeyspaceMetadata keyspace = this.cluster().getMetadata()
-                                         .getKeyspace(this.keyspace);
-        if (keyspace != null && keyspace.getTable(table) != null) {
-            return true;
-        }
-        return false;
+        KeyspaceMetadata keyspace = this.cluster().getMetadata().getKeyspace(this.keyspace);
+        return keyspace != null && keyspace.getTable(table) != null;
     }
 
     protected void initKeyspace() {
@@ -623,12 +619,10 @@ public abstract class CassandraStore
                      "Cassandra cluster has not been connected");
     }
 
-    protected static final CassandraBackendEntry castBackendEntry(
-                                                 BackendEntry entry) {
+    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");
+            throw new BackendException("Cassandra store only supports CassandraBackendEntry");
         }
         return (CassandraBackendEntry) entry;
     }
@@ -771,7 +765,7 @@ public abstract class CassandraStore
         public void clearOlapTable(Id id) {
             String name = this.olapTableName(id);
             CassandraTable table = this.table(name);
-            if (table == null || !this.existsTable(table.table())) {
+            if (!this.existsTable(table.table())) {
                 throw new HugeException("Not exist table '%s'", name);
             }
             table.truncate(this.session(null));
@@ -781,7 +775,7 @@ public abstract class CassandraStore
         public void removeOlapTable(Id id) {
             String name = this.olapTableName(id);
             CassandraTable table = this.table(name);
-            if (table == null || !this.existsTable(table.table())) {
+            if (!this.existsTable(table.table())) {
                 throw new HugeException("Not exist table '%s'", name);
             }
             table.dropTable(this.session(null));
@@ -793,8 +787,7 @@ public abstract class CassandraStore
 
         private final CassandraTables.Meta meta;
 
-        public CassandraSystemStore(BackendStoreProvider provider,
-                                    String keyspace, String store) {
+        public CassandraSystemStore(BackendStoreProvider provider, String keyspace, String store) {
             super(provider, keyspace, store);
 
             this.meta = new CassandraTables.Meta();
diff --git a/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraTable.java b/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraTable.java
index 9f639ac5e..636429bb9 100644
--- a/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraTable.java
+++ b/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraTable.java
@@ -76,8 +76,7 @@ import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableMap;
 
 public abstract class CassandraTable
-                extends BackendTable<CassandraSessionPool.Session,
-                                     CassandraBackendEntry.Row> {
+                extends BackendTable<CassandraSessionPool.Session, CassandraBackendEntry.Row> {
 
     private static final Logger LOG = Log.logger(CassandraTable.class);
     private static final int MAX_ELEMENTS_IN_CLAUSE = 65535;
@@ -252,7 +251,7 @@ public abstract class CassandraTable
                 /*
                  * Can't set limit here `select.limit(total)`
                  * due to it will cause can't get the next page-state.
-                 * Also can't set `select.limit(total + 1)` due to it will
+                 * Also, can't set `select.limit(total + 1)` due to it will
                  * cause error "Paging state mismatch" when setPagingState().
                  */
 
@@ -566,11 +565,11 @@ public abstract class CassandraTable
         for (HugeKeys key : colNames) {
             /*
              * NOTE: eliminate from map<text, text> should just pass key,
-             * if use the following statement:
+             * 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 typefrozen<set<text>>
+             * Invalid map literal for properties of type-frozen<set<text>>
              */
             if (!columns.containsKey(key)) {
                 continue;
diff --git a/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraTables.java b/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraTables.java
index 2c3a0ca99..d546bd6aa 100644
--- a/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraTables.java
+++ b/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraTables.java
@@ -36,6 +36,7 @@ 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;
@@ -413,7 +414,7 @@ public class CassandraTables {
                 String[] idParts = EdgeId.split(id);
                 if (idParts.length == 1) {
                     // Delete edge by label
-                    return Arrays.asList((Object[]) idParts);
+                    return Arrays.asList(idParts);
                 }
                 id = IdUtil.readString(id.asString());
                 edgeId = EdgeId.parse(id.asString());
@@ -453,7 +454,7 @@ public class CassandraTables {
                 return;
             }
 
-            // The only element is label
+            // The only element is labeled
             this.deleteEdgesByLabel(session, entry.id());
         }
 
@@ -482,8 +483,7 @@ public class CassandraTables {
 
             // Delete edges
             long count = 0L;
-            for (Iterator<Row> it = rs.iterator(); it.hasNext();) {
-                Row row = it.next();
+            for (Row row : rs) {
                 Object ownerVertex = row.getObject(OWNER_VERTEX);
                 Object sortValues = row.getObject(SORT_VALUES);
                 Object otherVertex = row.getObject(OTHER_VERTEX);
@@ -643,8 +643,8 @@ public class CassandraTables {
 
             final String FIELD_VALUES = formatKey(HugeKeys.FIELD_VALUES);
             long count = 0L;
-            for (Iterator<Row> it = rs.iterator(); it.hasNext();) {
-                fieldValues = it.next().get(FIELD_VALUES, String.class);
+            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));
@@ -660,8 +660,7 @@ public class CassandraTables {
         @Override
         public void insert(CassandraSessionPool.Session session,
                            CassandraBackendEntry.Row entry) {
-            throw new BackendException(
-                      "SecondaryIndex insertion is not supported.");
+            throw new BackendException("SecondaryIndex insertion is not supported.");
         }
 
         @Override
@@ -691,8 +690,7 @@ public class CassandraTables {
         @Override
         public void insert(CassandraSessionPool.Session session,
                            CassandraBackendEntry.Row entry) {
-            throw new BackendException(
-                      "SearchIndex insertion is not supported.");
+            throw new BackendException("SearchIndex insertion is not supported.");
         }
     }
 
@@ -710,8 +708,7 @@ public class CassandraTables {
         @Override
         public void insert(CassandraSessionPool.Session session,
                            CassandraBackendEntry.Row entry) {
-            throw new BackendException(
-                      "UniqueIndex insertion is not supported.");
+            throw new BackendException("UniqueIndex insertion is not supported.");
         }
     }
 
@@ -764,8 +761,8 @@ public class CassandraTables {
 
             Long indexLabel = entry.column(HugeKeys.INDEX_LABEL_ID);
             if (indexLabel == null) {
-                throw new BackendException("Range index deletion " +
-                          "needs INDEX_LABEL_ID, but not provided.");
+                throw new BackendException("Range index deletion needs INDEX_LABEL_ID, " +
+                                           "but not provided.");
             }
 
             Delete delete = QueryBuilder.delete().from(this.table());
@@ -776,8 +773,7 @@ public class CassandraTables {
         @Override
         public void insert(CassandraSessionPool.Session session,
                            CassandraBackendEntry.Row entry) {
-            throw new BackendException(
-                      "RangeIndex insertion is not supported.");
+            throw new BackendException("RangeIndex insertion is not supported.");
         }
 
         @Override
@@ -869,8 +865,7 @@ public class CassandraTables {
         @Override
         public void insert(CassandraSessionPool.Session session,
                            CassandraBackendEntry.Row entry) {
-            throw new BackendException(
-                      "ShardIndex insertion is not supported.");
+            throw new BackendException("ShardIndex insertion is not supported.");
         }
     }
 
diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/version/CoreVersion.java b/hugegraph-core/src/main/java/org/apache/hugegraph/version/CoreVersion.java
index e47fd8fc7..d8e422f82 100644
--- a/hugegraph-core/src/main/java/org/apache/hugegraph/version/CoreVersion.java
+++ b/hugegraph-core/src/main/java/org/apache/hugegraph/version/CoreVersion.java
@@ -34,14 +34,13 @@ public class CoreVersion {
     public static final String DEFAULT_VERSION = "1.0.0";
 
     // The second parameter of Version.of() is for IDE running without JAR
-    public static final Version VERSION = Version.of(CoreVersion.class,
-                                                     DEFAULT_VERSION);
+    public static final Version VERSION = Version.of(CoreVersion.class, DEFAULT_VERSION);
 
     public static final String GREMLIN_VERSION = "3.4.3";
 
     public static void check() {
         // Check version of hugegraph-common
-        VersionUtil.check(CommonVersion.VERSION, "2.1.0", "2.2.0",
-                          CommonVersion.NAME);
+        // TODO: why shall we check it? Update it if need
+        VersionUtil.check(CommonVersion.VERSION, "2.1.0", "2.2.0", CommonVersion.NAME);
     }
 }
diff --git a/hugegraph-dist/src/assembly/static/bin/hugegraph b/hugegraph-dist/src/assembly/static/bin/hugegraph
index 953608f89..9939ececb 100644
--- a/hugegraph-dist/src/assembly/static/bin/hugegraph
+++ b/hugegraph-dist/src/assembly/static/bin/hugegraph
@@ -118,7 +118,7 @@ status() {
 
 # Get status of HugeGraphServer to ensure it is alive
 get_status() {
-    HTTP_CODE=`curl -I -s -w "%{http_code}" -o /dev/null $DETECT_URL`
+    HTTP_CODE=$(curl -I -s -w "%{http_code}" -o /dev/null $DETECT_URL)
     if [ $HTTP_CODE = 200 ]; then
         return 0
     else
diff --git a/pom.xml b/pom.xml
index a51ef9b0c..f70abdddc 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,19 +6,17 @@
     <artifactId>hugegraph</artifactId>
     <version>${revision}</version>
     <packaging>pom</packaging>
-    <prerequisites>
-        <maven>3.3.9</maven>
-    </prerequisites>
+
     <name>hugegraph</name>
-    <url>https://github.com/hugegraph/hugegraph</url>
+    <url>https://github.com/apache/hugegraph</url>
     <description>
         hugegraph is a fast-speed, highly-scalable, transactional graph database developed by baidu
     </description>
 
     <parent>
-        <groupId>org.sonatype.oss</groupId>
-        <artifactId>oss-parent</artifactId>
-        <version>7</version>
+        <groupId>org.apache</groupId>
+        <artifactId>apache</artifactId>
+        <version>23</version>
     </parent>
 
     <inceptionYear>2017</inceptionYear>
@@ -30,63 +28,16 @@
         </license>
     </licenses>
 
+    <prerequisites>
+        <maven>3.5.0</maven>
+    </prerequisites>
+
     <scm>
-        <url>https://github.com/hugegraph/hugegraph</url>
-        <connection>https://github.com/hugegraph/hugegraph</connection>
-        <developerConnection>https://github.com/hugegraph/hugegraph</developerConnection>
+        <url>https://github.com/apache/hugegraph</url>
+        <connection>https://github.com/apache/hugegraph</connection>
+        <developerConnection>https://github.com/apache/hugegraph</developerConnection>
     </scm>
 
-    <developers>
-        <developer>
-            <name>lizhangmei</name>
-            <email>javaloveme@gmail.com</email>
-        </developer>
-        <developer>
-            <name>zhoney</name>
-            <email>zhangyi89817@126.com</email>
-        </developer>
-        <developer>
-            <name>liningrui</name>
-            <email>liningrui@vip.qq.com</email>
-        </developer>
-        <developer>
-            <name>wangjiankui</name>
-            <email>wangjiankui1989@163.com</email>
-        </developer>
-        <developer>
-            <name>lizhigang</name>
-            <email>albert_liang@126.com</email>
-        </developer>
-        <developer>
-            <name>huanghaiping</name>
-            <email>954872405@qq.com</email>
-        </developer>
-        <developer>
-            <name>jishilei</name>
-            <email>littlestonelover@gmail.com</email>
-        </developer>
-        <developer>
-            <name>zhanghuimin</name>
-            <email>283157054@qq.com</email>
-        </developer>
-        <developer>
-            <name>liunanke</name>
-            <email>lnkustc@126.com</email>
-        </developer>
-        <developer>
-            <name>liujie</name>
-            <email>liujie23@unknown</email>
-        </developer>
-        <developer>
-            <name>houzhizhen</name>
-            <email>houzhizhen_101@163.com</email>
-        </developer>
-        <developer>
-            <name>zhangsuochao</name>
-            <email>mysuochao@163.com</email>
-        </developer>
-    </developers>
-
     <properties>
         <revision>1.0.0</revision>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -109,11 +60,11 @@
         <shell-executable>bash</shell-executable>
         <checkstyle.plugin.version>3.1.2</checkstyle.plugin.version>
         <checkstyle.version>8.45</checkstyle.version>
-        <hugegraph-rpc.version>1.0.0</hugegraph-rpc.version>
-        <hugegraph-common.version>1.0.0</hugegraph-common.version>
+        <hugegraph-commons.version>1.0.0</hugegraph-commons.version>
         <grpc.version>1.47.0</grpc.version>
         <protobuf.version>3.21.7</protobuf.version>
     </properties>
+
     <modules>
         <module>hugegraph-core</module>
         <module>hugegraph-api</module>
@@ -131,16 +82,16 @@
 
     <dependencyManagement>
         <dependencies>
-            <!-- hugegraph-commons -->
+            <!-- TODO: could we merge them to hugegraph-commons only? -->
             <dependency>
                 <groupId>org.apache.hugegraph</groupId>
                 <artifactId>hugegraph-rpc</artifactId>
-                <version>${hugegraph-rpc.version}</version>
+                <version>${hugegraph-commons.version}</version>
             </dependency>
             <dependency>
                 <groupId>org.apache.hugegraph</groupId>
                 <artifactId>hugegraph-common</artifactId>
-                <version>${hugegraph-common.version}</version>
+                <version>${hugegraph-commons.version}</version>
             </dependency>
 
             <!-- logging -->
@@ -608,7 +559,6 @@
                     <plugin>
                         <groupId>org.apache.maven.plugins</groupId>
                         <artifactId>maven-source-plugin</artifactId>
-                        <version>2.2.1</version>
                         <executions>
                             <execution>
                                 <id>attach-sources</id>
@@ -621,7 +571,6 @@
                     <plugin>
                         <groupId>org.apache.maven.plugins</groupId>
                         <artifactId>maven-javadoc-plugin</artifactId>
-                        <version>2.9.1</version>
                         <executions>
                             <execution>
                                 <id>attach-javadocs</id>
@@ -639,7 +588,6 @@
                     <plugin>
                         <groupId>org.apache.maven.plugins</groupId>
                         <artifactId>maven-gpg-plugin</artifactId>
-                        <version>1.5</version>
                         <executions>
                             <execution>
                                 <id>sign-artifacts</id>