diff --git a/dbms/src/Storages/KVStore/FFI/ProxyFFI.cpp b/dbms/src/Storages/KVStore/FFI/ProxyFFI.cpp index 7b25544e616..f1afd5ab909 100644 --- a/dbms/src/Storages/KVStore/FFI/ProxyFFI.cpp +++ b/dbms/src/Storages/KVStore/FFI/ProxyFFI.cpp @@ -305,13 +305,14 @@ CppStrWithView HandleReadPage(const EngineStoreServerWrap * server, BaseBuffView { auto uni_ps = server->tmt->getContext().getWriteNodePageStorage(); RaftDataReader reader(*uni_ps); - auto * page = new Page(reader.read(UniversalPageId(page_id.data, page_id.len))); - if (page->isValid()) + auto p = reader.read(UniversalPageId(page_id.data, page_id.len)); + if (p.isValid()) { LOG_TRACE( &Poco::Logger::get("ProxyFFI"), "FFI read page {} success", UniversalPageId(page_id.data, page_id.len)); + auto * page = new Page(std::move(p)); return CppStrWithView{ .inner = GenRawCppPtr(page, RawCppPtrTypeImpl::UniversalPage), .view = BaseBuffView{page->data.begin(), page->data.size()}, diff --git a/dbms/src/Storages/Page/Page.h b/dbms/src/Storages/Page/Page.h index 7a5dc2977c3..61f5c01f4a4 100644 --- a/dbms/src/Storages/Page/Page.h +++ b/dbms/src/Storages/Page/Page.h @@ -47,7 +47,7 @@ struct FieldOffsetInsidePage bool operator<(const FieldOffsetInsidePage & rhs) const { return index < rhs.index; } }; -struct Page +class Page { public: static Page invalidPage() @@ -69,7 +69,7 @@ struct Page std::set field_offsets; private: - bool is_valid; + bool is_valid = false; public: inline bool isValid() const { return is_valid; }