Fix to string for maps with values of type Empty

The MAX_KEY inserted into the tree had a value of one byte. This
triggered an assertion for maps with values of type Empty, because they
expected values to be empty.
Fixed by using an empty array for the value of the MAX_KEY.
This commit is contained in:
2019-08-12 08:35:40 +02:00
parent 427d7818bf
commit 0b3eb97b96
7 changed files with 103 additions and 12 deletions

View File

@@ -66,7 +66,7 @@ public class PdbFile {
@Override
public String toString() {
return "PdbFile [tags=" + tags + ", rootBlockNumber=" + rootBlockNumber + "]";
return "PdbFile [tags=" + tags + ", rootBlockNumber=" + rootBlockNumber + ", partitionId="+partitionId+"]";
}
@Override

View File

@@ -22,13 +22,13 @@ class PdbWriter implements AutoCloseable, Flushable {
private final PdbFile pdbFile;
private long lastEpochMilli;
private final TimeSeriesFile bsFile;
private final TimeSeriesFile timeSeriesFile;
public PdbWriter(final PdbFile pdbFile, final DiskStorage diskStorage) {
this.pdbFile = pdbFile;
bsFile = TimeSeriesFile.existingFile(pdbFile.getRootBlockNumber(), diskStorage);
final Optional<Long> optionalLastValue = bsFile.getLastValue(); // TODO is this last value correct?
timeSeriesFile = TimeSeriesFile.existingFile(pdbFile.getRootBlockNumber(), diskStorage);
final Optional<Long> optionalLastValue = timeSeriesFile.getLastValue(); // TODO is this last value correct?
lastEpochMilli = optionalLastValue.orElse(0L);
}
@@ -43,7 +43,7 @@ class PdbWriter implements AutoCloseable, Flushable {
public void write(final long epochMilli, final long value) throws WriteException, InvalidValueException {
try {
bsFile.appendTimeValue(epochMilli, value);
timeSeriesFile.appendTimeValue(epochMilli, value);
lastEpochMilli = epochMilli;
} catch (final RuntimeException e) {
@@ -55,12 +55,12 @@ class PdbWriter implements AutoCloseable, Flushable {
public void close() {
LOGGER.debug("close PdbWriter {}", pdbFile);
bsFile.close();
timeSeriesFile.close();
}
@Override
public void flush() {
bsFile.flush();
timeSeriesFile.flush();
}
public static void writeEntry(final PdbFile pdbFile, final DiskStorage diskStorage, final Entry... entries) {