diff --git a/src/storage/invertedindex/format/flush_info.cppm b/src/storage/invertedindex/format/flush_info.cppm index 60e0e57448..1239403d75 100644 --- a/src/storage/invertedindex/format/flush_info.cppm +++ b/src/storage/invertedindex/format/flush_info.cppm @@ -14,10 +14,17 @@ private: public: FlushInfo() { Reset(); } - FlushInfo(const FlushInfo &other) { flush_info_ = other.flush_info_; } + FlushInfo(const FlushInfo &other) { flush_info_ = other.flush_info_.load(); } ~FlushInfo() = default; + FlushInfo &operator=(const FlushInfo &other) { + if (this != &other) { + flush_info_ = other.flush_info_.load(); + } + return *this; + } + bool IsValidPostingBuffer() const { return GET_BIT_VALUE(MASK_IS_VALID, OFFSET_IS_VALID); } void SetIsValidPostingBuffer(bool is_valid) { u64 is_valid_posting_buffer = is_valid ? 1 : 0; @@ -38,7 +45,7 @@ public: static const u64 MASK_FLUSH_LENGTH = 0xFFFFFFFE; static const u64 MASK_FLUSH_COUNT = 0xFFFFFFFF00000000; - u64 volatile flush_info_; + Atomic flush_info_{}; }; } // namespace infinity \ No newline at end of file