use of com.baidu.hugegraph.structure.graph.Shard in project incubator-hugegraph-toolchain by apache.
the class CommonTraverserApiTest method testScanEdgeInPagingWithNegativeLimit.
@Test
public void testScanEdgeInPagingWithNegativeLimit() {
List<Shard> shards = edgesAPI.shards(1 * 1024 * 1024);
for (Shard shard : shards) {
String page = "";
Assert.assertThrows(ServerException.class, () -> {
edgesAPI.scan(shard, page, -1);
}, e -> {
String expect = "Invalid limit -1";
Assert.assertContains(expect, e.getMessage());
});
}
}
use of com.baidu.hugegraph.structure.graph.Shard in project incubator-hugegraph-toolchain by apache.
the class CommonTraverserApiTest method testScanVertexInPagingWithNegativeLimit.
@Test
public void testScanVertexInPagingWithNegativeLimit() {
List<Shard> shards = verticesAPI.shards(1 * 1024 * 1024);
for (Shard shard : shards) {
String page = "";
Assert.assertThrows(ServerException.class, () -> {
verticesAPI.scan(shard, page, -1);
}, e -> {
Assert.assertContains("Invalid limit -1", e.getMessage());
});
}
}
use of com.baidu.hugegraph.structure.graph.Shard in project incubator-hugegraph-toolchain by apache.
the class CommonTraverserApiTest method testScanEdgeInPaging.
@Test
public void testScanEdgeInPaging() {
List<Shard> shards = edgesAPI.shards(1 * 1024 * 1024);
List<Edge> edges = new LinkedList<>();
for (Shard shard : shards) {
String page = "";
while (page != null) {
Edges results = edgesAPI.scan(shard, page, DEFAULT_PAGE_LIMIT);
edges.addAll(ImmutableList.copyOf(results.results()));
page = results.page();
}
}
Assert.assertEquals(6, edges.size());
}
use of com.baidu.hugegraph.structure.graph.Shard in project incubator-hugegraph-toolchain by apache.
the class CommonTraverserApiTest method testScanEdge.
@Test
public void testScanEdge() {
List<Shard> shards = edgesAPI.shards(1 * 1024 * 1024);
List<Edge> edges = new LinkedList<>();
for (Shard shard : shards) {
Edges results = edgesAPI.scan(shard, null, 0L);
Assert.assertNull(results.page());
edges.addAll(ImmutableList.copyOf(results.results()));
}
Assert.assertEquals(6, edges.size());
}
use of com.baidu.hugegraph.structure.graph.Shard in project incubator-hugegraph-toolchain by apache.
the class BackupManager method backupVertices.
protected void backupVertices() {
Printer.print("Vertices backup started");
Printer.printInBackward("Vertices has been backup: ");
List<Shard> shards = retry(() -> this.client.traverser().vertexShards(splitSize()), "querying shards of vertices");
this.writeShards(this.allShardsLog(HugeType.VERTEX), shards);
for (Shard shard : shards) {
this.backupVertexShardAsync(shard);
}
this.awaitTasks();
this.postProcessFailedShard(HugeType.VERTEX);
Printer.print("%d", this.vertexCounter.get());
Printer.print("Vertices backup finished: %d", this.vertexCounter.get());
}
Aggregations