Skip to content

Commit

Permalink
tiny fix
Browse files Browse the repository at this point in the history
Change-Id: Icb9d64e5931ea949b956f301943283338fc0c241
  • Loading branch information
javeme committed Jun 8, 2021
1 parent 6566656 commit 8ecb229
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ protected Map<String, Object> 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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down Expand Up @@ -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"));
}

Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 8ecb229

Please sign in to comment.