public static void setInputInfo(Job job, AccumuloGraph graph, String instanceName, String zooKeepers, String principal, AuthenticationToken token, String[] authorizations) throws AccumuloSecurityException { String tableName = graph.getVerticesTableName(); setInputInfo(job, instanceName, zooKeepers, principal, token, authorizations, tableName); }
public BatchWriter getVerticesWriter() { return getWriterForTable(getVerticesTableName()); }
public Iterable<Range> listVerticesTableSplits() { return listTableSplits(getVerticesTableName()); }
public BatchWriter getVerticesWriter() { return getWriterForTable(getVerticesTableName()); }
public static void setInputInfo(Job job, AccumuloGraph graph, String instanceName, String zooKeepers, String principal, AuthenticationToken token, String[] authorizations) throws AccumuloSecurityException { String tableName = graph.getVerticesTableName(); setInputInfo(job, instanceName, zooKeepers, principal, token, authorizations, tableName); }
public Iterable<Range> listVerticesTableSplits() { return listTableSplits(getVerticesTableName()); }
public String getTableNameFromElementType(ElementType elementType) { switch (elementType) { case VERTEX: return getVerticesTableName(); case EDGE: return getEdgesTableName(); default: throw new VertexiumException("Unexpected element type: " + elementType); } }
public String getTableNameFromElementType(ElementType elementType) { switch (elementType) { case VERTEX: return getVerticesTableName(); case EDGE: return getEdgesTableName(); default: throw new VertexiumException("Unexpected element type: " + elementType); } }
public static void configure(Job job) { try { AccumuloGraphConfiguration accumuloGraphConfiguration = new AccumuloGraphConfiguration(job.getConfiguration(), "graph."); AccumuloGraph graph = AccumuloGraph.create(accumuloGraphConfiguration); String principal = accumuloGraphConfiguration.getAccumuloUsername(); AuthenticationToken token = accumuloGraphConfiguration.getAuthenticationToken(); String instanceName = accumuloGraphConfiguration.getAccumuloInstanceName(); String zooKeepers = accumuloGraphConfiguration.getZookeeperServers(); String[] authorizations = job.getConfiguration().get("titan.hadoop.input.authorizations", "").split(","); if (authorizations.length == 1 && authorizations[0].trim().length() == 0) { authorizations = new String[0]; } String tableName = graph.getVerticesTableName(); AccumuloRowInputFormat.setInputTableName(job, tableName); AccumuloRowInputFormat.setConnectorInfo(job, principal, token); ClientConfiguration clientConfig = new ClientConfiguration() .withInstance(instanceName) .withZkHosts(zooKeepers); AccumuloRowInputFormat.setZooKeeperInstance(job, clientConfig); AccumuloRowInputFormat.setScanAuthorizations(job, new org.apache.accumulo.core.security.Authorizations(authorizations)); job.getConfiguration().setStrings(VertexiumMRUtils.CONFIG_AUTHORIZATIONS, authorizations); } catch (Exception ex) { throw new VertexiumException("Could not configure", ex); } }
final Text edgesTableName = new Text(AccumuloGraph.getEdgesTableName(tableNamePrefix)); final Text dataTableName = new Text(AccumuloGraph.getDataTableName(tableNamePrefix)); final Text verticesTableName = new Text(AccumuloGraph.getVerticesTableName(tableNamePrefix)); final Text extendedDataTableName = new Text(AccumuloGraph.getExtendedDataTableName(tableNamePrefix));
final Text edgesTableName = new Text(AccumuloGraph.getEdgesTableName(tableNamePrefix)); final Text dataTableName = new Text(AccumuloGraph.getDataTableName(tableNamePrefix)); final Text verticesTableName = new Text(AccumuloGraph.getVerticesTableName(tableNamePrefix)); final Text extendedDataTableName = new Text(AccumuloGraph.getExtendedDataTableName(tableNamePrefix));
@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); } }
String zkPath = config.getZookeeperMetadataSyncPath(); this.graphMetadataStore = new AccumuloGraphMetadataStore(curatorFramework, zkPath); this.verticesTableName = getVerticesTableName(getConfiguration().getTableNamePrefix()); this.edgesTableName = getEdgesTableName(getConfiguration().getTableNamePrefix()); this.extendedDataTableName = getExtendedDataTableName(getConfiguration().getTableNamePrefix());
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; }
@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 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 ) ); }