prepare the addition of a date index

This commit is contained in:
2018-09-28 19:07:01 +02:00
parent 1d88c8dfd7
commit 24fcfd7763
11 changed files with 232 additions and 36 deletions

View File

@@ -24,11 +24,7 @@ class PdbWriter implements AutoCloseable, Flushable {
bsFile = BSFile.existingFile(pdbFile.getRootBlockNumber(), diskStorage);
final Optional<Long> optionalLastValue = bsFile.getLastValue();
if (optionalLastValue.isPresent()) {
lastEpochMilli = optionalLastValue.get();
} else {
lastEpochMilli = 0;
}
lastEpochMilli = optionalLastValue.orElse(0L);
}
public PdbFile getPdbFile() {

View File

@@ -3,7 +3,9 @@ package org.lucares.performance.db;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.time.Instant;
import java.time.OffsetDateTime;
import java.time.ZoneOffset;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -84,7 +86,9 @@ public class PerformanceDbTest {
for (long i = 0; i < n; i++) {
final long value = ThreadLocalRandom.current().nextInt(0, Integer.MAX_VALUE);
result.add(new Entry(currentTime + addToDate, value, tags));
final OffsetDateTime date = OffsetDateTime.ofInstant(Instant.ofEpochMilli(currentTime + addToDate),
ZoneOffset.UTC);
result.add(new Entry(date, value, tags));
currentTime += differenceInMs;
}