Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix FulgoraGraphComputer readBatchSize number overflow fault #1300

Open
wants to merge 1 commit into
base: titan11
Choose a base branch
from
Open
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 @@ -52,6 +52,7 @@ public class FulgoraGraphComputer implements TitanGraphComputer {

public static final Set<String> NON_PERSISTING_KEYS = ImmutableSet.of(TraversalSideEffects.SIDE_EFFECTS,
TraversalVertexProgram.HALTED_TRAVERSERS);
public static final int WRITE_BATCH_SIZE_LIMIT = Math.floorDiv(Integer.MAX_VALUE, 10);

private VertexProgram<?> vertexProgram;
private final Set<MapReduce> mapReduces = new HashSet<>();
Expand All @@ -63,8 +64,8 @@ public class FulgoraGraphComputer implements TitanGraphComputer {
private boolean executed = false;

private int numThreads = 1;//Math.max(1,Runtime.getRuntime().availableProcessors());
private int readBatchSize = 10000;
private int writeBatchSize;
private final int readBatchSize;
private final int writeBatchSize;

private ResultGraph resultGraphMode = null;
private Persist persistMode = null;
Expand All @@ -76,6 +77,9 @@ public class FulgoraGraphComputer implements TitanGraphComputer {
public FulgoraGraphComputer(final StandardTitanGraph graph, final Configuration configuration) {
this.graph = graph;
this.writeBatchSize = configuration.get(GraphDatabaseConfiguration.BUFFER_SIZE);
if(this.writeBatchSize > WRITE_BATCH_SIZE_LIMIT) {
throw new IllegalArgumentException("Set storage.buffer-size less than Int.MAX_VALUE/10. Otherwise Fulgora readBatchSize will overflow.");
}
this.readBatchSize = this.writeBatchSize * 10;
this.name = "compute" + computerCounter.incrementAndGet();
}
Expand Down