This is an automated email from the ASF dual-hosted git repository.
dataroaring pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 573fa2063b0 [Fix](wal) Fix wal space back pressure core (#26907)
573fa2063b0 is described below
commit 573fa2063b09c4947c430688a75294616ad3b67a
Author: abmdocrt <[email protected]>
AuthorDate: Tue Nov 14 16:10:25 2023 +0800
[Fix](wal) Fix wal space back pressure core (#26907)
---
be/src/olap/wal_manager.cpp | 5 +++++
be/src/olap/wal_writer.cpp | 3 ++-
be/src/olap/wal_writer.h | 4 ++--
3 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/be/src/olap/wal_manager.cpp b/be/src/olap/wal_manager.cpp
index 921f7da8e38..1eb91d85e0a 100644
--- a/be/src/olap/wal_manager.cpp
+++ b/be/src/olap/wal_manager.cpp
@@ -258,6 +258,11 @@ Status WalManager::delete_wal(int64_t wal_id) {
std::memory_order_relaxed),
std::memory_order_relaxed);
_wal_id_to_writer_map[wal_id]->cv.notify_one();
+ std::string wal_path = _wal_path_map[wal_id];
+ LOG(INFO) << "wal delete file=" << wal_path << ", this file disk
usage is"
+ << _wal_id_to_writer_map[wal_id]->disk_bytes()
+ << " ,after deleting it, all wals disk usage is "
+ << _all_wal_disk_bytes->load(std::memory_order_relaxed);
_wal_id_to_writer_map.erase(wal_id);
}
if (_wal_id_to_writer_map.empty()) {
diff --git a/be/src/olap/wal_writer.cpp b/be/src/olap/wal_writer.cpp
index 085c0f0e31f..b433c7aaaa2 100644
--- a/be/src/olap/wal_writer.cpp
+++ b/be/src/olap/wal_writer.cpp
@@ -76,7 +76,8 @@ Status WalWriter::append_blocks(const PBlockArray& blocks) {
offset += CHECKSUM_SIZE;
}
DCHECK(offset == total_size);
- _disk_bytes += total_size;
+ _disk_bytes.store(_disk_bytes.fetch_add(total_size,
std::memory_order_relaxed),
+ std::memory_order_relaxed);
_all_wal_disk_bytes->store(
_all_wal_disk_bytes->fetch_add(total_size,
std::memory_order_relaxed),
std::memory_order_relaxed);
diff --git a/be/src/olap/wal_writer.h b/be/src/olap/wal_writer.h
index 9fd0a396788..f11dbc20eb0 100644
--- a/be/src/olap/wal_writer.h
+++ b/be/src/olap/wal_writer.h
@@ -39,7 +39,7 @@ public:
Status finalize();
Status append_blocks(const PBlockArray& blocks);
- size_t disk_bytes() const { return _disk_bytes; };
+ size_t disk_bytes() const { return
_disk_bytes.load(std::memory_order_relaxed); };
std::string file_name() { return _file_name; };
static const int64_t LENGTH_SIZE = 8;
@@ -52,7 +52,7 @@ private:
io::FileWriterPtr _file_writer;
int64_t _count;
int64_t _batch;
- size_t _disk_bytes;
+ std::atomic_size_t _disk_bytes;
std::shared_ptr<std::atomic_size_t> _all_wal_disk_bytes;
doris::Mutex _mutex;
};
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]