gavinchou commented on code in PR #26483:
URL: https://github.com/apache/doris/pull/26483#discussion_r1383654000


##########
be/src/olap/wal_writer.h:
##########
@@ -17,33 +17,44 @@
 
 #pragma once
 
+#include <atomic>
+#include <memory>
+
 #include "common/status.h"
 #include "gen_cpp/internal_service.pb.h"
 #include "io/fs/file_reader_writer_fwd.h"
+#include "util/lock.h"
 
 namespace doris {
 
 using PBlockArray = std::vector<PBlock*>;
 
 class WalWriter {
 public:
-    explicit WalWriter(const std::string& file_name);
+    explicit WalWriter(const std::string& file_name,
+                       const std::shared_ptr<std::atomic_size_t>& 
all_wal_disk_bytes);
     ~WalWriter();
 
     Status init();
     Status finalize();
 
     Status append_blocks(const PBlockArray& blocks);
+    size_t disk_bytes() const { return _disk_bytes; };
 
     std::string file_name() { return _file_name; };
     static const int64_t LENGTH_SIZE = 8;
     static const int64_t CHECKSUM_SIZE = 4;
+    doris::ConditionVariable cv;
 
 private:
+    static constexpr size_t MAX_WAL_WRITE_WAIT_TIME = 1000;
     std::string _file_name;
     io::FileWriterPtr _file_writer;
     int64_t _count;
     int64_t _batch;
+    size_t _disk_bytes;
+    std::shared_ptr<std::atomic_size_t> _all_wal_disk_bytes;

Review Comment:
   Memory order can be `relaxed` for all operations of _all_wal_disk_bytes.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to