Skip to content

Commit

Permalink
Add log for debug ci error. (#350)
Browse files Browse the repository at this point in the history
  • Loading branch information
small-turtle-1 authored Dec 22, 2023
1 parent c17ba47 commit 1d9d2d9
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/storage/buffer/buffer_obj.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ import buffer_manager;
import infinity_exception;
import logger;

import third_party;
import logger;

module buffer_obj;

namespace infinity {
Expand Down Expand Up @@ -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;
}
Expand Down
7 changes: 7 additions & 0 deletions src/storage/buffer/file_worker/file_worker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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<LocalFileHandler *>(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) {
Expand Down
2 changes: 1 addition & 1 deletion src/storage/io/local_file_system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<StorageException>(Format("Can't write file: {}: {}", file_handler.path_.string(), strerror(errno)));
Error<StorageException>(Format("Can't write file: {}: {}. fd: {}", file_handler.path_.string(), strerror(errno), fd));
}
return write_count;
}
Expand Down
2 changes: 1 addition & 1 deletion src/storage/io/local_file_system.cppm
Original file line number Diff line number Diff line change
Expand Up @@ -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) {}

Expand Down

0 comments on commit 1d9d2d9

Please sign in to comment.