Skip to content

Commit

Permalink
Reduce size of new_pos from k + 1 to k bits in phase 3
Browse files Browse the repository at this point in the history
For table 7 we still use k + 1 bits as there can be more than 2^k
entries.
  • Loading branch information
rostislav authored and hoffmang9 committed Apr 2, 2021
1 parent 7bacb3a commit 16b61a5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/phase3.hpp
Expand Up @@ -303,7 +303,7 @@ Phase3Results RunPhase3(
} else {
// k+1 bits in case it overflows
left_new_pos[current_pos % kCachedPositionsSize] =
Util::SliceInt64FromBytes(left_entry_disk_buf, right_sort_key_size, k + 1);
Util::SliceInt64FromBytes(left_entry_disk_buf, right_sort_key_size, k);
}
}

Expand Down Expand Up @@ -397,7 +397,7 @@ Phase3Results RunPhase3(
// groups(parks), with a checkpoint in each group.
int added_to_cache = 0;
uint8_t const sort_key_shift = 128 - right_sort_key_size;
uint8_t const index_shift = sort_key_shift - (k + 1);
uint8_t const index_shift = sort_key_shift - (k + (table_index == 6 ? 1 : 0));
for (uint64_t index = 0; index < total_r_entries; index++) {
right_reader_entry_buf = R_sort_manager->ReadEntry(right_reader);
right_reader += right_entry_size_bytes;
Expand Down

0 comments on commit 16b61a5

Please sign in to comment.