Skip to content

Commit

Permalink
ToC cache key is chunk id now, not version
Browse files Browse the repository at this point in the history
  • Loading branch information
andreitokar committed Aug 18, 2023
1 parent 0666a0b commit 9312571
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions h2/src/main/org/h2/mvstore/FileStore.java
Original file line number Diff line number Diff line change
Expand Up @@ -1692,11 +1692,11 @@ public void setCacheSize(int mb) {
}

void cacheToC(C chunk, long[] toc) {
chunksToC.put(chunk.version, toc, toc.length * 8L + Constants.MEMORY_ARRAY);
chunksToC.put(chunk.id, toc, toc.length * 8L + Constants.MEMORY_ARRAY);
}

private long[] cleanToCCache(C chunk) {
return chunksToC.remove(chunk.version);
return chunksToC.remove(chunk.id);
}

public void populateInfo(BiConsumer<String, String> consumer) {
Expand Down Expand Up @@ -2058,7 +2058,7 @@ private long[] getToC(C chunk) {
// legacy chunk without table of content
return null;
}
long[] toc = chunksToC.get(chunk.version);
long[] toc = chunksToC.get(chunk.id);
if (toc == null) {
toc = chunk.readToC(this);
cacheToC(chunk, toc);
Expand Down

0 comments on commit 9312571

Please sign in to comment.