public void ensureDistributed(int shardCount, PropertyColumn distributionPropertyColumn, AbstractLabel colocate) { Preconditions.checkState(getProperty(distributionPropertyColumn.getName()).isPresent(), "distributionPropertyColumn \"%s\" not found.", distributionPropertyColumn.getName()); Preconditions.checkState(getProperty(distributionPropertyColumn.getName()).get().equals(distributionPropertyColumn), "distributionPropertyColumn \"%s\" must be a property of \"%s\"", distributionPropertyColumn.getName(), this.getFullName()); Preconditions.checkArgument(getIdentifiers().contains(distributionPropertyColumn.getName()), "The distribution column must be part of the primary key"); if (!this.isDistributed()) { this.getSchema().getTopology().lock(); if (!this.isDistributed()) { TopologyManager.distributeAbstractLabel(this.sqlgGraph, this, shardCount, distributionPropertyColumn, colocate); distribute(shardCount, distributionPropertyColumn, colocate); this.uncommittedDistributionPropertyColumn = distributionPropertyColumn; this.uncommittedDistributionColocateAbstractLabel = colocate; this.uncommittedShardCount = shardCount; } } }
public void ensureDistributed(int shardCount, PropertyColumn distributionPropertyColumn, AbstractLabel colocate) { Preconditions.checkState(getProperty(distributionPropertyColumn.getName()).isPresent(), "distributionPropertyColumn \"%s\" not found.", distributionPropertyColumn.getName()); Preconditions.checkState(getProperty(distributionPropertyColumn.getName()).get().equals(distributionPropertyColumn), "distributionPropertyColumn \"%s\" must be a property of \"%s\"", distributionPropertyColumn.getName(), this.getFullName()); Preconditions.checkArgument(getIdentifiers().contains(distributionPropertyColumn.getName()), "The distribution column must be part of the primary key"); if (!this.isDistributed()) { this.getSchema().getTopology().lock(); if (!this.isDistributed()) { TopologyManager.distributeAbstractLabel(this.sqlgGraph, this, shardCount, distributionPropertyColumn, colocate); distribute(shardCount, distributionPropertyColumn, colocate); this.uncommittedDistributionPropertyColumn = distributionPropertyColumn; this.uncommittedDistributionColocateAbstractLabel = colocate; this.uncommittedShardCount = shardCount; } } }
Preconditions.checkState(vertices.size() != 0, "Found no vertex for %s", abstractLabel.getFullName()); Preconditions.checkState(vertices.size() == 1, "Found more than one vertex for %s", abstractLabel.getFullName()); Vertex vertex = vertices.get(0); .has(SQLG_SCHEMA_PROPERTY_NAME, distributionPropertyColumn.getName()) .toList(); Preconditions.checkState(distributionColumnPropertyVertices.size() == 1, "VertexLabel %s must have one and only only one property with name %s", abstractLabel.getFullName(), distributionPropertyColumn.getName()); Vertex distributionPropertyVertex = distributionColumnPropertyVertices.get(0); .has("name", colocate.getName()) .toList(); Preconditions.checkState(colocateVertices.size() == 1, "Did not find the colocate %s vertex", colocate.getFullName()); Vertex colocateVertex = colocateVertices.get(0); if (abstractLabel instanceof VertexLabel) {
Preconditions.checkState(vertices.size() != 0, "Found no vertex for %s", abstractLabel.getFullName()); Preconditions.checkState(vertices.size() == 1, "Found more than one vertex for %s", abstractLabel.getFullName()); Vertex vertex = vertices.get(0); .has(SQLG_SCHEMA_PROPERTY_NAME, distributionPropertyColumn.getName()) .toList(); Preconditions.checkState(distributionColumnPropertyVertices.size() == 1, "VertexLabel %s must have one and only only one property with name %s", abstractLabel.getFullName(), distributionPropertyColumn.getName()); Vertex distributionPropertyVertex = distributionColumnPropertyVertices.get(0); .has("name", colocate.getName()) .toList(); Preconditions.checkState(colocateVertices.size() == 1, "Did not find the colocate %s vertex", colocate.getFullName()); Vertex colocateVertex = colocateVertices.get(0); if (abstractLabel instanceof VertexLabel) {