Skip to content

Commit

Permalink
sstables: summary: fix a bug when reading position
Browse files Browse the repository at this point in the history
Since that whole entries array is memory mapped, we should not call
read_integer - which will byteswap it.

We should instead just fetch the position directly.

This was not spotted before because our test sstables tend to be relatively
small.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
  • Loading branch information
glommer authored and avikivity committed May 21, 2015
1 parent 26e5a48 commit 1e44a5e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion sstables/sstables.cc
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,8 @@ future<> parse(random_access_reader& in, summary& s) {
auto keysize = entrysize - 8;
entry.key = bytes(reinterpret_cast<const int8_t*>(buf.get()), keysize);
buf.trim_front(keysize);
read_integer(buf, entry.position);
// FIXME: This is a le read. We should make this explicit
entry.position = *(reinterpret_cast<const net::packed<uint64_t> *>(buf.get()));

return make_ready_future<>();
});
Expand Down

0 comments on commit 1e44a5e

Please sign in to comment.