Skip to content
This repository was archived by the owner on Nov 14, 2024. It is now read-only.

Commit

Permalink
Excavator: Upgrades Baseline to the latest version (#6250)
Browse files Browse the repository at this point in the history
  • Loading branch information
svc-excavator-bot authored Oct 6, 2022
1 parent 8a6383b commit b522811
Show file tree
Hide file tree
Showing 69 changed files with 107 additions and 106 deletions.
2 changes: 1 addition & 1 deletion .baseline/checkstyle/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
</module>
<module name="LineLength"> <!-- Java Style Guide: No line-wrapping -->
<property name="max" value="120"/>
<property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
<property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://|\{@link"/>
</module>
<module name="TreeWalker">
<module name="SuppressionCommentFilter"/> <!-- baseline-gradle: README.md -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public static <T> RowResult<T> of(Cell cell, T value) {
cell.getRowName(),
ImmutableSortedMap.<byte[], T>orderedBy(UnsignedBytes.lexicographicalComparator())
.put(cell.getColumnName(), value)
.build());
.buildOrThrow());
}

public static <T> RowResult<T> create(byte[] row, SortedMap<byte[], T> columns) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ public DisruptorAutobatcher<I, O> build() {
new TracingEventHandler<>(handler, parameters.batchSize());

EventHandler<BatchElement<I, O>> profiledHandler =
new ProfilingEventHandler<>(tracingHandler, purpose, safeTags.build());
new ProfilingEventHandler<>(tracingHandler, purpose, safeTags.buildOrThrow());

return DisruptorAutobatcher.create(
profiledHandler,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public void tagsArePassedThrough() {
Map<String, String> customTags = ImmutableMap.<String, String>builder()
.put("tag1", "value1")
.put("tag2", "value2")
.build();
.buildOrThrow();
BatchSizeRecorder recorder = BatchSizeRecorder.create(SAFE_IDENTIFIER, customTags);

recorder.markBatchProcessed(5);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,7 @@ private CfDef createDefaultCfDef(String namespace, String tableName) {
.setCompression_options(ImmutableMap.<String, String>builder()
.put("sstable_compression", "org.apache.cassandra.io.compress.LZ4Compressor")
.put("chunk_length_kb", "4")
.build())
.buildOrThrow())
.setBloom_filter_fp_chance(0.1)
.setCaching("KEYS_ONLY")
.setDclocal_read_repair_chance(0.0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,7 @@ public Map<Cell, Value> get(TableReference tableRef, Map<Cell, Long> timestampBy
}
builder.putAll(collector.getCollectedResults());
}
return builder.build();
return builder.buildOrThrow();
} catch (Exception e) {
throw Throwables.unwrapAndThrowAtlasDbDependencyException(e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ private static Map<String, String> getCompressionOptions(Optional<TableMetadata>
.put(
CassandraConstants.CFDEF_COMPRESSION_CHUNK_LENGTH_KEY,
Integer.toString(actualCompressionBlockSizeKb))
.build();
.buildOrThrow();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ private static Map<CassandraClientPoolHostLevelMetric, DistributionOutlierContro
registerPoolMeanMetrics(metricsManager, metric, distributionOutlierController.getMeanGauge());
builder.put(metric, distributionOutlierController);
});
return builder.build();
return builder.buildOrThrow();
}

private static void registerPoolMeanMetrics(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public class CassandraTimestampUtilsTest {
ImmutableMap.<String, Pair<byte[], byte[]>>builder()
.put(COLUMN_NAME_1, Pair.create(EMPTY_BYTE_ARRAY, VALUE_1))
.put(COLUMN_NAME_2, Pair.create(EMPTY_BYTE_ARRAY, VALUE_2))
.build();
.buildOrThrow();

@Test
public void canGetValuesFromSelectionResult() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ private void seedKvs(AtlasDbServices services, int numTables, int numEntriesPerT
Cell cell = Cell.create(PtBytes.toBytes("row" + j), PtBytes.toBytes("col"));
toWrite.put(cell, PtBytes.toBytes("val" + j));
}
t.put(table, toWrite.build());
t.put(table, toWrite.buildOrThrow());
return null;
});
}
Expand All @@ -190,7 +190,7 @@ private void checkKvs(AtlasDbServices services, int numTables, int numEntriesPer
Cell cell = Cell.create(PtBytes.toBytes("row" + j), PtBytes.toBytes("col"));
expectedBuilder.put(cell, PtBytes.toBytes("val" + j));
}
Map<Cell, byte[]> expected = expectedBuilder.build();
Map<Cell, byte[]> expected = expectedBuilder.buildOrThrow();
Map<Cell, byte[]> result = t.get(table, expected.keySet());
assertThat(result.keySet()).containsExactlyInAnyOrderElementsOf(expected.keySet());
for (Map.Entry<Cell, byte[]> e : result.entrySet()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public Map<TableReference, byte[]> getMetadataForTables() {
for (TableReference table : getAllTableNames()) {
builder.put(table, getMetadataForTable(table));
}
return builder.build();
return builder.buildOrThrow();
}

protected int getMultiPutBatchCount() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ protected Map.Entry<byte[], NavigableMap<byte[], T>> computeNext() {
mapBuilder.put(peek.getKey().getColumnName(), peek.getValue());
it.next();
}
map = mapBuilder.build();
map = mapBuilder.buildOrThrow();
return Maps.immutableEntry(row, map);
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ protected RowResult<T> computeNext() {
cellIter = takeCell(it, key);
collectValueForTimestamp(key.col, cellIter, result, range, resultProducer);
}
SortedMap<byte[], T> columns = result.build();
SortedMap<byte[], T> columns = result.buildOrThrow();
if (!columns.isEmpty()) {
return RowResult.create(row, columns);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ public static Map<byte[], RowColumnRangeIterator> filterGetRowsToColumnRange(

IdentityHashMap<byte[], RowColumnRangeIterator> results = new IdentityHashMap<>();
for (Map.Entry<Sha256Hash, ImmutableSortedMap.Builder<byte[], Value>> row : rowsToColumns.entrySet()) {
SortedMap<byte[], Value> map = row.getValue().build();
SortedMap<byte[], Value> map = row.getValue().buildOrThrow();
Set<Map.Entry<byte[], Value>> subMap;
if ((columnRangeSelection.getStartCol().length == 0) && (columnRangeSelection.getEndCol().length == 0)) {
subMap = map.entrySet();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public static <T> RowResult<T> merge(RowResult<T> base, RowResult<T> overwrite)
colBuilder.putAll(overwrite.getColumns());
colBuilder.putAll(
Maps.difference(base.getColumns(), overwrite.getColumns()).entriesOnlyOnLeft());
return RowResult.create(base.getRowName(), colBuilder.build());
return RowResult.create(base.getRowName(), colBuilder.buildOrThrow());
}

public static long getApproximateSizeOfRowResult(RowResult<byte[]> rr) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,30 +86,30 @@ public final long getByHashOrStoreStreamAndMarkAsUsed(
tx,
ImmutableMap.<Long, byte[]>builder()
.put(streamId, reference)
.build());
.buildOrThrow());
return streamId;
}
Pair<Long, Sha256Hash> pair = storeStream(stream);
Preconditions.checkArgument(
hash.equals(pair.rhSide), "passed hash: %s does not equal stream hash: %s", hash, pair.rhSide);
markStreamsAsUsedInternal(
tx,
ImmutableMap.<Long, byte[]>builder().put(pair.lhSide, reference).build());
ImmutableMap.<Long, byte[]>builder().put(pair.lhSide, reference).buildOrThrow());
return pair.lhSide;
}

@Override
public void unmarkStreamAsUsed(Transaction tx, long streamId, byte[] reference) {
unmarkStreamsAsUsed(
tx,
ImmutableMap.<Long, byte[]>builder().put(streamId, reference).build());
ImmutableMap.<Long, byte[]>builder().put(streamId, reference).buildOrThrow());
}

