Skip to content

Commit

Permalink
Pass a timeout to FileSystem for random reads (#6751)
Browse files Browse the repository at this point in the history
Summary:
Calculate ```IOOptions::timeout``` using ```ReadOptions::deadline``` and pass it to ```FileSystem::Read/FileSystem::MultiRead```. This allows us to impose a tighter bound on the time taken by Get/MultiGet on FileSystem/Envs that support IO timeouts. Even on those that don't support, check in ```RandomAccessFileReader::Read``` and ```MultiRead``` and return ```Status::TimedOut()``` if the deadline is exceeded.

For now, TableReader creation, which might do file opens and reads, are not covered. It will be implemented in another PR.

Tests:
Update existing unit tests to verify the correct timeout value is being passed
Pull Request resolved: facebook/rocksdb#6751

Reviewed By: riversand963

Differential Revision: D21285631

Pulled By: anand1976

fbshipit-source-id: d89af843e5a91ece866e87aa29438b52a65a8567
Signed-off-by: Changlong Chen <levisonchen@live.cn>
  • Loading branch information
anand76 authored and mm304321141 committed Jun 23, 2021
1 parent e180bbb commit b8abd86
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions include/rocksdb/file_system.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,16 @@ enum class IOType : uint8_t {
// honored. More hints can be added here in the future to indicate things like
// storage media (HDD/SSD) to be used, replication level etc.
struct IOOptions {
// Timeout for the operation in milliseconds
std::chrono::milliseconds timeout;
// Timeout for the operation in microseconds
std::chrono::microseconds timeout;

// Priority - high or low
IOPriority prio;

// Type of data being read/written
IOType type;

IOOptions() : timeout(0), prio(IOPriority::kIOLow), type(IOType::kUnknown) {}
};

// File scope options that control how a file is opened/created and accessed
Expand Down

0 comments on commit b8abd86

Please sign in to comment.