diff --git a/hugegraph-cassandra/src/main/java/com/baidu/hugegraph/backend/store/cassandra/CassandraMetrics.java b/hugegraph-cassandra/src/main/java/com/baidu/hugegraph/backend/store/cassandra/CassandraMetrics.java index b156b7bf51..0443a5f910 100644 --- a/hugegraph-cassandra/src/main/java/com/baidu/hugegraph/backend/store/cassandra/CassandraMetrics.java +++ b/hugegraph-cassandra/src/main/java/com/baidu/hugegraph/backend/store/cassandra/CassandraMetrics.java @@ -96,7 +96,7 @@ protected Map getMetricsByHost(String host) { try (NodeProbe probe = this.newNodeProbe(host)) { MemoryUsage heapUsage = probe.getHeapMemoryUsage(); metrics.put(MEM_MAX, UnitUtil.bytesToMB(heapUsage.getMax())); - metrics.put(MEM_COMMITED, + metrics.put(MEM_COMMITTED, UnitUtil.bytesToMB(heapUsage.getCommitted())); metrics.put(MEM_USED, UnitUtil.bytesToMB(heapUsage.getUsed())); metrics.put(MEM_USED + READABLE, diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/BackendMetrics.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/BackendMetrics.java index 1ea473a461..e621c2e440 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/BackendMetrics.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/BackendMetrics.java @@ -33,7 +33,7 @@ public interface BackendMetrics { // Memory related metrics public String MEM_USED = "mem_used"; - public String MEM_COMMITED = "mem_commited"; + public String MEM_COMMITTED = "mem_committed"; public String MEM_MAX = "mem_max"; public String MEM_UNIT = "mem_unit"; diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/MetricsApiTest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/MetricsApiTest.java index c7179fa576..cc5a9d39d8 100644 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/MetricsApiTest.java +++ b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/MetricsApiTest.java @@ -109,7 +109,7 @@ public void testMetricsBackend() { value instanceof Map); host = (Map) value; assertMapContains(host, "mem_max"); - assertMapContains(host, "mem_commited"); + assertMapContains(host, "mem_committed"); assertMapContains(host, "mem_used"); assertMapContains(host, "mem_used_readable"); assertMapContains(host, "mem_unit"); @@ -171,7 +171,7 @@ public void testMetricsBackend() { value instanceof Map); host = (Map) value; assertMapContains(host, "mem_max"); - assertMapContains(host, "mem_commited"); + assertMapContains(host, "mem_committed"); assertMapContains(host, "mem_used"); assertMapContains(host, "mem_used_readable"); assertMapContains(host, "mem_unit"); diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/unit/rocksdb/RocksDBSessionTest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/unit/rocksdb/RocksDBSessionTest.java index c17af2669e..daa8cf8db5 100644 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/unit/rocksdb/RocksDBSessionTest.java +++ b/hugegraph-test/src/main/java/com/baidu/hugegraph/unit/rocksdb/RocksDBSessionTest.java @@ -23,6 +23,7 @@ import java.util.HashMap; import java.util.Iterator; import java.util.Map; +import java.util.Random; import org.junit.Assume; import org.junit.Test; @@ -40,15 +41,15 @@ public void testPutGet() throws RocksDBException { Assert.assertEquals(null, value); this.rocks.session().put(TABLE, b("person:1gname"), b("James")); - this.rocks.session().put(TABLE, b("person:1gage"), b("19")); + this.rocks.session().put(TABLE, b("person:1gage"), b(19)); this.rocks.session().put(TABLE, b("person:1gcity"), b("Beijing")); this.commit(); value = s(this.rocks.session().get(TABLE, b("person:1gname"))); Assert.assertEquals("James", value); - value = s(this.rocks.session().get(TABLE, b("person:1gage"))); - Assert.assertEquals("19", value); + long age = l(this.rocks.session().get(TABLE, b("person:1gage"))); + Assert.assertEquals(19, age); value = s(this.rocks.session().get(TABLE, b("person:1gcity"))); Assert.assertEquals("Beijing", value); @@ -491,6 +492,8 @@ public void testDeleteSingle() throws RocksDBException { // NOTE: maybe return "James" here Assert.assertEquals(null, get("person:1gname")); + Assert.assertTrue(null == get("person:1gname") || + "James".equals(get("person:1gname"))); Assert.assertEquals(null, get("person:1gage")); } @@ -520,7 +523,7 @@ public void testCompact() throws RocksDBException { @Test public void testProperty() { - int count = 1234; + int count = new Random().nextInt(2048); for (int i = 0; i < count; i++) { put("key-" + i, "value" + i); }