@Override
public void markStreamAsUsed(Transaction tx, long streamId, byte[] reference) {
markStreamsAsUsed(
tx,
ImmutableMap.<Long, byte[]>builder().put(streamId, reference).build());
ImmutableMap.<Long, byte[]>builder().put(streamId, reference).buildOrThrow());
}

@Override
Expand Down Expand Up @@ -251,7 +251,7 @@ private void putMetadataAndHashIndexTask(Transaction tx, Long streamId, StreamMe
tx,
ImmutableMap.<Long, StreamMetadata>builder()
.put(streamId, metadata)
.build());
.buildOrThrow());
}

protected abstract void putMetadataAndHashIndexTask(Transaction tx, Map<Long, StreamMetadata> streamIdsToMetadata);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
public abstract class AbstractTransaction implements Transaction {
protected static final ImmutableSortedMap<byte[], RowResult<byte[]>> EMPTY_SORTED_ROWS =
ImmutableSortedMap.<byte[], RowResult<byte[]>>orderedBy(UnsignedBytes.lexicographicalComparator())
.build();
.buildOrThrow();

private TransactionType transactionType = TransactionType.DEFAULT;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,13 @@ public NavigableMap<byte[], RowResult<byte[]>> getRows(
if (shouldLoad) {
toLoad.add(row);
} else if (nonEmpty) {
inCache.put(row, RowResult.create(row, matches.build()));
inCache.put(row, RowResult.create(row, matches.buildOrThrow()));
}
}
SortedMap<byte[], RowResult<byte[]>> results = super.getRows(tableRef, toLoad, columnSelection);
cacheLoadedRows(tableRef, toLoad, columnSelection.getSelectedColumns(), results);
inCache.putAll(results);
return inCache.build();
return inCache.buildOrThrow();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public class ReadTransactionShould {
.put("getRange", new Object[] {DUMMY_THOROUGH_TABLE, RangeRequest.all()})
.put("getRanges", new Object[] {DUMMY_THOROUGH_TABLE, ImmutableList.of(RangeRequest.all())})
.put("getRangesLazy", new Object[] {DUMMY_THOROUGH_TABLE, ImmutableList.of(RangeRequest.all())})
.build();
.buildOrThrow();

private ReadTransaction readTransaction;
private CallbackAwareTransaction delegateTransaction;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public static <K, V> ImmutableMap<K, V> toMap(Iterable<Map.Entry<K, V>> it) {
for (Map.Entry<K, V> e : it) {
builder.put(e.getKey(), e.getValue());
}
return builder.build();
return builder.buildOrThrow();
}

public static <L, F, T> Function<Map.Entry<L, F>, Map.Entry<L, T>> applyValue(final Function<F, T> f) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public static <K, V> ImmutableMap<K, V> fromEntries(Iterable<? extends Map.Entry
for (Map.Entry<K, V> e : it) {
builder.put(e.getKey(), e.getValue());
}
return builder.build();
return builder.buildOrThrow();
}

public static <K1, K2, V> ImmutableMap<K2, V> transformKeys(Map<K1, V> map, Function<K1, K2> f) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class HeaderAccessUtilsTest {
.put(KEY_1, VALUE_1)
.put(KEY_2, VALUE_2)
.put(KEY_3, VALUE_3)
.build();
.buildOrThrow();

@Test
public void caseInsensitiveContainsEntryIgnoresCaseOnKeys() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ private static <T> FullDiagnosticDigest.CompletedTransactionDigest<T> transactio
Map<UUID, Set<ConjureLockDescriptor>> lockRequests = ImmutableMap.<UUID, Set<ConjureLockDescriptor>>builder()
.putAll(clientLockDigest.lockRequests())
.put(clientLockDigest.immutableTimestampRequestId(), ImmutableSet.of())
.build();
.buildOrThrow();
Map<UUID, LockDigest> lockDigests = KeyedStream.stream(lockRequests)
.map((requestId, descriptors) ->
lockDigest(descriptors, timelockLockInfo.map(info -> lockState(requestId, info))))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public final class InterceptorConnection extends AbstractInvocationHandler imple
.put("createStatement", Statement.class)
.put("prepareCall", CallableStatement.class)
.put("prepareStatement", PreparedStatement.class)
.build();
.buildOrThrow();

private InterceptorConnection(final Connection delegate) {
this.delegate = delegate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public void protocolCaseInsensitiveTest() throws IOException {
.put("\"tcp\"", ConnectionProtocol.TCP)
.put("\"TCPS\"", ConnectionProtocol.TCPS)
.put("\"tcps\"", ConnectionProtocol.TCPS)
.build();
.buildOrThrow();

for (Map.Entry<String, ConnectionProtocol> entry : serializedProtocols.entrySet()) {
ConnectionProtocol protocol = mapper.readValue(entry.getKey(), ConnectionProtocol.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ private static List<RowResult<Value>> createRowResults(
byte[] rowName = sqlRow.cell.getRowName();
if (currentRowName == null || !Arrays.equals(rowName, currentRowName)) {
if (currentRowName != null) {
rowResults.add(RowResult.create(currentRowName, currentRowCells.build()));
rowResults.add(RowResult.create(currentRowName, currentRowCells.buildOrThrow()));
}
currentRowCells = ImmutableSortedMap.orderedBy(UnsignedBytes.lexicographicalComparator());
currentRowName = rowName;
Expand All @@ -358,7 +358,7 @@ private static List<RowResult<Value>> createRowResults(
TraceStatistics.incBytesRead(value);
}
if (currentRowName != null) {
rowResults.add(RowResult.create(currentRowName, currentRowCells.build()));
rowResults.add(RowResult.create(currentRowName, currentRowCells.buildOrThrow()));
}
return rowResults;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ private void flushCurrentRow(@Output List<RowResult<Value>> results) {
}

private Optional<RowResult<Value>> getCurrentRowResult() {
ImmutableSortedMap<byte[], Value> cells = currentRowCells.build();
ImmutableSortedMap<byte[], Value> cells = currentRowCells.buildOrThrow();
if (cells.isEmpty()) {
return Optional.empty();
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public void getLongTableNamesFromMappingTableReturnsLongNames() throws TableMapp
.put("shortNameOne", "superLongNameOne")
.put("shortNameTwo", "superLongNameTwo")
.put("shortNameThree", "superLongNameThree")
.build();
.buildOrThrow();
mockShortNamesToLongNamesQuery(shortNamesToLongNames.values());

Set<String> longNames = oracleTableNameUnmapper.getLongTableNamesFromMappingTable(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ private SqlConnection setUpSqlConnection(Long lastVacuumTimestamp, Long currentT
.put("LAST", 0)
.put("current", 1)
.put("CURRENT", 1)
.build()));
.buildOrThrow()));
return sqlConnection;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ private Map<String, String> getEnvironment() {
return ImmutableMap.<String, String>builder()
.putAll(CassandraEnvironment.get())
.put("CONFIG_FILE_MOUNTPOINT", temporaryFolder.getRoot().getAbsolutePath())
.build();
.buildOrThrow();
}

private String dockerExecOnClient(String... arguments) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ private Map<Long, TransactionStatus> processReads(Map<Cell, byte[]> reads, Map<L
throw e;
}
}
return resultBuilder.build();
return resultBuilder.buildOrThrow();
}

private boolean shouldTouch() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public Map<Cell, CacheValue> getCachedValues(TableReference table, Set<Cell> cel
return ImmutableMap.<Cell, CacheValue>builder()
.putAll(locallyCachedReads)
.putAll(snapshotCachedValues)
.build();
.buildOrThrow();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ private synchronized Map<Cell, byte[]> processUncachedCells(
return ImmutableMap.<Cell, byte[]>builder()
.putAll(remoteReadValues)
.putAll(filterEmptyValues(cacheHits))
.build();
.buildOrThrow();
}

private synchronized NavigableMap<byte[], RowResult<byte[]>> processUncachedRows(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ private static Supplier<Metrics> buildMetrics(
ImmutableMap<String, String> tags = ImmutableMap.<String, String>builder()
.putAll(additionalTags)
.put(AtlasDbMetricNames.TAG_OUTCOME, outcome.name())
.build();
.buildOrThrow();
filter.ifPresent(presentFilter ->
manager.addMetricFilter(forClass, AtlasDbMetricNames.SWEEP_OUTCOME, tags, filter.get()));
manager.registerOrGet(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -903,7 +903,7 @@ protected ListenableFuture<Map<Long, Long>> getCommitTimestamps(
.putAll(AtlasFutures.getDone(preStartCommitTimestamps))
.putAll(AtlasFutures.getDone(postStartCommitTimestamps))
.putAll(partitionedTimestamps.myCommittedTransaction())
.build(),
.buildOrThrow(),
MoreExecutors.directExecutor());
}

Expand Down
Loading

0 comments on commit b522811

Please sign in to comment.