From 5d3317e4f2726958d313bf32dcd95f04ed5fd2f2 Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Thu, 8 Feb 2024 19:34:29 +0300 Subject: [PATCH] Followup to 1.4.2 write stall fix - sadly, the previous version was not working correctly :) --- src/blockstore_impl.cpp | 9 ++++++--- src/blockstore_impl.h | 3 +-- src/blockstore_rollback.cpp | 1 - src/blockstore_stable.cpp | 1 - 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/blockstore_impl.cpp b/src/blockstore_impl.cpp index 55d00960..399e0c78 100644 --- a/src/blockstore_impl.cpp +++ b/src/blockstore_impl.cpp @@ -195,6 +195,10 @@ void blockstore_impl_t::loop() // ring is full, stop submission break; } + else if (PRIV(op)->wait_for == WAIT_JOURNAL) + { + PRIV(op)->wait_detail2 = (unstable_writes.size()+unstable_unsynced); + } } } if (op_idx != new_idx) @@ -273,7 +277,8 @@ void blockstore_impl_t::check_wait(blockstore_op_t *op) } else if (PRIV(op)->wait_for == WAIT_JOURNAL) { - if (journal.used_start == PRIV(op)->wait_detail && !unstable_count_changed) + if (journal.used_start == PRIV(op)->wait_detail && + (unstable_writes.size()+unstable_unsynced) == PRIV(op)->wait_detail2) { // do not submit #ifdef BLOCKSTORE_DEBUG @@ -281,7 +286,6 @@ void blockstore_impl_t::check_wait(blockstore_op_t *op) #endif return; } - unstable_count_changed = false; flusher->release_trim(); PRIV(op)->wait_for = 0; } @@ -353,7 +357,6 @@ void blockstore_impl_t::enqueue_op(blockstore_op_t *op) }; } unstable_writes.clear(); - unstable_count_changed = true; op->callback = [old_callback](blockstore_op_t *op) { obj_ver_id *vers = (obj_ver_id*)op->buf; diff --git a/src/blockstore_impl.h b/src/blockstore_impl.h index 99f01cef..c1b88638 100644 --- a/src/blockstore_impl.h +++ b/src/blockstore_impl.h @@ -202,7 +202,7 @@ struct blockstore_op_private_t { // Wait status int wait_for; - uint64_t wait_detail; + uint64_t wait_detail, wait_detail2; int pending_ops; int op_state; @@ -276,7 +276,6 @@ class blockstore_impl_t std::vector submit_queue; std::vector unsynced_big_writes, unsynced_small_writes; int unsynced_big_write_count = 0, unstable_unsynced = 0; - bool unstable_count_changed = false; int unsynced_queued_ops = 0; allocator *data_alloc = NULL; uint64_t used_blocks = 0; diff --git a/src/blockstore_rollback.cpp b/src/blockstore_rollback.cpp index cc686112..50b6eb88 100644 --- a/src/blockstore_rollback.cpp +++ b/src/blockstore_rollback.cpp @@ -162,7 +162,6 @@ void blockstore_impl_t::mark_rolled_back(const obj_ver_id & ov) unstable_writes.erase(unstab_it); else unstab_it->second = max_unstable; - unstable_count_changed = true; } } } diff --git a/src/blockstore_stable.cpp b/src/blockstore_stable.cpp index f3d4dc27..2dba0555 100644 --- a/src/blockstore_stable.cpp +++ b/src/blockstore_stable.cpp @@ -537,6 +537,5 @@ void blockstore_impl_t::mark_stable(obj_ver_id v, bool forget_dirty) unstab_it->second <= v.version) { unstable_writes.erase(unstab_it); - unstable_count_changed = true; } }