MCPcopy Create free account
hub / github.com/Tencent/phxqueue / MakeCheckPoint

Method MakeCheckPoint

phxqueue/store/keepsyncthread.cpp:124–254  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

122
123
124void KeepSyncThread::MakeCheckPoint() {
125 QLVerb("KeepSyncThread::MakeCheckPoint");
126
127 comm::RetCode ret;
128
129 phxpaxos::Node *node = impl_->store->GetNode();
130 SyncCtrl *sync = impl_->store->GetSyncCtrl();
131
132 auto opt = impl_->store->GetStoreOption();
133
134 const int topic_id = impl_->store->GetTopicID();
135 const int ngroup = opt->ngroup;
136 const int nqueue = opt->nqueue;
137 const int nsub = opt->nsub;
138
139 shared_ptr<const config::TopicConfig> topic_config;
140 if (comm::RetCode::RET_OK !=
141 (ret = config::GlobalConfig::GetThreadInstance()->
142 GetTopicConfigByTopicID(topic_id, topic_config))) {
143 QLErr("GetTopicConfigByTopicID ret %d topic_id %d", ret, topic_id);
144 return;
145 }
146
147 int store_make_cp_interval_s = topic_config->GetProto().topic().store_make_cp_interval_s();
148 if (!store_make_cp_interval_s) store_make_cp_interval_s = 1;
149
150
151 comm::proto::Addr addr;
152 addr.set_ip(opt->ip);
153 addr.set_port(opt->port);
154 addr.set_paxos_port(opt->paxos_port);
155
156 shared_ptr<const config::StoreConfig> store_config;
157 if (comm::RetCode::RET_OK !=
158 (ret = config::GlobalConfig::GetThreadInstance()->
159 GetStoreConfig(topic_id, store_config))) {
160 QLErr("GetStoreConfig ret %d topic_id %d", as_integer(ret), topic_id);
161 return;
162 }
163
164 int store_id;
165 if (comm::RetCode::RET_OK != (ret = store_config->GetStoreIDByAddr(addr, store_id))) {
166 QLErr("GetStoreIDByAddr ret %d", as_integer(ret));
167 return;
168 }
169
170 set<int> pub_ids;
171 if (comm::RetCode::RET_OK !=
172 (ret = config::utils::GetPubIDsByStoreID(topic_id, store_id, pub_ids))) {
173 QLErr("GetPubIDsByStoreID ret %d topic_id %d store_id %d", as_integer(ret), topic_id, store_id);
174 return;
175 }
176
177 for (int paxos_group_id{0}; paxos_group_id < ngroup; ++paxos_group_id) {
178 time_t now = time(nullptr);
179 QLVerb("KeepSyncThread::MakeCheckPoint now %" PRIu64 " next %" PRIu64,
180 now, impl_->next_make_cp_times[paxos_group_id]);
181

Callers

nothing calls this directly

Calls 15

as_integerFunction · 0.85
GetPubIDsByStoreIDFunction · 0.85
StoreMetaClass · 0.85
GetSyncCtrlMethod · 0.80
GetStoreOptionMethod · 0.80
GetStoreConfigMethod · 0.80
GetStoreIDByAddrMethod · 0.80
IsValidQueueMethod · 0.80
GetMetaQueueMethod · 0.80
GetBaseMgrMethod · 0.80
ClearMethod · 0.80

Tested by

no test coverage detected