Skip to content

Commit 5fb3906

Browse files
authored
[Issue #524] using full path as the key in file footer cache (#525)
1 parent 8f815a6 commit 5fb3906

3 files changed

Lines changed: 8 additions & 7 deletions

File tree

pixels-core/src/main/java/io/pixelsdb/pixels/core/PixelsReaderImpl.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,8 @@ public PixelsReader build()
159159
// get PhysicalReader
160160
PhysicalReader fsReader = PhysicalReaderUtil.newPhysicalReader(builderStorage, builderPath);
161161
// try to get file tail from cache
162-
String fileName = fsReader.getName();
163-
PixelsProto.FileTail fileTail = builderPixelsFooterCache.getFileTail(fileName);
162+
String filePath = fsReader.getPath();
163+
PixelsProto.FileTail fileTail = builderPixelsFooterCache.getFileTail(filePath);
164164
if (fileTail == null)
165165
{
166166
if (fsReader == null)
@@ -177,7 +177,7 @@ public PixelsReader build()
177177
fsReader.seek(fileTailOffset);
178178
ByteBuffer fileTailBuffer = fsReader.readFully(fileTailLength);
179179
fileTail = PixelsProto.FileTail.parseFrom(fileTailBuffer);
180-
builderPixelsFooterCache.putFileTail(fileName, fileTail);
180+
builderPixelsFooterCache.putFileTail(filePath, fileTail);
181181
}
182182

183183
// check file MAGIC and file version

pixels-core/src/main/java/io/pixelsdb/pixels/core/reader/PixelsRecordReaderImpl.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public class PixelsRecordReaderImpl implements PixelsRecordReader
6464
private final List<String> cacheOrder;
6565
private final PixelsCacheReader cacheReader;
6666
private final PixelsFooterCache pixelsFooterCache;
67-
private final String fileName;
67+
private final String filePath;
6868
private final List<PixelsProto.Type> includedColumnTypes;
6969

7070
private TypeDescription fileSchema = null;
@@ -147,7 +147,7 @@ public PixelsRecordReaderImpl(PhysicalReader physicalReader,
147147
this.cacheOrder = cacheOrder;
148148
this.cacheReader = cacheReader;
149149
this.pixelsFooterCache = pixelsFooterCache;
150-
this.fileName = this.physicalReader.getName();
150+
this.filePath = this.physicalReader.getPath();
151151
this.includedColumnTypes = new ArrayList<>();
152152
// Issue #175: this check is currently not necessary.
153153
// requireNonNull(TransContextCache.Instance().getQueryTransInfo(this.transId),
@@ -451,7 +451,7 @@ else if (predicate.matchesNone())
451451
for (int i = 0; i < targetRGNum; i++)
452452
{
453453
int rgId = targetRGs[i];
454-
String rgCacheId = fileName + "-" + rgId;
454+
String rgCacheId = filePath + "-" + rgId;
455455
PixelsProto.RowGroupFooter rowGroupFooter = pixelsFooterCache.getRGFooter(rgCacheId);
456456
// cache miss, read from disk and put it into cache
457457
if (rowGroupFooter == null)

proto/pixels.proto

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ option java_outer_classname = "PixelsProto";
3535
// Pixel: Each column chunk contains a sequence of 'pixels'.
3636
// Each pixel contains a number (e.g., 10000) of values.
3737

38-
// The content of the file tail that must be serialized.
38+
// The content of the file tail that must be serialized and stored at
39+
// the end of each file, followed by 8 bytes
3940
message FileTail {
4041
optional Footer footer = 1;
4142
optional PostScript postscript = 2;

0 commit comments

Comments
 (0)