Skip to content
This repository has been archived by the owner on Aug 30, 2018. It is now read-only.

Commit

Permalink
cpp-proio: fix for slow Skip() calls
Browse files Browse the repository at this point in the history
Problem was that bucket bytes were not actually being skipped, and it was falling back on syncing to magic number.
  • Loading branch information
decibelcooper committed Jul 30, 2018
1 parent fe37685 commit cbc2416
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cpp-proio/src/reader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ uint64_t Reader::Skip(uint64_t nEvents) {
uint64_t nBucketEvents = bucketHeader->nevents();
bucketIndex -= nBucketEvents;
nSkipped += nBucketEvents - startIndex;
if (nBucketEvents > 0 && bucket->BytesRemaining() == 0)
if (!fileStream->Skip(bucketHeader->bucketsize())) throw ioError;
}
readHeader();
if (!bucketHeader) return nSkipped;
Expand Down
4 changes: 4 additions & 0 deletions cpp-proio/src/reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ const class BadLZ4FrameError : public std::exception {
const class SeekError : public std::exception {
virtual const char *what() const throw() { return "Failed to seek file"; }
} seekError;

const class IOError : public std::exception {
virtual const char *what() const throw() { return "Unexpected IO Error"; }
} ioError;
} // namespace proio

#endif // PROIO_READER_H

0 comments on commit cbc2416

Please sign in to comment.