MCPcopy Create free account
hub / github.com/Tencent/phxsql / CheckAndSwitchFile

Method CheckAndSwitchFile

phxbinlogsvr/core/storage/event_storage.cpp:549–566  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

547}
548
549int EventStorage::CheckAndSwitchFile(bool force) {
550 EventDataInfo data_info;
551 event_file_manager_->GetWriteFileInfo(&data_info);
552 if (!force || data_info.offset() > option_->GetBinLogSvrConfig()->GetMaxEventFileSize()) {
553 STATISTICS(GtidEventSwitchDataFile());
554 ColorLogInfo("%s file %s size %zu has full, max size %zu, switch", __func__,
555 data_info.file_name().c_str(), data_info.offset(),
556 option_->GetBinLogSvrConfig()->GetMaxEventFileSize());
557
558 EventData event_headerdata;
559 int ret = GetFileHeader(&event_headerdata, &data_info);
560 if (ret == 0) {
561 ret = EventStorage::SwitchNewFile(event_headerdata);
562 }
563 return ret;
564 }
565 return OK;
566}
567
568void EventStorage::Notify() {
569 pthread_cond_broadcast(&cond_);

Callers

nothing calls this directly

Calls 4

ColorLogInfoFunction · 0.85
GetWriteFileInfoMethod · 0.80
GetMaxEventFileSizeMethod · 0.80
GetBinLogSvrConfigMethod · 0.80

Tested by

no test coverage detected