improve trace logging
- Add filename for trace logs for read/write operations.
This commit is contained in:
@@ -43,4 +43,8 @@ class DocEncoderDecoder implements PartitionAwareEncoderDecoder<Doc, Doc> {
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
public byte[] getEmptyValue() {
|
||||
return new byte[] {0};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,4 +33,8 @@ public final class PartitionAwareWrapper<O> implements PartitionAwareEncoderDeco
|
||||
public static <O> PartitionAwareEncoderDecoder<O, O> wrap(final EncoderDecoder<O> encoder) {
|
||||
return new PartitionAwareWrapper<>(encoder);
|
||||
}
|
||||
|
||||
public byte[] getEmptyValue() {
|
||||
return delegate.getEmptyValue();
|
||||
}
|
||||
}
|
||||
@@ -24,7 +24,7 @@ public class PartitionDiskStore {
|
||||
creator = partitionId -> {
|
||||
final Path file = storageBasePath.resolve(partitionId.getPartitionId()).resolve(filename);
|
||||
final boolean isNew = !Files.exists(file);
|
||||
final DiskStorage diskStorage = new DiskStorage(file);
|
||||
final DiskStorage diskStorage = new DiskStorage(file, storageBasePath);
|
||||
if (isNew) {
|
||||
diskStorage.ensureAlignmentForNewBlocks(BSFile.BLOCK_SIZE);
|
||||
}
|
||||
@@ -33,7 +33,7 @@ public class PartitionDiskStore {
|
||||
supplier = partitionId -> {
|
||||
final Path file = storageBasePath.resolve(partitionId.getPartitionId()).resolve(filename);
|
||||
if (Files.exists(file)) {
|
||||
return new DiskStorage(file);
|
||||
return new DiskStorage(file, storageBasePath);
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
@@ -38,12 +38,12 @@ public class PartitionPersistentMap<K, V, P> implements AutoCloseable {
|
||||
this.valueEncoder = valueEncoder;
|
||||
creator = partitionId -> {
|
||||
final Path file = storageBasePath.resolve(partitionId.getPartitionId()).resolve(filename);
|
||||
return new PersistentMap<>(file, keyEncoder, valueEncoder);
|
||||
return new PersistentMap<>(file, storageBasePath, keyEncoder, valueEncoder);
|
||||
};
|
||||
supplier = partitionId -> {
|
||||
final Path file = storageBasePath.resolve(partitionId.getPartitionId()).resolve(filename);
|
||||
if (Files.exists(file)) {
|
||||
return new PersistentMap<>(file, keyEncoder, valueEncoder);
|
||||
return new PersistentMap<>(file, storageBasePath, keyEncoder, valueEncoder);
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
@@ -164,6 +164,11 @@ public class QueryCompletionIndex implements AutoCloseable {
|
||||
|
||||
return new TwoTags(tagA, tagB);
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] getEmptyValue() {
|
||||
return new byte[] {0,0,0,0};
|
||||
}
|
||||
}
|
||||
|
||||
private static final class EncoderTag implements EncoderDecoder<Tag> {
|
||||
@@ -188,6 +193,11 @@ public class QueryCompletionIndex implements AutoCloseable {
|
||||
return new Tag(key, value);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public byte[] getEmptyValue() {
|
||||
return new byte[] {0};
|
||||
}
|
||||
}
|
||||
|
||||
private static final class EncoderField implements EncoderDecoder<String> {
|
||||
@@ -207,6 +217,11 @@ public class QueryCompletionIndex implements AutoCloseable {
|
||||
final long compressedString = VariableByteEncoder.decodeFirstValue(bytes);
|
||||
return Tags.STRING_COMPRESSOR.get((int) compressedString);
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] getEmptyValue() {
|
||||
return new byte[] {0};
|
||||
}
|
||||
}
|
||||
|
||||
private final PartitionPersistentMap<TwoTags, Empty, Empty> tagToTagIndex;
|
||||
|
||||
@@ -56,4 +56,9 @@ class TagEncoderDecoder implements EncoderDecoder<Tag> {
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] getEmptyValue() {
|
||||
return new byte[] {0};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,4 +13,9 @@ class TagsEncoderDecoder implements EncoderDecoder<Tags> {
|
||||
public Tags decode(final byte[] bytes) {
|
||||
return Tags.fromBytes(bytes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] getEmptyValue() {
|
||||
return new byte[] {};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user