try { ScanMetrics jobResult = scanBuilder.execute().get(); long failures = jobResult.get(ScanMetrics.Metric.FAILURE); if (failures > 0) { scanBuilder.setJob(job); try { ScanMetrics jobResult = scanBuilder.execute().get(); long failures = jobResult.get(ScanMetrics.Metric.FAILURE); if (failures > 0) {
try { ScanMetrics jobResult = scanBuilder.execute().get(); long failures = jobResult.get(ScanMetrics.Metric.FAILURE); if (failures > 0) { scanBuilder.setJob(job); try { ScanMetrics jobResult = scanBuilder.execute().get(); long failures = jobResult.get(ScanMetrics.Metric.FAILURE); if (failures > 0) {
logger.log(Level.INFO, "status for {0} {1}", new Object[]{indexName, indexStatus}); manager = (ManagementSystem) getTitanGraph().openManagement(); manager.updateIndex(manager.getGraphIndex(indexName), SchemaAction.REINDEX).get(); } catch (Exception ex) { logger.log(Level.SEVERE, null, ex);
ScanMetrics reindexSensorByTime = mgmt.updateIndex(pindex, SchemaAction.REINDEX).get(); finishSchema(); gindex = mgmt.getGraphIndex("bySensorReading"); ScanMetrics reindexBySensorReading = mgmt.updateIndex(gindex, SchemaAction.REINDEX).get(); finishSchema(); ScanMetrics reindexFriendByTime = mgmt.updateIndex(eindex, SchemaAction.REINDEX).get(); finishSchema(); assertNotEquals(0, reindexFriendByTime.getCustom(IndexRepairJob.ADDED_RECORDS_COUNT)); pindex = mgmt.getRelationIndex(mgmt.getRelationType("sensor"), "byTime"); gindex = mgmt.getGraphIndex("bySensorReading"); ScanMetrics pmetrics = mgmt.updateIndex(pindex, SchemaAction.REMOVE_INDEX).get(); ScanMetrics gmetrics = mgmt.updateIndex(gindex, SchemaAction.REMOVE_INDEX).get(); finishSchema(); assertEquals(30, pmetrics.getCustom(IndexRemoveJob.DELETED_RECORDS_COUNT));
mgmt.updateIndex(mgmt.getGraphIndex("theIndex"), SchemaAction.REGISTER_INDEX).get(); mgmt.commit(); mgmt.updateIndex(mgmt.getGraphIndex("theIndex"), SchemaAction.ENABLE_INDEX).get(); finishSchema(); finishSchema(); mgmt.updateIndex(mgmt.getGraphIndex("theIndex"), SchemaAction.REINDEX).get(); mgmt.commit(); mgmt.updateIndex(mgmt.getGraphIndex("theIndex"), SchemaAction.DISABLE_INDEX).get(); tx.commit(); mgmt.commit();
m = graph.openManagement(); index = m.getGraphIndex("verticesByAge"); ScanMetrics metrics = mri.updateIndex(index, SchemaAction.REINDEX).get(); assertEquals(6, metrics.getCustom(IndexRepairJob.ADDED_RECORDS_COUNT));
assertNotEquals(0, gmetrics.get().getCustom(IndexRemoveJob.DELETED_RECORDS_COUNT));
m = graph.openManagement(); index = m.getRelationIndex(m.getRelationType("lives"), "livesByReason"); ScanMetrics metrics = mri.updateIndex(index, SchemaAction.REINDEX).get(); assertEquals(8, metrics.getCustom(IndexRepairJob.ADDED_RECORDS_COUNT));
@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)); }
@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)); }
private ScanMetrics executeScanJob(ScanJob job) throws Exception { return graph.getBackend().buildEdgeScanJob() .setNumProcessingThreads(2) .setWorkBlockSize(100) .setJob(job) .execute().get(); }
private ScanMetrics runSimpleJob(StandardScanner scanner, ScanJob job, Configuration jobConf) throws BackendException, ExecutionException, InterruptedException { StandardScanner.Builder jobBuilder = scanner.build(); jobBuilder.setStoreName(store.getName()); jobBuilder.setJobConfiguration(jobConf); jobBuilder.setNumProcessingThreads(2); jobBuilder.setWorkBlockSize(100); jobBuilder.setTimestampProvider(times); jobBuilder.setJob(job); return jobBuilder.execute().get(); }