Skip to content

Commit

Permalink
fix wrong sstable file initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
tomfran committed Oct 3, 2023
1 parent da5ac61 commit 8fb335b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/main/java/com/tomfran/lsm/sstable/SSTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ private void initializeFromDisk(String filename) {

int sizeCumulative = 0;
sparseSizeCount.add(sizeCumulative);
for (int i = 0; i < sparseSize; i++) {
for (int i = 0; i < sparseSize - 1; i++) {
sizeCumulative += indexIs.readVByteInt();
sparseSizeCount.add(sizeCumulative);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ void shouldReconstruct() {
assert t2.sparseOffsets.size() == t1.sparseOffsets.size();
for (var i = 0; i < t2.sparseOffsets.size(); i++)
assert t2.sparseOffsets.getLong(i) == t1.sparseOffsets.getLong(i);
//
// assert t2.sparseKeys.size() == t1.sparseKeys.size() : "keys lenght don't match";
// for (var i = 0; i < t2.sparseKeys.size(); i++)
// assert compare(t2.sparseKeys.get(i), t1.sparseKeys.get(i)) == 0 : "keys don't match";

assert t2.sparseKeys.size() == t1.sparseKeys.size() : "keys lenght don't match";
for (var i = 0; i < t2.sparseKeys.size(); i++)
assert compare(t2.sparseKeys.get(i), t1.sparseKeys.get(i)) == 0 : "keys don't match";

t2.close();
}
Expand Down

0 comments on commit 8fb335b

Please sign in to comment.