use of com.palantir.atlasdb.performance.schema.generated.ValueStreamStore in project atlasdb by palantir.
the class StreamStoreBenchmarks method loadLargeStream.
@Benchmark
@Threads(1)
@Warmup(time = 1, timeUnit = TimeUnit.SECONDS)
@Measurement(time = 30, timeUnit = TimeUnit.SECONDS)
public void loadLargeStream(StreamingTable table) throws IOException {
long id = table.getLargeStreamId();
TransactionManager transactionManager = table.getTransactionManager();
StreamTestTableFactory tables = StreamTestTableFactory.of();
ValueStreamStore store = ValueStreamStore.of(transactionManager, tables);
try (InputStream inputStream = transactionManager.runTaskThrowOnConflict(txn -> store.loadStream(txn, id))) {
byte[] firstBytes = new byte[16];
int read = inputStream.read(firstBytes);
assertThat(read, is(16));
assertArrayEquals(table.getLargeStreamFirstBytes(), firstBytes);
}
}
use of com.palantir.atlasdb.performance.schema.generated.ValueStreamStore in project atlasdb by palantir.
the class StreamStoreBenchmarks method loadSmallStream.
@Benchmark
@Threads(1)
@Warmup(time = 1, timeUnit = TimeUnit.SECONDS)
@Measurement(time = 5, timeUnit = TimeUnit.SECONDS)
public void loadSmallStream(StreamingTable table) throws IOException {
long id = table.getSmallStreamId();
TransactionManager transactionManager = table.getTransactionManager();
StreamTestTableFactory tables = StreamTestTableFactory.of();
ValueStreamStore store = ValueStreamStore.of(transactionManager, tables);
try (InputStream inputStream = transactionManager.runTaskThrowOnConflict(txn -> store.loadStream(txn, id));
InputStreamReader reader = new InputStreamReader(inputStream, StandardCharsets.UTF_8);
BufferedReader bufferedReader = new BufferedReader(reader)) {
String line = bufferedReader.readLine();
assertThat(line, startsWith("bytes"));
}
}
use of com.palantir.atlasdb.performance.schema.generated.ValueStreamStore in project atlasdb by palantir.
the class StreamStoreBenchmarks method loadVeryLargeStream.
@Benchmark
@Threads(1)
@Warmup(time = 1, timeUnit = TimeUnit.SECONDS)
@Measurement(time = 30, timeUnit = TimeUnit.SECONDS)
public void loadVeryLargeStream(StreamingTable table) throws IOException {
long id = table.getVeryLargeStreamId();
TransactionManager transactionManager = table.getTransactionManager();
StreamTestTableFactory tables = StreamTestTableFactory.of();
ValueStreamStore store = ValueStreamStore.of(transactionManager, tables);
try (InputStream inputStream = transactionManager.runTaskThrowOnConflict(txn -> store.loadStream(txn, id))) {
byte[] firstBytes = new byte[16];
int read = inputStream.read(firstBytes);
assertThat(read, is(16));
assertArrayEquals(table.getVeryLargeStreamFirstBytes(), firstBytes);
}
}
use of com.palantir.atlasdb.performance.schema.generated.ValueStreamStore in project atlasdb by palantir.
the class StreamingTable method storeStreamForRow.
private Long storeStreamForRow(byte[] data, String rowName) {
StreamTestTableFactory tableFactory = StreamTestTableFactory.of();
ValueStreamStore streamTestStreamStore = ValueStreamStore.of(getTransactionManager(), tableFactory);
final Long streamId = streamTestStreamStore.storeStream(new ByteArrayInputStream(data)).getLhSide();
getTransactionManager().runTaskThrowOnConflict(txn -> {
KeyValueTable table = tableFactory.getKeyValueTable(txn);
KeyValueTable.KeyValueRow row = KeyValueTable.KeyValueRow.of(rowName);
KeyValueTable.StreamId id = KeyValueTable.StreamId.of(streamId);
Multimap<Persistable, ColumnValue<?>> rows = ImmutableMultimap.of(row, id);
txn.put(table.getTableRef(), ColumnValues.toCellValues(rows));
return null;
});
return streamId;
}
Aggregations