MCPcopy Create free account
hub / github.com/ClusterLabs/pacemaker / cib_server_process_diff

Function cib_server_process_diff

cib/messages.c:222–288  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

220int sync_in_progress = 0;
221
222int
223cib_server_process_diff(const char *op, int options, const char *section, xmlNode * req,
224 xmlNode * input, xmlNode * existing_cib, xmlNode ** result_cib,
225 xmlNode ** answer)
226{
227 int rc = pcmk_ok;
228
229 if (cib_is_master) {
230 /* the master is never waiting for a resync */
231 sync_in_progress = 0;
232 }
233
234 if (sync_in_progress > MAX_DIFF_RETRY) {
235 /* request another full-sync,
236 * the last request may have been lost
237 */
238 sync_in_progress = 0;
239 }
240
241 if (sync_in_progress) {
242 int diff_add_updates = 0;
243 int diff_add_epoch = 0;
244 int diff_add_admin_epoch = 0;
245
246 int diff_del_updates = 0;
247 int diff_del_epoch = 0;
248 int diff_del_admin_epoch = 0;
249
250 cib_diff_version_details(input,
251 &diff_add_admin_epoch, &diff_add_epoch, &diff_add_updates,
252 &diff_del_admin_epoch, &diff_del_epoch, &diff_del_updates);
253
254 sync_in_progress++;
255 crm_notice("Not applying diff %d.%d.%d -> %d.%d.%d (sync in progress)",
256 diff_del_admin_epoch, diff_del_epoch, diff_del_updates,
257 diff_add_admin_epoch, diff_add_epoch, diff_add_updates);
258 return -pcmk_err_diff_resync;
259 }
260
261 rc = cib_process_diff(op, options, section, req, input, existing_cib, result_cib, answer);
262
263 if (rc == -pcmk_err_diff_resync && cib_is_master == FALSE) {
264 xmlNode *sync_me = create_xml_node(NULL, "sync-me");
265
266 free_xml(*result_cib);
267 *result_cib = NULL;
268 crm_info("Requesting re-sync from peer");
269 sync_in_progress++;
270
271 crm_xml_add(sync_me, F_TYPE, "cib");
272 crm_xml_add(sync_me, F_CIB_OPERATION, CIB_OP_SYNC_ONE);
273 crm_xml_add(sync_me, F_CIB_DELEGATED, cib_our_uname);
274
275 if (send_cluster_message(NULL, crm_msg_cib, sync_me, FALSE) == FALSE) {
276 rc = -ENOTCONN;
277 }
278 free_xml(sync_me);
279

Callers

nothing calls this directly

Calls 6

cib_diff_version_detailsFunction · 0.85
cib_process_diffFunction · 0.85
create_xml_nodeFunction · 0.85
free_xmlFunction · 0.85
crm_xml_addFunction · 0.85
send_cluster_messageFunction · 0.85

Tested by

no test coverage detected