public Iterable<Range> listDataTableSplits() { return listTableSplits(getDataTableName()); }
public BatchWriter getDataWriter() { return getWriterForTable(getDataTableName()); }
public BatchWriter getDataWriter() { return getWriterForTable(getDataTableName()); }
public Iterable<Range> listDataTableSplits() { return listTableSplits(getDataTableName()); }
private Map<String, byte[]> streamingPropertyValueTableDatas(List<String> dataRowKeys) { try { if (dataRowKeys.size() == 0) { return Collections.emptyMap(); } List<org.apache.accumulo.core.data.Range> ranges = dataRowKeys.stream() .map(RangeUtils::createRangeFromString) .collect(Collectors.toList()); final long timerStartTime = System.currentTimeMillis(); ScannerBase scanner = graph.createBatchScanner(graph.getDataTableName(), ranges, new org.apache.accumulo.core.security.Authorizations()); graph.getGraphLogger().logStartIterator(graph.getDataTableName(), scanner); Span trace = Trace.start("streamingPropertyValueTableData"); trace.data("dataRowKeyCount", Integer.toString(dataRowKeys.size())); try { Map<String, byte[]> results = new HashMap<>(); for (Map.Entry<Key, Value> col : scanner) { results.put(col.getKey().getRow().toString(), col.getValue().get()); } return results; } finally { scanner.close(); trace.stop(); graph.getGraphLogger().logEndIterator(System.currentTimeMillis() - timerStartTime); } } catch (Exception ex) { throw new VertexiumException(ex); } }
private Map<String, byte[]> streamingPropertyValueTableDatas(List<String> dataRowKeys) { try { if (dataRowKeys.size() == 0) { return Collections.emptyMap(); } List<org.apache.accumulo.core.data.Range> ranges = dataRowKeys.stream() .map(RangeUtils::createRangeFromString) .collect(Collectors.toList()); final long timerStartTime = System.currentTimeMillis(); ScannerBase scanner = graph.createBatchScanner(graph.getDataTableName(), ranges, new org.apache.accumulo.core.security.Authorizations()); graph.getGraphLogger().logStartIterator(graph.getDataTableName(), scanner); Span trace = Trace.start("streamingPropertyValueTableData"); trace.data("dataRowKeyCount", Integer.toString(dataRowKeys.size())); try { Map<String, byte[]> results = new HashMap<>(); for (Map.Entry<Key, Value> col : scanner) { results.put(col.getKey().getRow().toString(), col.getValue().get()); } return results; } finally { scanner.close(); trace.stop(); graph.getGraphLogger().logEndIterator(System.currentTimeMillis() - timerStartTime); } } catch (Exception ex) { throw new VertexiumException(ex); } }
private ScannerBase getScanner() throws IOException { if (closed) { throw new IOException("stream already closed"); } if (scanner != null) { return scanner; } ArrayList<Range> ranges = Lists.newArrayList(RangeUtils.createRangeFromString(dataRowKey)); timerStartTime = System.currentTimeMillis(); try { scanner = graph.createBatchScanner(graph.getDataTableName(), ranges, new org.apache.accumulo.core.security.Authorizations()); } catch (TableNotFoundException ex) { throw new VertexiumException("Could not create scanner", ex); } IteratorSetting iteratorSetting = new IteratorSetting( 80, TimestampFilter.class.getSimpleName(), TimestampFilter.class ); TimestampFilter.setStart(iteratorSetting, timestamp, true); TimestampFilter.setEnd(iteratorSetting, timestamp, true); scanner.addScanIterator(iteratorSetting); graph.getGraphLogger().logStartIterator(graph.getDataTableName(), scanner); trace = Trace.start("streamingPropertyValueTableData"); trace.data("dataRowKeyCount", Integer.toString(1)); return scanner; }
private ScannerBase getScanner() throws IOException { if (closed) { throw new IOException("stream already closed"); } if (scanner != null) { return scanner; } ArrayList<Range> ranges = Lists.newArrayList(RangeUtils.createRangeFromString(dataRowKey)); timerStartTime = System.currentTimeMillis(); try { scanner = graph.createBatchScanner(graph.getDataTableName(), ranges, new org.apache.accumulo.core.security.Authorizations()); } catch (TableNotFoundException ex) { throw new VertexiumException("Could not create scanner", ex); } IteratorSetting iteratorSetting = new IteratorSetting( 80, TimestampFilter.class.getSimpleName(), TimestampFilter.class ); TimestampFilter.setStart(iteratorSetting, timestamp, true); TimestampFilter.setEnd(iteratorSetting, timestamp, true); scanner.addScanIterator(iteratorSetting); graph.getGraphLogger().logStartIterator(graph.getDataTableName(), scanner); trace = Trace.start("streamingPropertyValueTableData"); trace.data("dataRowKeyCount", Integer.toString(1)); return scanner; }
public void execute(Options options, Authorizations authorizations) { try { org.apache.accumulo.core.security.Authorizations accumuloAuthorizations = graph.toAccumuloAuthorizations(authorizations); Scanner scanner = graph.getConnector().createScanner(graph.getDataTableName(), accumuloAuthorizations); BatchWriter writer = graph.getConnector().createBatchWriter( graph.getDataTableName(), graph.getConfiguration().createBatchWriterConfig() );
public void execute(Options options, Authorizations authorizations) { try { org.apache.accumulo.core.security.Authorizations accumuloAuthorizations = graph.toAccumuloAuthorizations(authorizations); Scanner scanner = graph.getConnector().createScanner(graph.getDataTableName(), accumuloAuthorizations); BatchWriter writer = graph.getConnector().createBatchWriter( graph.getDataTableName(), graph.getConfiguration().createBatchWriterConfig() );
ScannerBase scanner = graph.createBatchScanner(graph.getDataTableName(), ranges, new org.apache.accumulo.core.security.Authorizations()); if (timestamp != null && !DataTableRowKey.isLegacy(dataRowKey)) { IteratorSetting iteratorSetting = new IteratorSetting( GRAPH_LOGGER.logStartIterator(graph.getDataTableName(), scanner); Span trace = Trace.start("streamingPropertyValueTableData"); trace.data("dataRowKeyCount", Integer.toString(1));
ScannerBase scanner = graph.createBatchScanner(graph.getDataTableName(), ranges, new org.apache.accumulo.core.security.Authorizations()); if (timestamp != null && !DataTableRowKey.isLegacy(dataRowKey)) { IteratorSetting iteratorSetting = new IteratorSetting( GRAPH_LOGGER.logStartIterator(graph.getDataTableName(), scanner); Span trace = Trace.start("streamingPropertyValueTableData"); trace.data("dataRowKeyCount", Integer.toString(1));
@Test public void testListSplits() throws AccumuloSecurityException, TableNotFoundException, AccumuloException { SortedSet<Text> keys = new TreeSet<>(); keys.add(new Text("j")); getGraph().getConnector().tableOperations().addSplits(getGraph().getVerticesTableName(), keys); keys = new TreeSet<>(); keys.add(new Text("k")); getGraph().getConnector().tableOperations().addSplits(getGraph().getEdgesTableName(), keys); keys = new TreeSet<>(); keys.add(new Text("l")); getGraph().getConnector().tableOperations().addSplits(getGraph().getDataTableName(), keys); List<org.vertexium.Range> verticesTableSplits = toList(getGraph().listVerticesTableSplits()); assertEquals(2, verticesTableSplits.size()); assertEquals(null, verticesTableSplits.get(0).getInclusiveStart()); assertEquals("j", verticesTableSplits.get(0).getExclusiveEnd()); assertEquals("j", verticesTableSplits.get(1).getInclusiveStart()); assertEquals(null, verticesTableSplits.get(1).getExclusiveEnd()); List<org.vertexium.Range> edgesTableSplits = toList(getGraph().listEdgesTableSplits()); assertEquals(2, edgesTableSplits.size()); assertEquals(null, edgesTableSplits.get(0).getInclusiveStart()); assertEquals("k", edgesTableSplits.get(0).getExclusiveEnd()); assertEquals("k", edgesTableSplits.get(1).getInclusiveStart()); assertEquals(null, edgesTableSplits.get(1).getExclusiveEnd()); List<org.vertexium.Range> dataTableSplits = toList(getGraph().listDataTableSplits()); assertEquals(2, dataTableSplits.size()); assertEquals(null, dataTableSplits.get(0).getInclusiveStart()); assertEquals("l", dataTableSplits.get(0).getExclusiveEnd()); assertEquals("l", dataTableSplits.get(1).getInclusiveStart()); assertEquals(null, dataTableSplits.get(1).getExclusiveEnd()); }
@Override public void drop() { try { dropTableIfExists(getDataTableName()); dropTableIfExists(getEdgesTableName()); dropTableIfExists(getVerticesTableName()); dropTableIfExists(getMetadataTableName()); if (isHistoryInSeparateTable()) { dropTableIfExists(getHistoryEdgesTableName()); dropTableIfExists(getHistoryVerticesTableName()); } getSearchIndex().drop(this); } catch (Exception ex) { throw new VertexiumException("Could not drop tables", ex); } }
@Override public void drop() { try { dropTableIfExists(getDataTableName()); dropTableIfExists(getEdgesTableName()); dropTableIfExists(getVerticesTableName()); dropTableIfExists(getMetadataTableName()); if (isHistoryInSeparateTable()) { dropTableIfExists(getHistoryEdgesTableName()); dropTableIfExists(getHistoryVerticesTableName()); } getSearchIndex().drop(this); } catch (Exception ex) { throw new VertexiumException("Could not drop tables", ex); } }
@Override public void truncate() { try { this.connector.tableOperations().deleteRows(getDataTableName(), null, null); this.connector.tableOperations().deleteRows(getEdgesTableName(), null, null); this.connector.tableOperations().deleteRows(getVerticesTableName(), null, null); this.connector.tableOperations().deleteRows(getExtendedDataTableName(), null, null); this.connector.tableOperations().deleteRows(getMetadataTableName(), null, null); if (isHistoryInSeparateTable()) { this.connector.tableOperations().deleteRows(getHistoryEdgesTableName(), null, null); this.connector.tableOperations().deleteRows(getHistoryVerticesTableName(), null, null); } getSearchIndex().truncate(this); } catch (Exception ex) { throw new VertexiumException("Could not delete rows", ex); } }
@Override public void truncate() { try { this.connector.tableOperations().deleteRows(getDataTableName(), null, null); this.connector.tableOperations().deleteRows(getEdgesTableName(), null, null); this.connector.tableOperations().deleteRows(getVerticesTableName(), null, null); this.connector.tableOperations().deleteRows(getExtendedDataTableName(), null, null); this.connector.tableOperations().deleteRows(getMetadataTableName(), null, null); if (isHistoryInSeparateTable()) { this.connector.tableOperations().deleteRows(getHistoryEdgesTableName(), null, null); this.connector.tableOperations().deleteRows(getHistoryVerticesTableName(), null, null); } getSearchIndex().truncate(this); } catch (Exception ex) { throw new VertexiumException("Could not delete rows", ex); } }
public static AccumuloGraph create(AccumuloGraphConfiguration config) { if (config == null) { throw new IllegalArgumentException("config cannot be null"); } Connector connector = config.createConnector(); if (config.isHistoryInSeparateTable()) { ensureTableExists(connector, getVerticesTableName(config.getTableNamePrefix()), 1, config.getHdfsContextClasspath(), config.isCreateTables()); ensureTableExists(connector, getEdgesTableName(config.getTableNamePrefix()), 1, config.getHdfsContextClasspath(), config.isCreateTables()); ensureTableExists(connector, getHistoryVerticesTableName(config.getTableNamePrefix()), config.getMaxVersions(), config.getHdfsContextClasspath(), config.isCreateTables()); ensureTableExists(connector, getHistoryEdgesTableName(config.getTableNamePrefix()), config.getMaxVersions(), config.getHdfsContextClasspath(), config.isCreateTables()); ensureRowDeletingIteratorIsAttached(connector, getHistoryVerticesTableName(config.getTableNamePrefix())); ensureRowDeletingIteratorIsAttached(connector, getHistoryEdgesTableName(config.getTableNamePrefix())); } else { ensureTableExists(connector, getVerticesTableName(config.getTableNamePrefix()), config.getMaxVersions(), config.getHdfsContextClasspath(), config.isCreateTables()); ensureTableExists(connector, getEdgesTableName(config.getTableNamePrefix()), config.getMaxVersions(), config.getHdfsContextClasspath(), config.isCreateTables()); } ensureTableExists(connector, getExtendedDataTableName(config.getTableNamePrefix()), config.getExtendedDataMaxVersions(), config.getHdfsContextClasspath(), config.isCreateTables()); ensureTableExists(connector, getDataTableName(config.getTableNamePrefix()), 1, config.getHdfsContextClasspath(), config.isCreateTables()); ensureTableExists(connector, getMetadataTableName(config.getTableNamePrefix()), 1, config.getHdfsContextClasspath(), config.isCreateTables()); ensureRowDeletingIteratorIsAttached(connector, getVerticesTableName(config.getTableNamePrefix())); ensureRowDeletingIteratorIsAttached(connector, getEdgesTableName(config.getTableNamePrefix())); ensureRowDeletingIteratorIsAttached(connector, getDataTableName(config.getTableNamePrefix())); AccumuloGraph graph = new AccumuloGraph(config, connector); graph.setup(); return graph; }
public static AccumuloGraph create(AccumuloGraphConfiguration config) { if (config == null) { throw new IllegalArgumentException("config cannot be null"); } Connector connector = config.createConnector(); if (config.isHistoryInSeparateTable()) { ensureTableExists(connector, getVerticesTableName(config.getTableNamePrefix()), 1, config.getHdfsContextClasspath(), config.isCreateTables()); ensureTableExists(connector, getEdgesTableName(config.getTableNamePrefix()), 1, config.getHdfsContextClasspath(), config.isCreateTables()); ensureTableExists(connector, getHistoryVerticesTableName(config.getTableNamePrefix()), config.getMaxVersions(), config.getHdfsContextClasspath(), config.isCreateTables()); ensureTableExists(connector, getHistoryEdgesTableName(config.getTableNamePrefix()), config.getMaxVersions(), config.getHdfsContextClasspath(), config.isCreateTables()); ensureRowDeletingIteratorIsAttached(connector, getHistoryVerticesTableName(config.getTableNamePrefix())); ensureRowDeletingIteratorIsAttached(connector, getHistoryEdgesTableName(config.getTableNamePrefix())); } else { ensureTableExists(connector, getVerticesTableName(config.getTableNamePrefix()), config.getMaxVersions(), config.getHdfsContextClasspath(), config.isCreateTables()); ensureTableExists(connector, getEdgesTableName(config.getTableNamePrefix()), config.getMaxVersions(), config.getHdfsContextClasspath(), config.isCreateTables()); } ensureTableExists(connector, getExtendedDataTableName(config.getTableNamePrefix()), config.getExtendedDataMaxVersions(), config.getHdfsContextClasspath(), config.isCreateTables()); ensureTableExists(connector, getDataTableName(config.getTableNamePrefix()), 1, config.getHdfsContextClasspath(), config.isCreateTables()); ensureTableExists(connector, getMetadataTableName(config.getTableNamePrefix()), 1, config.getHdfsContextClasspath(), config.isCreateTables()); ensureRowDeletingIteratorIsAttached(connector, getVerticesTableName(config.getTableNamePrefix())); ensureRowDeletingIteratorIsAttached(connector, getEdgesTableName(config.getTableNamePrefix())); ensureRowDeletingIteratorIsAttached(connector, getDataTableName(config.getTableNamePrefix())); AccumuloGraph graph = new AccumuloGraph(config, connector); graph.setup(); return graph; }
public void dropGraph() throws Exception { Connector connector = createConnector(); AccumuloGraphTestUtils.ensureTableExists(connector, GraphConfiguration.DEFAULT_TABLE_NAME_PREFIX); AccumuloGraphTestUtils.dropGraph(connector, AccumuloGraph.getDataTableName(GraphConfiguration.DEFAULT_TABLE_NAME_PREFIX)); AccumuloGraphTestUtils.dropGraph(connector, AccumuloGraph.getVerticesTableName(GraphConfiguration.DEFAULT_TABLE_NAME_PREFIX)); AccumuloGraphTestUtils.dropGraph(connector, AccumuloGraph.getHistoryVerticesTableName(GraphConfiguration.DEFAULT_TABLE_NAME_PREFIX)); AccumuloGraphTestUtils.dropGraph(connector, AccumuloGraph.getEdgesTableName(GraphConfiguration.DEFAULT_TABLE_NAME_PREFIX)); AccumuloGraphTestUtils.dropGraph(connector, AccumuloGraph.getExtendedDataTableName(GraphConfiguration.DEFAULT_TABLE_NAME_PREFIX)); AccumuloGraphTestUtils.dropGraph(connector, AccumuloGraph.getHistoryEdgesTableName(GraphConfiguration.DEFAULT_TABLE_NAME_PREFIX)); AccumuloGraphTestUtils.dropGraph(connector, AccumuloGraph.getMetadataTableName(GraphConfiguration.DEFAULT_TABLE_NAME_PREFIX)); connector.securityOperations().changeUserAuthorizations( AccumuloGraphConfiguration.DEFAULT_ACCUMULO_USERNAME, new org.apache.accumulo.core.security.Authorizations( VISIBILITY_A_STRING, VISIBILITY_B_STRING, VISIBILITY_C_STRING, VISIBILITY_MIXED_CASE_STRING ) ); }