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

[incubator-hugegraph] branch fix_tx_leak updated (72700500a -> da45601df)

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

zhaocong pushed a change to branch fix_tx_leak
in repository https://gitbox.apache.org/repos/asf/incubator-hugegraph.git


 discard 72700500a Fix tx leak
     new da45601df Fix tx leak

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (72700500a)
            \
             N -- N -- N   refs/heads/fix_tx_leak (da45601df)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../java/com/baidu/hugegraph/backend/store/BackendProviderFactory.java   | 1 -
 .../src/main/java/com/baidu/hugegraph/backend/store/ram/RamTable.java    | 1 -
 2 files changed, 2 deletions(-)


[incubator-hugegraph] 01/01: Fix tx leak

Posted by zh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit da45601df6d8683b2b85ee2f7af609ad6a1a397c
Author: coderzc <zh...@apache.org>
AuthorDate: Thu Nov 24 14:11:32 2022 +0800

    Fix tx leak
---
 .../hugegraph/backend/store/ram/RamTable.java      |  2 +-
 .../com/baidu/hugegraph/core/BaseCoreTest.java     | 45 +++++++++++++++++++++-
 .../com/baidu/hugegraph/core/CoreTestSuite.java    | 40 -------------------
 3 files changed, 44 insertions(+), 43 deletions(-)

diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/ram/RamTable.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/ram/RamTable.java
index ba2bbc4bd..e34a1b274 100644
--- a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/ram/RamTable.java
+++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/ram/RamTable.java
@@ -200,7 +200,6 @@ public final class RamTable {
         Id lastId = IdGenerator.ZERO;
         while (vertices.hasNext()) {
             Id vertex = (Id) vertices.next().id();
-            LOG.info("scan from hbase {} loadfromDB", vertex);
             if (vertex.compareTo(lastId) < 0) {
                 throw new HugeException("The ramtable feature is not " +
                                         "supported by %s backend",
@@ -503,6 +502,7 @@ public final class RamTable {
         protected long load(Iterator<Vertex> vertices) {
             Consumers<Id> consumers = new Consumers<>(this.executor, vertex -> {
                 Iterator<Edge> adjEdges = this.graph.adjacentEdges(vertex);
+                this.graph.tx().commit();
                 this.edges.put(vertex, IteratorUtils.list(adjEdges));
             }, null);
 
diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/core/BaseCoreTest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/core/BaseCoreTest.java
index 43118961e..81608c877 100644
--- a/hugegraph-test/src/main/java/com/baidu/hugegraph/core/BaseCoreTest.java
+++ b/hugegraph-test/src/main/java/com/baidu/hugegraph/core/BaseCoreTest.java
@@ -24,14 +24,21 @@ import java.util.Random;
 import org.apache.tinkerpop.gremlin.structure.Edge;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Assert;
 import org.junit.Before;
+import org.junit.BeforeClass;
 import org.slf4j.Logger;
 
 import com.baidu.hugegraph.HugeGraph;
 import com.baidu.hugegraph.HugeGraphParams;
+import com.baidu.hugegraph.backend.id.IdGenerator;
 import com.baidu.hugegraph.backend.store.BackendFeatures;
+import com.baidu.hugegraph.dist.RegisterUtil;
 import com.baidu.hugegraph.schema.SchemaManager;
+import com.baidu.hugegraph.testutil.Utils;
 import com.baidu.hugegraph.testutil.Whitebox;
+import com.baidu.hugegraph.type.define.NodeRole;
 import com.baidu.hugegraph.util.Log;
 
 public class BaseCoreTest {
@@ -39,9 +46,43 @@ public class BaseCoreTest {
     protected static final Logger LOG = Log.logger(BaseCoreTest.class);
 
     protected static final int TX_BATCH = 100;
+    private static HugeGraph graph = null;
 
-    public HugeGraph graph() {
-        return CoreTestSuite.graph();
+    public static HugeGraph graph() {
+        Assert.assertNotNull(graph);
+        //Assert.assertFalse(graph.closed());
+        return graph;
+    }
+
+    @BeforeClass
+    public static void initEnv() {
+        RegisterUtil.registerBackends();
+    }
+
+    @BeforeClass
+    public static void init() {
+        graph = Utils.open();
+        graph.clearBackend();
+        graph.initBackend();
+        graph.serverStarted(IdGenerator.of("server1"), NodeRole.MASTER);
+    }
+
+    @AfterClass
+    public static void clear() {
+        if (graph == null) {
+            return;
+        }
+
+        try {
+            graph.clearBackend();
+        } finally {
+            try {
+                graph.close();
+            } catch (Throwable e) {
+                LOG.error("Error when close()", e);
+            }
+            graph = null;
+        }
     }
 
     @Before
diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/core/CoreTestSuite.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/core/CoreTestSuite.java
index a95ff0912..f9e707011 100644
--- a/hugegraph-test/src/main/java/com/baidu/hugegraph/core/CoreTestSuite.java
+++ b/hugegraph-test/src/main/java/com/baidu/hugegraph/core/CoreTestSuite.java
@@ -54,44 +54,4 @@ import com.baidu.hugegraph.util.Log;
 })
 public class CoreTestSuite {
 
-    private static final Logger LOG = Log.logger(CoreTestSuite.class);
-
-    private static HugeGraph graph = null;
-
-    @BeforeClass
-    public static void initEnv() {
-        RegisterUtil.registerBackends();
-    }
-
-    @BeforeClass
-    public static void init() {
-        graph = Utils.open();
-        graph.clearBackend();
-        graph.initBackend();
-        graph.serverStarted(IdGenerator.of("server1"), NodeRole.MASTER);
-    }
-
-    @AfterClass
-    public static void clear() {
-        if (graph == null) {
-            return;
-        }
-
-        try {
-            graph.clearBackend();
-        } finally {
-            try {
-                graph.close();
-            } catch (Throwable e) {
-                LOG.error("Error when close()", e);
-            }
-            graph = null;
-        }
-    }
-
-    protected static HugeGraph graph() {
-        Assert.assertNotNull(graph);
-        //Assert.assertFalse(graph.closed());
-        return graph;
-    }
 }