Skip to content

Commit

Permalink
Cleanup white space
Browse files Browse the repository at this point in the history
  • Loading branch information
dstuebe committed Feb 25, 2019
1 parent 008b92b commit 1e3eb65
Show file tree
Hide file tree
Showing 22 changed files with 2 additions and 54 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,5 @@ To benchmark Uppend:

```sh
./gradlew clean fatJar
java -jar build/libs/uppend-all-*.jar benchmark --help
java -jar build/libs/uppend-all-*.jar --help
```
2 changes: 0 additions & 2 deletions src/main/java/com/upserve/uppend/AppendOnlyStoreBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

import com.upserve.uppend.metrics.AppendOnlyStoreWithMetrics;

import java.util.concurrent.*;

public class AppendOnlyStoreBuilder extends FileStoreBuilder<AppendOnlyStoreBuilder> {
// Blocked Longs Config Options
public static final int DEFAULT_BLOBS_PER_BLOCK = 127;
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/com/upserve/uppend/AppendStorePartition.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
import java.util.function.*;
import java.util.stream.*;

import static java.lang.Math.min;

public class AppendStorePartition extends Partition implements Flushable, Closeable {
private static final Logger log = org.slf4j.LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());

Expand Down
1 change: 0 additions & 1 deletion src/main/java/com/upserve/uppend/BlockedLongs.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ public class BlockedLongs implements AutoCloseable, Flushable {
private final LongAdder allocCounter;
private final LongAdder valuesReadCounter;


public BlockedLongs(Path file, int valuesPerBlock, boolean readOnly) {
if (file == null) {
throw new IllegalArgumentException("null file");
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/com/upserve/uppend/CounterStorePartition.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
import java.util.function.ObjLongConsumer;
import java.util.stream.*;

import static java.lang.Math.min;

public class CounterStorePartition extends Partition {
private static final Logger log = org.slf4j.LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());

Expand Down
1 change: 0 additions & 1 deletion src/main/java/com/upserve/uppend/Partition.java
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ public void flush() {
Arrays.stream(lookups).forEach(LookupData::flush);
}


@Override
public void trim() {
Arrays.stream(lookups).forEach(LookupData::trim);
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/com/upserve/uppend/PartitionStats.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ public long getFindKeyTimer() {

public long getMaxLookupSize() { return maxLookupSize; }


@Override
public String toString() {
return "PartitionStats{" +
Expand Down Expand Up @@ -109,7 +108,6 @@ public String present(PartitionStats previous) {
"}";
}


public PartitionStats minus(PartitionStats other) {
if (Objects.isNull(other)) throw new NullPointerException("PartitionStats minus method argument is null");
return new PartitionStats(
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/upserve/uppend/blobs/FilePage.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import static java.lang.Integer.min;

/**
* Mapped Byte Buffer backed implementation of Page
* File backed implementation of Page
*/
public class FilePage implements Page {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.upserve.uppend.blobs;


import com.google.common.collect.Maps;
import org.slf4j.Logger;

Expand Down
2 changes: 0 additions & 2 deletions src/main/java/com/upserve/uppend/cli/CommandBenchmark.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ public class CommandBenchmark implements Callable<Void> {
public static final String ROOT_NAME = "Root";
public static final String STORE_NAME = "Benchmark";


@Parameters(index = "0", description = "Store path")
Path path;

Expand Down Expand Up @@ -62,7 +61,6 @@ public Void call() throws Exception {
return null;
}


private Benchmark createBenchmark() {
long keys;
long count;
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/com/upserve/uppend/cli/benchmark/Benchmark.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ public class Benchmark {
private final ForkJoinPool readerPool;
private final String ioStatArgs;


AtomicReference<PartitionStats> partitionStats;
AtomicReference<BlockStats> blockStats;

Expand Down Expand Up @@ -159,7 +158,6 @@ private TimerTask watcherTimer() {
AtomicLong read = new AtomicLong(readBytesMeter.getCount());
AtomicLong readCount = new AtomicLong(readCounter.get());


return new TimerTask() {
@Override
public void run() {
Expand Down
3 changes: 0 additions & 3 deletions src/main/java/com/upserve/uppend/lookup/LookupData.java
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,6 @@ public Long put(LookupKey key, final long value) {
return ref[0];
}


/**
* read the LookupKey by index
*
Expand All @@ -317,7 +316,6 @@ public Map.Entry<LookupKey, Long> readEntry(long keyPosition) {
return Maps.immutableEntry(readKey(keyPosition), readValue(keyPosition));
}


/**
* Read the long value associated with a particular key number
*
Expand Down Expand Up @@ -615,7 +613,6 @@ public synchronized void flush() {
flushing.set(false);
}


@Override
public void trim() {
if (!readOnly) {
Expand Down
3 changes: 0 additions & 3 deletions src/main/java/com/upserve/uppend/lookup/LookupMetadata.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import java.lang.invoke.MethodHandles;
import java.nio.*;
import java.util.Arrays;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.LongAdder;
/**
* The bisect tree is linearized as follows
Expand Down Expand Up @@ -65,7 +64,6 @@ public static LookupMetadata generateMetadata(LookupKey minKey, LookupKey maxKey
this(minKey, maxKey, keyStorageOrder, metadataGeneration, new LongAdder(), new LongAdder());
}


private LookupMetadata(LookupKey minKey, LookupKey maxKey, int[] keyStorageOrder, int metadataGeneration, LongAdder missCount, LongAdder hitCount) {
this.numKeys = keyStorageOrder.length;
this.minKey = minKey;
Expand Down Expand Up @@ -129,7 +127,6 @@ private LookupMetadata(byte[] bytes, int metadataGeneration, LongAdder missCount
* @param key the key to find and mark
* @return the position of the key
*/

public Long findKey(VirtualLongBlobStore longBlobStore, LookupKey key) {

key.setMetaDataGeneration(metadataGeneration);
Expand Down
1 change: 0 additions & 1 deletion src/test/java/com/upserve/uppend/CounterStoreTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ public void incrTwiceTwoTest() throws Exception {
assertEquals(Long.valueOf(3), store.get("partition", "foo"));
}


@Test
public void testWriteCloseReadRepeat() throws Exception {
store.set("partition", "foo", 5);
Expand Down
3 changes: 0 additions & 3 deletions src/test/java/com/upserve/uppend/TestHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@
import org.slf4j.*;

import java.lang.reflect.*;
import java.util.Random;
import java.util.concurrent.*;

public class TestHelper {

public static void resetLogger(Class clazz, String fieldName) throws Exception {
setLogger(clazz, fieldName, LoggerFactory.getLogger(clazz));
}
Expand Down Expand Up @@ -70,5 +68,4 @@ public static byte[] genBytes(int len) {
ThreadLocalRandom.current().nextBytes(bytes);
return bytes;
}

}
1 change: 0 additions & 1 deletion src/test/java/com/upserve/uppend/blobs/FilePageTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ public void putIllegalStateText() throws IOException{
when(channel.write(any(ByteBuffer.class), anyLong())).thenReturn(127);
thrown.expect(IllegalStateException.class);
filePage.put(0,new byte[130], 7);

}
@Test
public void getTest() throws IOException{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ public void testGetPosition() {
assertEquals(7, store.getPosition());
}


@Test
public void testAppendReadEmpty() {
setup(12);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ public void testConcurrent() {
}

private void concurrentHelper(int virtualBlobStoreNumber) {

VirtualLongBlobStore blobStore = new VirtualLongBlobStore(virtualBlobStoreNumber, virtualPageFile);

ConcurrentMap<Long, byte[]> testData = new ConcurrentHashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import static org.junit.Assert.assertFalse;

public class VirtualPageFileTest {

private String name = "virtual_page_file_test";
private Path rootPath = Paths.get("build/test/blobs/virtual_page_file");
private Path path = rootPath.resolve(name);
Expand Down Expand Up @@ -81,7 +80,6 @@ public void testReadOnlyTruncation() throws IOException {
Page page = instance.getOrCreatePage(5,0);
page.put(12, "abc".getBytes(), 0);


page = instance.getExistingPage(5,0);

assertEquals(313016, instance.getFileSize());
Expand Down Expand Up @@ -119,7 +117,6 @@ public void testReadOnlyTruncation() throws IOException {
assertArrayEquals("ghi".getBytes(), bytes);
}


@Test
public void testTableExtension() throws IOException {
instance = new VirtualPageFile(path, 5, 16, 16384, false);
Expand Down
11 changes: 0 additions & 11 deletions src/test/java/com/upserve/uppend/lookup/LookupDataTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import static org.junit.Assert.*;

public class LookupDataTest {

private static final int RELOAD_INTERVAL = -1;
private static final int FLUSH_THRESHOLD = -1;

Expand All @@ -44,7 +43,6 @@ public void initialize() throws Exception {
setup(false);
}


public void setup(boolean readOnly) {
metadataPageFile = new VirtualPageFile(lookupDir.resolve("metadata"), NUMBER_OF_STORES, 1024, 16384, readOnly);
mutableBlobStore = new VirtualMutableBlobStore(1, metadataPageFile);
Expand Down Expand Up @@ -124,8 +122,6 @@ public void testIncrement() {
assertEquals(Long.valueOf(12), data.getValue(key));
}



@Test
public void testFlushAndClose() throws IOException {
LookupData data = LookupData.lookupWriter(keyBlobStore, mutableBlobStore, FLUSH_THRESHOLD);
Expand Down Expand Up @@ -153,7 +149,6 @@ public void testWriteCacheUnderLoad() throws IOException {
data.putIfNotExists(new LookupKey(String.valueOf(val)), val);
});


assertEquals(100_000, data.writeCache.size());

data.flush();
Expand All @@ -169,10 +164,7 @@ public void testWriteCacheUnderLoad() throws IOException {
.forEach(val -> {
data.putIfNotExists(new LookupKey(String.valueOf(val)), val);
});

assertEquals(10, data.writeCache.size());


}

@Test
Expand Down Expand Up @@ -280,7 +272,6 @@ public void testLoadReadRepairMetadata() {

LookupMetadata expected = data.getMetadata();


mutableBlobStore.write(0, Ints.toByteArray(50));
mutableBlobStore.write(4, Ints.toByteArray(284482732)); // Invalid Check checksum

Expand All @@ -298,8 +289,6 @@ public void testLoadReadRepairMetadata() {

@Test
public void testFlushWithAppendLoad() throws ExecutionException, InterruptedException {


LookupData data = LookupData.lookupWriter(keyBlobStore, mutableBlobStore, 100);

int n = 500;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

@RunWith(MockitoJUnitRunner.class)
public class LookupMetadataTest {

private final String name = "lookupMetadata-test";
private final Path rootPath = Paths.get("build/test/lookup/lookupMetadata");
private final Path path = rootPath.resolve(name);
Expand Down Expand Up @@ -85,7 +84,6 @@ public void testInvalidContent() throws Exception {
LookupMetadata.open(metadataBlobs, 0);
}


@Test
public void testCorrectReadWrite() throws Exception {
buildSimpleTestData(metadataBlobs);
Expand Down Expand Up @@ -121,7 +119,6 @@ public void testOpenReadOnly() throws Exception {
assertEquals(2, initialMetadata.getMetadataGeneration());
}


@Test
public void testEmptyLookup() {
LookupMetadata initialMetadata = new LookupMetadata(null, null, new int[0], 1);
Expand All @@ -135,7 +132,6 @@ public void testEmptyLookup() {
assertEquals(-1, searchKey.getInsertAfterSortIndex());
assertEquals(1, searchKey.getMetaDataGeneration());
assertEquals(-1, searchKey.getPosition());

}

@Test
Expand All @@ -152,7 +148,6 @@ public void testOneKeyLookupAbove() {
assertEquals(-1, searchKey.getInsertAfterSortIndex());
assertEquals(1, searchKey.getMetaDataGeneration());
assertEquals(-1, searchKey.getPosition());

}

@Test
Expand All @@ -169,7 +164,6 @@ public void testOneKeyLookupBelow() {
assertEquals(0, searchKey.getInsertAfterSortIndex());
assertEquals(1, searchKey.getMetaDataGeneration());
assertEquals(-1, searchKey.getPosition());

}

@Test
Expand Down Expand Up @@ -206,7 +200,6 @@ public void testTwoKeyLookupBelowLower() {
assertEquals(-1, searchKey.getInsertAfterSortIndex());
assertEquals(1, searchKey.getMetaDataGeneration());
assertEquals(-1, searchKey.getPosition());

}

@Test
Expand Down Expand Up @@ -389,7 +382,6 @@ public void testManyKeysAboveLastMidpoint() {
LookupKey yKey = new LookupKey("y");
LookupMetadata metadata = new LookupMetadata(bKey, yKey, new int[]{12, 7, 8, 1, 11, 6, 3, 5, 10, 2, 0, 4, 9}, 1);


when(mockLongBlobStore.readBlob(3L)).thenReturn("m".getBytes()); // First midpoint is the 6th sort value => 3
when(mockLongBlobStore.readBlob(2L)).thenReturn("u".getBytes()); // Second midpoint is the 9th sort value => 2
when(mockLongBlobStore.readBlob(5L)).thenReturn("o".getBytes()); // Second midpoint is the 7th sort value => 5
Expand Down Expand Up @@ -429,7 +421,6 @@ public void testManyKeysAboveLastMidpoint() {
verifyNoMoreInteractions(mockLongBlobStore);
}


@Test
public void testMetadataLookup() {
AppendOnlyStoreBuilder defaults = TestHelper.getDefaultAppendStoreTestBuilder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ public void testGetName() {
assertEquals("testStore", instance.getName());
}


@Test
public void testIncrement() {
assertEquals(0, metrics.timer(MetricRegistry.name("MetricsRoot", UPPEND_COUNTER_STORE, store.getName(), INCREMENT_TIMER_METRIC_NAME)).getCount());
Expand Down

0 comments on commit 1e3eb65

Please sign in to comment.