private AsyncKuduClient(AsyncKuduClientBuilder b) { this.channelFactory = b.createChannelFactory(); this.masterAddresses = b.masterAddresses; this.masterTable = new KuduTable(this, MASTER_TABLE_NAME_PLACEHOLDER, MASTER_TABLE_NAME_PLACEHOLDER, null, null, 1); this.defaultOperationTimeoutMs = b.defaultOperationTimeoutMs; this.defaultAdminOperationTimeoutMs = b.defaultAdminOperationTimeoutMs; this.defaultSocketReadTimeoutMs = b.defaultSocketReadTimeoutMs; this.statisticsDisabled = b.statisticsDisabled; this.statistics = statisticsDisabled ? null : new Statistics(); this.timer = b.timer; this.requestTracker = new RequestTracker(UUID.randomUUID().toString().replace("-", "")); this.securityContext = new SecurityContext(); this.connectionCache = new ConnectionCache( securityContext, defaultSocketReadTimeoutMs, timer, channelFactory); this.tokenReacquirer = new AuthnTokenReacquirer(this); }
@Override public KuduTable call(GetTableSchemaResponse resp) throws Exception { // When opening a table, clear the existing cached non-covered range entries. // This avoids surprises where a new table instance won't be able to see the // current range partitions of a table for up to the ttl. TableLocationsCache cache = tableLocations.get(resp.getTableId()); if (cache != null) { cache.clearNonCoveredRangeEntries(); } LOG.debug("Opened table {}", resp.getTableId()); return new KuduTable(AsyncKuduClient.this, tableName, resp.getTableId(), resp.getSchema(), resp.getPartitionSchema(), resp.getNumReplicas()); } });
return new KuduTable(AsyncKuduClient.this, tableName, resp.getTableId(),
KuduTable badTable = new KuduTable(asyncClient, "Invalid table name", "Invalid table ID", null, null, 3); asyncClient.discoverTablets(badTable, null, requestBatchSize, tabletLocations, 1000);
Schema schemaOneString = buildSchema(new ColumnSchema.ColumnSchemaBuilder("key", Type.STRING).key(true)); KuduTable table = new KuduTable(null, "one", "one", schemaOneString, defaultPartitionSchema(schemaOneString), 3); Insert oneKeyInsert = new Insert(table); new ColumnSchema.ColumnSchemaBuilder("key", Type.STRING).key(true), new ColumnSchema.ColumnSchemaBuilder("key2", Type.STRING).key(true)); KuduTable table2 = new KuduTable(null, "two", "two", schemaTwoString, defaultPartitionSchema(schemaTwoString), 3); Insert twoKeyInsert = new Insert(table2); new ColumnSchema.ColumnSchemaBuilder("key2", Type.STRING).key(true)); PartitionSchema partitionSchemaIntString = defaultPartitionSchema(schemaIntString); KuduTable table3 = new KuduTable(null, "three", "three", schemaIntString, partitionSchemaIntString, 3); Insert small = new Insert(table3);