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

Method DelCheckPointFile

phxbinlogsvr/core/storage/storage_file_manager.cpp:223–256  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

221}
222
223int StorageFileManager::DelCheckPointFile(const string &maxfile_name, const uint32_t &mintime,
224 vector<string> *delfiles) {
225 LogVerbose("%s check file %s, file list size %zu", __func__, maxfile_name.c_str(), file_list_.size());
226 uint64_t old_instanceid = GetFileInstanceID(maxfile_name);
227 for (auto &it : file_list_) {
228 if (delfiles->size() + 3 > file_list_.size()) {
229 LogVerbose("%s left files less than two, skip( delfile count %zu, file list count %zu)", __func__,
230 delfiles->size(), file_list_.size());
231 break;
232 }
233
234 // phxsql::LogVerbose("%s check del file %s",__func__, it.c_str());
235 if (old_instanceid > GetFileInstanceID(it)) {
236 uint32_t filetime = Utils::GetFileTime(data_dir_ + it);
237 // phxsql::LogVerbose("%s check del file %s file time %u mintime %u",__func__, it.c_str(), filetime, mintime);
238 if (filetime <= mintime) {
239 ColorLogInfo("%s get del file %s, file time %u, min time %u", __func__, it.c_str(), filetime, mintime);
240 delfiles->push_back(it);
241 }
242 }
243
244 if (delfiles->size() >= option_->GetBinLogSvrConfig()->GetMaxDeleteCheckPointFileNum()) {
245 LogVerbose("%s del files size %zu has reached the limit size %d, done)", __func__, delfiles->size(),
246 option_->GetBinLogSvrConfig()->GetMaxDeleteCheckPointFileNum());
247 break;
248 }
249 }
250
251 LogVerbose("%s file size %zu", __func__, file_list_.size());
252 for (auto &it : *delfiles) {
253 file_list_.erase(file_list_.find(it));
254 }
255 return OK;
256}
257
258int StorageFileManager::WriteData(const ::google::protobuf::Message &data, EventDataInfo *data_info) {
259 if (data_info) {

Callers

nothing calls this directly

Calls 4

LogVerboseFunction · 0.85
ColorLogInfoFunction · 0.85
GetBinLogSvrConfigMethod · 0.80

Tested by

no test coverage detected