/** * Returns a {@link GraphIndexStatusWatcher} configured to watch * {@code graphIndexName} through graph {@code g}. * <p/> * This method just instantiates an object. * Invoke {@link GraphIndexStatusWatcher#call()} to wait. * * @param g the graph through which to read index information * @param graphIndexName the name of a graph index to watch * @return */ public static GraphIndexStatusWatcher awaitGraphIndexStatus(TitanGraph g, String graphIndexName) { return new GraphIndexStatusWatcher(g, graphIndexName); }
assertTrue(ManagementSystem.awaitGraphIndexStatus(graph, "theIndex").status(SchemaStatus.REGISTERED) .timeout(TestGraphConfigs.getSchemaConvergenceTime(ChronoUnit.SECONDS), ChronoUnit.SECONDS) .call().getSucceeded()); finishSchema(); mgmt.updateIndex(mgmt.getGraphIndex("theIndex"), SchemaAction.ENABLE_INDEX);
@Test public void testRemoveGraphIndex() throws InterruptedException, BackendException, ExecutionException { tx.commit(); mgmt.commit(); // Load the "Graph of the Gods" sample data GraphOfTheGodsFactory.loadWithoutMixedIndex(graph, true); // Disable the "name" composite index TitanManagement m = graph.openManagement(); TitanGraphIndex nameIndex = m.getGraphIndex("name"); m.updateIndex(nameIndex, SchemaAction.DISABLE_INDEX); m.commit(); graph.tx().commit(); // Block until the SchemaStatus transitions to DISABLED assertTrue(ManagementSystem.awaitGraphIndexStatus(graph, "name") .status(SchemaStatus.DISABLED).call().getSucceeded()); // Remove index MapReduceIndexManagement mri = new MapReduceIndexManagement(graph); m = graph.openManagement(); TitanGraphIndex index = m.getGraphIndex("name"); ScanMetrics metrics = mri.updateIndex(index, SchemaAction.REMOVE_INDEX).get(); assertEquals(12, metrics.getCustom(IndexRemoveJob.DELETED_RECORDS_COUNT)); }
for (String indexName : indexNames) { try { GraphIndexStatusReport indexStatus = ManagementSystem.awaitGraphIndexStatus(getTitanGraph(), indexName).status(SchemaStatus.REGISTERED).call(); logger.log(Level.INFO, "status for {0} {1}", new Object[]{indexName, indexStatus}); manager = (ManagementSystem) getTitanGraph().openManagement();
/** * Returns a {@link GraphIndexStatusWatcher} configured to watch * {@code graphIndexName} through graph {@code g}. * <p/> * This method just instantiates an object. * Invoke {@link GraphIndexStatusWatcher#call()} to wait. * * @param g the graph through which to read index information * @param graphIndexName the name of a graph index to watch * @return */ public static GraphIndexStatusWatcher awaitGraphIndexStatus(TitanGraph g, String graphIndexName) { return new GraphIndexStatusWatcher(g, graphIndexName); }