@Override public Deferred<KuduTable> call(KuduTable tableResp) throws Exception { TableIdentifierPB.Builder table = TableIdentifierPB.newBuilder() .setTableId(ByteString.copyFromUtf8(tableResp.getTableId())); return getDelayedIsCreateTableDoneDeferred(table, create, tableResp); } });
@Override public Deferred<LocatedTablet> call(List<LocatedTablet> tablets) { Preconditions.checkArgument(tablets.size() <= 1, "found more than one tablet for a single partition key"); if (tablets.isEmpty()) { // Most likely this indicates a non-covered range, but since this // could race with an alter table partitioning operation (which // clears the local table locations cache), we check again. TableLocationsCache.Entry entry = getTableLocationEntry(table.getTableId(), partitionKey); if (entry == null) { // This should be extremely rare, but a potential source of tight loops. LOG.debug("Table location expired before it could be processed; retrying."); return Deferred.fromError(new RecoverableException(Status.NotFound( "Table location expired before it could be processed"))); } if (entry.isNonCoveredRange()) { return Deferred.fromError( new NonCoveredRangeException(entry.getLowerBoundPartitionKey(), entry.getUpperBoundPartitionKey())); } return Deferred.fromResult(new LocatedTablet(entry.getTablet())); } return Deferred.fromResult(tablets.get(0)); } });
List<Master.TabletLocationsPB> locations, long ttl) throws KuduException { String tableId = table.getTableId(); String tableName = table.getName();
String tableId = table.getTableId();
@Override public Void call() throws Exception { for (int i = 0; i < 5; i++) { try (KuduClient c = new KuduClient.KuduClientBuilder(harness.getMasterAddressesAsString()) .build()) { KuduTable table = c.openTable(TABLE_NAME); for (int j = 0; j < 5; j++) { KuduScanToken.KuduScanTokenBuilder scanBuilder = c.newScanTokenBuilder(table); scanBuilder.build(); c.asyncClient.emptyTabletsCacheForTable(table.getTableId()); } } } return null; } }));
KuduRpc<?> parentRpc) { boolean hasPermit = acquireMasterLookupPermit(); String tableId = table.getTableId(); if (!hasPermit) {
session.apply(insert).join(DEFAULT_SLEEP); RemoteTablet rt = client.getTableLocationEntry(table.getTableId(), insert.partitionKey()).getTablet(); String tabletId = rt.getTabletId(); RpcProxy proxy = client.newRpcProxy(rt.getLeaderServerInfo());
final String tableId = request.getTable().getTableId(); byte[] partitionKey = request.partitionKey(); TableLocationsCache.Entry entry = getTableLocationEntry(tableId, partitionKey);
@Test(timeout = 100000) public void testBatchWithSameRow() throws Exception { KuduTable table = client.createTable(tableName, basicSchema, getBasicCreateTableOptions()); KuduSession session = client.newSession(); session.setFlushMode(SessionConfiguration.FlushMode.MANUAL_FLUSH); // Insert 25 rows, one per batch, along with 50 updates for each, and a delete at the end, // while also clearing the cache between each batch half the time. The delete is added here // so that a misplaced update would fail if it happens later than its delete. for (int i = 0; i < 25; i++) { session.apply(createInsert(table, i)); for (int j = 0; j < 50; j++) { Update update = table.newUpdate(); PartialRow row = update.getRow(); row.addInt(basicSchema.getColumnByIndex(0).getName(), i); row.addInt(basicSchema.getColumnByIndex(1).getName(), 1000); session.apply(update); } Delete del = table.newDelete(); PartialRow row = del.getRow(); row.addInt(basicSchema.getColumnByIndex(0).getName(), i); session.apply(del); session.flush(); if (i % 2 == 0) { asyncClient.emptyTabletsCacheForTable(table.getTableId()); } } assertEquals(0, countRowsInScan(client.newScannerBuilder(table).build())); }
client.emptyTabletsCacheForTable(table.getTableId()); for (int i = 101; i < 151; i++) { Insert insert = createInsert(i);