77 current_file_ =
nullptr;
78 LOG(INFO) <<
"Initializing Logger-" <<
id_ <<
". assigned " << assigned_thread_ids_.size()
79 <<
" threads, starting from " << assigned_thread_ids_[0] <<
", numa_node_="
90 control_block_->current_file_durable_offset_ = info.current_log_file_offset_durable_;
91 control_block_->oldest_file_offset_begin_ = info.oldest_log_file_offset_begin_;
97 current_file_ =
new fs::DirectIoFile(current_file_path_,
103 LOG(ERROR) <<
"Logger-" <<
id_ <<
"'s log file has a non-durable region. Probably there"
104 <<
" was a crash. Will truncate it to " <<
control_block_->current_file_durable_offset_
111 LOG(INFO) <<
"Initialized logger: " << *
this;
114 for (
auto thread_id : assigned_thread_ids_) {
115 assigned_threads_.push_back(
126 LOG(INFO) <<
"Logger-" <<
id_ <<
" grabbed a padding buffer. size=" << fill_buffer_.
get_size();
130 logger_thread_ = std::move(std::thread(&Logger::handle_logger,
this));
ThreadPoolPimpl * get_pimpl() const
Returns the pimpl of this object.
ErrorCode truncate(uint64_t new_length, bool sync=false)
Discard the content of the file after the given offset.
ErrorStack allocate_numa_memory(uint64_t size, AlignedMemory *out) const
std::string construct_suffixed_log_path(int node, int logger, LogFileOrdinal ordinal) const
construct full path of individual log file (log_folder/LOGGERID_ORDINAL.log)
uint64_t get_alignment() const
Returns the alignment of the memory block.
ThreadGroup * get_local_group() const
ThreadLocalOrdinal decompose_numa_local_ordinal(ThreadId global_id)
Extracts local ordinal from the given globally unique ID of Thread (core).
ErrorCode open(bool read, bool write, bool append, bool create)
Tries to open the file for the specified volume.
Engine * engine_
Most attachable object stores an engine pointer (local engine), so we define it here.
uint64_t get_current_offset() const
const EngineOptions & get_options() const
savepoint::SavepointManager * get_savepoint_manager() const
See Savepoint Manager.
LoggerControlBlock * control_block_
The shared data on shared memory that has been initialized in some SOC or master engine.
Thread * get_thread(ThreadLocalOrdinal ordinal) const
Returns Thread object for the given ordinal in this group.
uint64_t get_size() const
Returns the byte size of the memory block.
#define CHECK_ERROR(x)
This macro calls x and checks its returned value.
NumaNodeMemory * get_local_memory() const
foedus::fs::DeviceEmulationOptions emulation_
Settings to emulate slower logging device.
const ErrorStack kRetOk
Normal return value for no-error case.
Epoch get_initial_durable_epoch() const
#define ASSERT_ND(x)
A warning-free wrapper macro of assert() that has no performance effect in release mode even when 'x'...
#define WRAP_ERROR_CODE(x)
Same as CHECK_ERROR(x) except it receives only an error code, thus more efficient.
memory::EngineMemory * get_memory_manager() const
See Memory Manager.
thread::ThreadPool * get_thread_pool() const
See Thread and Thread-Group.
We always write to file in a multiply of this value, filling up the rest if needed.
LoggerSavepointInfo get_logger_savepoint(log::LoggerId logger_id)
Returns the saved information of the given logger in latest savepoint.
EpochInteger value() const
Returns the raw integer representation.
bool is_null() const
Returns if this object doesn't hold a valid memory block.