Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -193,13 +193,13 @@ public List<Shard> getSplits(Session session, long splitSize) {
count = 1;
}
long maxKey = this.maxKey();
double each = maxKey / count;
Double each = maxKey / count;

List<Shard> splits = new ArrayList<>((int) count);
String last = START;
long offset = 0L;
while (offset < maxKey) {
offset += each;
offset += each.longValue();
if (offset > maxKey) {
splits.add(new Shard(last, END, 0L));
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import java.io.IOException;
import java.io.Reader;
import java.io.StringReader;
import java.nio.file.Paths;
import java.util.List;
import java.util.Map;

Expand Down Expand Up @@ -110,11 +109,13 @@ public static Map<String, String> scanGraphsDir(String graphsDirPath) {

public static String writeToFile(String dir, String graphName,
HugeConfig config) {
E.checkArgument(FileUtils.getFile(dir).exists(),
"The directory '%s' must exist", dir);
String fileName = Paths.get(dir, graphName + CONF_SUFFIX).toString();
File path = FileUtils.getFile(dir);
E.checkArgument(path.exists(),
"The directory '%s' must exist", dir);
String fileName = path.getPath() + File.separator + graphName + CONF_SUFFIX;
try {
config.save(new File(fileName));
File newFile = FileUtils.getFile(fileName);
config.save(newFile);
LOG.info("Write HugeConfig to file: '{}'", fileName);
} catch (ConfigurationException e) {
throw new HugeException("Failed to write HugeConfig to file '%s'",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ private static Map<String, Object> formatMetrics(
.values();
long fileSizeBytes = 0L;
for (RegionMetrics region : regions) {
fileSizeBytes += region.getStoreFileSize().get(Size.Unit.BYTE);
Double tempValue = region.getStoreFileSize().get(Size.Unit.BYTE);
fileSizeBytes += tempValue.longValue();
}
metrics.put(DISK_USAGE, UnitUtil.bytesToGB(fileSizeBytes));
metrics.put(DISK_USAGE + READABLE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,11 @@ public long storeSize(String table) throws IOException {
//total += load.getMemStoreSizeMB() * Bytes.MB;
TableName tableName = TableName.valueOf(this.namespace, table);
for (RegionMetrics m : admin.getRegionMetrics(rs, tableName)) {
total += m.getStoreFileSize().get(Size.Unit.BYTE);
total += m.getMemStoreSize().get(Size.Unit.BYTE);
Double storeFileSize = m.getStoreFileSize().get(Size.Unit.BYTE);
total += storeFileSize.longValue();

Double memStoreFileSize = m.getMemStoreSize().get(Size.Unit.BYTE);
total += memStoreFileSize.longValue();
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5218,15 +5218,15 @@ public void testQueryBothEdgesOfVertexInPaging() {
while (page != null) {
GraphTraversal<?, ?> iterator = graph.traversal().V(james).bothE()
.has("~page", page).limit(1);
long size = IteratorUtils.count(iterator);
Long size = IteratorUtils.count(iterator);
if (size == 0L) {
// The last page is empty
Assert.assertEquals(6, count);
} else {
Assert.assertEquals(1, size);
Assert.assertEquals(1, size.intValue());
}
page = TraversalUtil.page(iterator);
count += size;
count += size.intValue();
}
Assert.assertEquals(6, count);
}
Expand All @@ -5244,15 +5244,15 @@ public void testQueryOutEdgesOfVertexInPaging() {
while (page != null) {
GraphTraversal<?, ?> iterator = graph.traversal().V(james).outE()
.has("~page", page).limit(1);
long size = IteratorUtils.count(iterator);
Long size = IteratorUtils.count(iterator);
if (size == 0L) {
// The last page is empty
Assert.assertEquals(4, count);
} else {
Assert.assertEquals(1, size);
Assert.assertEquals(1, size.intValue());
}
page = TraversalUtil.page(iterator);
count += size;
count += size.intValue();
}
Assert.assertEquals(4, count);
}
Expand All @@ -5270,15 +5270,15 @@ public void testQueryInEdgesOfVertexInPaging() {
while (page != null) {
GraphTraversal<?, ?> iterator = graph.traversal().V(james).inE()
.has("~page", page).limit(1);
long size = IteratorUtils.count(iterator);
Long size = IteratorUtils.count(iterator);
if (size == 0L) {
// The last page is empty
Assert.assertEquals(2, count);
} else {
Assert.assertEquals(1, size);
Assert.assertEquals(1, size.intValue());
}
page = TraversalUtil.page(iterator);
count += size;
count += size.intValue();
}
Assert.assertEquals(2, count);
}
Expand Down Expand Up @@ -7516,10 +7516,10 @@ private int traverseInPage(Function<String, GraphTraversal<?, ?>> fetcher) {
int count = 0;
while (page != null) {
GraphTraversal<?, ?> iterator = fetcher.apply(page);
long size = IteratorUtils.count(iterator);
Long size = IteratorUtils.count(iterator);
Assert.assertLte(1L, size);
page = TraversalUtil.page(iterator);
count += size;
count += size.intValue();
}
return count;
}
Expand Down