Skip to content

Commit

Permalink
Fix broken performance test (#3466)
Browse files Browse the repository at this point in the history
Signed-off-by: Florian Grieskamp <[email protected]>
  • Loading branch information
rngcntr authored Jan 18, 2023
1 parent ed5b095 commit 698a516
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@
import org.janusgraph.core.Cardinality;
import org.janusgraph.core.JanusGraph;
import org.janusgraph.core.JanusGraphFactory;
import org.janusgraph.core.JanusGraphTransaction;
import org.janusgraph.core.PropertyKey;
import org.janusgraph.core.schema.JanusGraphManagement;
import org.janusgraph.core.schema.SchemaAction;
import org.janusgraph.core.schema.SchemaStatus;
import org.janusgraph.diskstorage.configuration.ModifiableConfiguration;
import org.janusgraph.diskstorage.configuration.WriteConfiguration;
import org.janusgraph.graphdb.configuration.GraphDatabaseConfiguration;
import org.janusgraph.graphdb.database.StandardJanusGraph;
import org.janusgraph.graphdb.database.management.ManagementSystem;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode;
Expand Down Expand Up @@ -74,6 +76,8 @@ public WriteConfiguration getConfiguration() {
public void setUp() throws Exception {
graph = JanusGraphFactory.open(getConfiguration());

((StandardJanusGraph) graph).getOpenTransactions().forEach(JanusGraphTransaction::rollback);

JanusGraphManagement mgmt = graph.openManagement();
PropertyKey name = mgmt.makePropertyKey("name").dataType(String.class).cardinality(Cardinality.SINGLE).make();
mgmt.buildIndex("nameIndex", Vertex.class).addKey(name).buildCompositeIndex();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public enum SchemaAction {
/**
* Registers the index as empty which qualifies it for deletion.
*/
MARK_DISCARDED(Arrays.asList(DISABLED, REGISTERED));
MARK_DISCARDED(Arrays.asList(DISABLED, REGISTERED, DISCARDED));

private final Set<SchemaStatus> applicableStatuses;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,9 @@ protected void validateIndexStatus() {
//Must be a relation type index or a composite graph index
JanusGraphSchemaVertex schemaVertex = managementSystem.getSchemaVertex(index);
SchemaStatus actualStatus = schemaVertex.getStatus();
Preconditions.checkArgument(actualStatus == SchemaStatus.REGISTERED || actualStatus == SchemaStatus.DISABLED,
"The index [%s] must be disabled before it can be removed", indexName);
Preconditions.checkArgument(
actualStatus == SchemaStatus.REGISTERED || actualStatus == SchemaStatus.DISABLED || actualStatus == SchemaStatus.DISCARDED,
"The index [%s] must be disabled before it can be removed, but is currently [%s].", indexName, actualStatus);
}

@Override
Expand Down

0 comments on commit 698a516

Please sign in to comment.