mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-11 18:35:46 +02:00
fix(tiering): Fix pending leak during immediate stash error (#3219)
This commit is contained in:
parent
f28bd93854
commit
1dfb604d97
2 changed files with 8 additions and 2 deletions
|
@ -181,7 +181,7 @@ DiskStorage::Stats DiskStorage::GetStats() const {
|
|||
std::error_code DiskStorage::Grow(off_t grow_size) {
|
||||
off_t start = size_;
|
||||
|
||||
if (off_t(alloc_.capacity()) + grow_size >= max_size_)
|
||||
if (off_t(alloc_.capacity()) + grow_size > max_size_)
|
||||
return std::make_error_code(std::errc::no_space_on_device);
|
||||
|
||||
if (std::exchange(grow_pending_, true))
|
||||
|
|
|
@ -42,6 +42,8 @@ std::error_code OpManager::Open(std::string_view file) {
|
|||
|
||||
void OpManager::Close() {
|
||||
storage_.Close();
|
||||
DCHECK(pending_stash_ver_.empty());
|
||||
DCHECK(pending_reads_.empty());
|
||||
}
|
||||
|
||||
void OpManager::Enqueue(EntryId id, DiskSegment segment, ReadCallback cb) {
|
||||
|
@ -79,7 +81,11 @@ std::error_code OpManager::Stash(EntryId id_ref, std::string_view value) {
|
|||
auto io_cb = [this, version, id = std::move(id)](DiskSegment segment, std::error_code ec) {
|
||||
ProcessStashed(Borrowed(id), version, segment, ec);
|
||||
};
|
||||
return storage_.Stash(buf_view, std::move(io_cb));
|
||||
|
||||
auto ec = storage_.Stash(buf_view, std::move(io_cb));
|
||||
if (ec)
|
||||
pending_stash_ver_.erase(ToOwned(id_ref));
|
||||
return ec;
|
||||
}
|
||||
|
||||
OpManager::ReadOp& OpManager::PrepareRead(DiskSegment aligned_segment) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue