/** * @see ScanRequest#withConsistentRead(Boolean) */ public ScanSpec withConsistentRead(Boolean consistentRead) { getRequest().withConsistentRead(consistentRead); return this; }
.withLimit(limit) .withTableName(tableName) .withConsistentRead(isConsistentRead);
.withScanFilter(this.filter.toConditions()) .withSelect(Select.COUNT) .withConsistentRead(isConsistentRead);
/** * @see ScanRequest#withConsistentRead(Boolean) */ public ScanSpec withConsistentRead(Boolean consistentRead) { getRequest().withConsistentRead(consistentRead); return this; }
private ScanResult scanWithRetries(Map<String, AttributeValue> lastEvaluatedScanKey) { ScanRequest scanRequest = new ScanRequest(). withTableName(this.dynamoTableName). withConsistentRead(true). withReturnConsumedCapacity(ReturnConsumedCapacity.TOTAL). withLimit(100). withExclusiveStartKey(lastEvaluatedScanKey); for (int tryNumber = 1; ; tryNumber++) { try { ScanResult scanResult = dynamoDBClient.scan(scanRequest); return scanResult; } catch (ProvisionedThroughputExceededException e) { if (tryNumber == 3) { throw e; } } catch (InternalServerErrorException e) { if (tryNumber == 3) { throw e; } } try { Thread.sleep(1000); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } }
protected ScanRequest createScanRequest() { return new ScanRequest().withTableName(tableName) .withConsistentRead(forceConsistentRead) .withLimit(client.scanLimit(tableName)) .withReturnConsumedCapacity(ReturnConsumedCapacity.TOTAL); } AbstractDynamoDbStore(final DynamoDBStoreManager manager, final String prefix, final String storeName) {
public ScanRequest copyScanRequest(ScanRequest request) { return new ScanRequest() .withTableName(request.getTableName()) .withTotalSegments(request.getTotalSegments()) .withSegment(request.getSegment()) .withReturnConsumedCapacity(request.getReturnConsumedCapacity()) .withLimit(request.getLimit()) .withConsistentRead(request.getConsistentRead()); } }
/** * Begins to pipe the log results by parallel scanning the table and the * consumer writing the results. */ public void pipe(final AbstractLogConsumer consumer) throws ExecutionException, InterruptedException { final DynamoDBTableScan scanner = new DynamoDBTableScan(rateLimit, client); final ScanRequest request = new ScanRequest().withTableName(tableName) .withReturnConsumedCapacity(ReturnConsumedCapacity.TOTAL) .withLimit(BootstrapConstants.SCAN_LIMIT) .withConsistentRead(consistentScan); final ParallelScanExecutor scanService = scanner .getParallelScanCompletionService(request, numSegments, threadPool, section, totalSections); while (!scanService.finished()) { SegmentedScanResult result = scanService.grab(); consumer.writeResult(result); } shutdown(true); consumer.shutdown(true); }