/** * Returns a {@link RelationIndexStatusWatcher} configured to watch the index specified by * {@code relationIndexName} and {@code relationIndexType} through graph {@code g}. * <p/> * This method just instantiates an object. * Invoke {@link RelationIndexStatusWatcher#call()} to wait. * * @param g the graph through which to read index information * @param relationIndexName the name of the relation index to watch * @param relationTypeName the type on the relation index to watch * @return */ public static RelationIndexStatusWatcher awaitRelationIndexStatus(TitanGraph g, String relationIndexName, String relationTypeName) { return new RelationIndexStatusWatcher(g, relationIndexName, relationTypeName); }
@Test public void testRemoveRelationIndex() throws InterruptedException, BackendException, ExecutionException { tx.commit(); mgmt.commit(); // Load the "Graph of the Gods" sample data GraphOfTheGodsFactory.loadWithoutMixedIndex(graph, true); // Disable the "battlesByTime" index TitanManagement m = graph.openManagement(); RelationType battled = m.getRelationType("battled"); RelationTypeIndex battlesByTime = m.getRelationIndex(battled, "battlesByTime"); m.updateIndex(battlesByTime, SchemaAction.DISABLE_INDEX); m.commit(); graph.tx().commit(); // Block until the SchemaStatus transitions to DISABLED assertTrue(ManagementSystem.awaitRelationIndexStatus(graph, "battlesByTime", "battled") .status(SchemaStatus.DISABLED).call().getSucceeded()); // Remove index MapReduceIndexManagement mri = new MapReduceIndexManagement(graph); m = graph.openManagement(); battled = m.getRelationType("battled"); battlesByTime = m.getRelationIndex(battled, "battlesByTime"); ScanMetrics metrics = mri.updateIndex(battlesByTime, SchemaAction.REMOVE_INDEX).get(); assertEquals(6, metrics.getCustom(IndexRemoveJob.DELETED_RECORDS_COUNT)); }
/** * Returns a {@link RelationIndexStatusWatcher} configured to watch the index specified by * {@code relationIndexName} and {@code relationIndexType} through graph {@code g}. * <p/> * This method just instantiates an object. * Invoke {@link RelationIndexStatusWatcher#call()} to wait. * * @param g the graph through which to read index information * @param relationIndexName the name of the relation index to watch * @param relationTypeName the type on the relation index to watch * @return */ public static RelationIndexStatusWatcher awaitRelationIndexStatus(TitanGraph g, String relationIndexName, String relationTypeName) { return new RelationIndexStatusWatcher(g, relationIndexName, relationTypeName); }