diff --git a/src/storage/buffer/buffer_obj.cpp b/src/storage/buffer/buffer_obj.cpp index 974aa38dcf..d47545bd89 100644 --- a/src/storage/buffer/buffer_obj.cpp +++ b/src/storage/buffer/buffer_obj.cpp @@ -21,6 +21,9 @@ import buffer_manager; import infinity_exception; import logger; +import third_party; +import logger; + module buffer_obj; namespace infinity { @@ -133,6 +136,7 @@ bool BufferObj::Save() { switch (status_) { case BufferStatus::kLoaded: case BufferStatus::kUnloaded: { + LOG_TRACE(Format("{}: Save kEphemeral.", *file_worker_->file_name_)); file_worker_->WriteToFile(false); break; } diff --git a/src/storage/buffer/file_worker/file_worker.cpp b/src/storage/buffer/file_worker/file_worker.cpp index 43bf875861..aeda24c184 100644 --- a/src/storage/buffer/file_worker/file_worker.cpp +++ b/src/storage/buffer/file_worker/file_worker.cpp @@ -22,6 +22,9 @@ import third_party; import file_system_type; import defer_op; +import local_file_system; +import logger; + module file_worker; namespace infinity { @@ -52,6 +55,10 @@ void FileWorker::WriteToFile(bool to_spill) { u8 flags = FileFlags::WRITE_FLAG | FileFlags::CREATE_FLAG; file_handler_ = fs.OpenFile(write_path, flags, FileLockType::kWriteLock); + if (to_spill) { + auto local_file_handle_ = static_cast(file_handler_.get()); + LOG_WARN(Format("Open spill file: {}, fd: {}", write_path, local_file_handle_->fd_)); + } bool prepare_success = false; DeferFn defer_fn([&]() { if (!prepare_success) { diff --git a/src/storage/io/local_file_system.cpp b/src/storage/io/local_file_system.cpp index 0d30030a05..01b18bd780 100644 --- a/src/storage/io/local_file_system.cpp +++ b/src/storage/io/local_file_system.cpp @@ -128,7 +128,7 @@ i64 LocalFileSystem::Write(FileHandler &file_handler, const void *data, u64 nbyt i32 fd = ((LocalFileHandler &)file_handler).fd_; i64 write_count = write(fd, data, nbytes); if (write_count == -1) { - Error(Format("Can't write file: {}: {}", file_handler.path_.string(), strerror(errno))); + Error(Format("Can't write file: {}: {}. fd: {}", file_handler.path_.string(), strerror(errno), fd)); } return write_count; } diff --git a/src/storage/io/local_file_system.cppm b/src/storage/io/local_file_system.cppm index 049720f966..80fe7f99fc 100644 --- a/src/storage/io/local_file_system.cppm +++ b/src/storage/io/local_file_system.cppm @@ -22,7 +22,7 @@ export module local_file_system; namespace infinity { -class LocalFileHandler : public FileHandler { +export class LocalFileHandler : public FileHandler { public: LocalFileHandler(FileSystem &file_system, String path, i32 fd) : FileHandler(file_system, Move(path)), fd_(fd) {}