Skip to content

Commit

Permalink
minor
Browse files Browse the repository at this point in the history
  • Loading branch information
tomfran committed Oct 13, 2023
1 parent 98b8593 commit fde2dc0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/main/java/com/tomfran/lsm/memtable/Memtable.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.tomfran.lsm.memtable;

import com.tomfran.lsm.types.ByteArrayPair;
import com.tomfran.lsm.utils.UniqueSortedIterator;

import java.util.Iterator;

Expand Down Expand Up @@ -34,7 +35,7 @@ public int size() {

@Override
public Iterator<ByteArrayPair> iterator() {
return list.iterator();
return new UniqueSortedIterator<>(list.iterator());
}

}
6 changes: 3 additions & 3 deletions src/main/java/com/tomfran/lsm/sstable/SSTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import java.io.File;
import java.util.Iterator;
import java.util.List;

import static com.tomfran.lsm.comparator.ByteArrayComparator.compare;
import static java.util.Arrays.stream;
Expand Down Expand Up @@ -257,9 +258,8 @@ private void writeItems(String filename, Iterator<ByteArrayPair> items, int samp
}

public void deleteFiles() {
new File(filename + DATA_FILE_EXTENSION).delete();
new File(filename + INDEX_FILE_EXTENSION).delete();
new File(filename + BLOOM_FILE_EXTENSION).delete();
for (var extension : List.of(DATA_FILE_EXTENSION, INDEX_FILE_EXTENSION, BLOOM_FILE_EXTENSION))
new File(filename + extension).delete();
}

private static class SSTableIterator implements Iterator<ByteArrayPair> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ static void tearDown() {
"False positive rate is not close to the expected value: " + avg;
}

@RepeatedTest(10)
@RepeatedTest(5)
void testAdd() {
b = new BloomFilter(INSERTIONS, FALSE_POSITIVE_RATE);

Expand Down

0 comments on commit fde2dc0

Please sign in to comment.