PragmaTwice commented on code in PR #3550:
URL: https://github.com/apache/kvrocks/pull/3550#discussion_r3563632010


##########
src/common/rdb_stream.cc:
##########
@@ -52,6 +52,14 @@ Status RdbFileStream::Open() {
     return {Status::NotOK, fmt::format("failed to open rdb file: '{}': {}", 
file_name_, strerror(errno))};
   }
 
+  ifs_.seekg(0, std::ifstream::end);
+  auto file_size = ifs_.tellg();
+  if (file_size < 0) {
+    return {Status::NotOK, fmt::format("failed to get the size of rdb file: 
'{}': {}", file_name_, strerror(errno))};
+  }
+  ifs_.seekg(0, std::ifstream::beg);
+  file_size_ = static_cast<uint64_t>(file_size);

Review Comment:
   I think we use `fs::file_size()` or `fstat()` to get the file size instead 
of `seekg`/`tellg`?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to