Add experimental new FS API AbortIO to cancel read request (#9901)
Summary: Add experimental new API AbortIO in FileSystem to abort the read requests submitted asynchronously through ReadAsync API. Pull Request resolved: https://github.com/facebook/rocksdb/pull/9901 Test Plan: Existing tests Reviewed By: anand1976 Differential Revision: D35885591 Pulled By: akankshamahajan15 fbshipit-source-id: df3944e6e9e6e487af1fa688376b4abb6837fb02
This commit is contained in:
parent
1ef888f9b8
commit
5898845c87
@ -1,4 +1,9 @@
|
|||||||
# Rocksdb Change Log
|
# Rocksdb Change Log
|
||||||
|
## Unreleased
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
* RocksDB calls FileSystem::Poll API during FilePrefetchBuffer destruction which impacts performance as it waits for read requets completion which is not needed anymore. Calling FileSystem::AbortIO to abort those requests instead fixes that performance issue.
|
||||||
|
|
||||||
## 7.2.0 (04/15/2022)
|
## 7.2.0 (04/15/2022)
|
||||||
### Bug Fixes
|
### Bug Fixes
|
||||||
* Fixed bug which caused rocksdb failure in the situation when rocksdb was accessible using UNC path
|
* Fixed bug which caused rocksdb failure in the situation when rocksdb was accessible using UNC path
|
||||||
|
7
env/fs_posix.cc
vendored
7
env/fs_posix.cc
vendored
@ -1118,6 +1118,13 @@ class PosixFileSystem : public FileSystem {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO akanksha: Look into flags and see how to provide support for AbortIO
|
||||||
|
// in posix for IOUring requests. Currently it calls Poll to wait for requests
|
||||||
|
// to complete the request.
|
||||||
|
virtual IOStatus AbortIO(std::vector<void*>& io_handles) override {
|
||||||
|
return Poll(io_handles, io_handles.size());
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(ROCKSDB_IOURING_PRESENT)
|
#if defined(ROCKSDB_IOURING_PRESENT)
|
||||||
// io_uring instance
|
// io_uring instance
|
||||||
std::unique_ptr<ThreadLocalPtr> thread_local_io_urings_;
|
std::unique_ptr<ThreadLocalPtr> thread_local_io_urings_;
|
||||||
|
@ -92,7 +92,8 @@ class FilePrefetchBuffer {
|
|||||||
if (async_read_in_progress_ && fs_ != nullptr) {
|
if (async_read_in_progress_ && fs_ != nullptr) {
|
||||||
std::vector<void*> handles;
|
std::vector<void*> handles;
|
||||||
handles.emplace_back(io_handle_);
|
handles.emplace_back(io_handle_);
|
||||||
fs_->Poll(handles, 1).PermitUncheckedError();
|
Status s = fs_->AbortIO(handles);
|
||||||
|
assert(s.ok());
|
||||||
}
|
}
|
||||||
// Release io_handle_.
|
// Release io_handle_.
|
||||||
if (io_handle_ != nullptr && del_fn_ != nullptr) {
|
if (io_handle_ != nullptr && del_fn_ != nullptr) {
|
||||||
|
@ -668,6 +668,17 @@ class FileSystem : public Customizable {
|
|||||||
return IOStatus::OK();
|
return IOStatus::OK();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// EXPERIMENTAL
|
||||||
|
// Abort the read IO requests submitted asynchronously. Underlying FS is
|
||||||
|
// required to support AbortIO API. AbortIO implementation should ensure that
|
||||||
|
// the all the read requests related to io_handles should be aborted and
|
||||||
|
// it shouldn't call the callback for these io_handles.
|
||||||
|
//
|
||||||
|
// Default implementation is to return IOStatus::OK.
|
||||||
|
virtual IOStatus AbortIO(std::vector<void*>& /*io_handles*/) {
|
||||||
|
return IOStatus::OK();
|
||||||
|
}
|
||||||
|
|
||||||
// If you're adding methods here, remember to add them to EnvWrapper too.
|
// If you're adding methods here, remember to add them to EnvWrapper too.
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -1500,6 +1511,10 @@ class FileSystemWrapper : public FileSystem {
|
|||||||
return target_->Poll(io_handles, min_completions);
|
return target_->Poll(io_handles, min_completions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual IOStatus AbortIO(std::vector<void*>& io_handles) override {
|
||||||
|
return target_->AbortIO(io_handles);
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::shared_ptr<FileSystem> target_;
|
std::shared_ptr<FileSystem> target_;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user