ha_msg_add(sync_me, F_CIB_DELEGATED, cib_our_uname);
cib_process_diff(	const char *op, int options, const char *section, crm_data_t *input,	crm_data_t *existing_cib, crm_data_t **result_cib, crm_data_t **answer){	int log_level = LOG_DEBUG;	const char *value = NULL;	const char *reason = NULL;	gboolean apply_diff = TRUE;	gboolean do_resync = FALSE;	enum cib_errors result = cib_ok;	int this_updates = 0;	int this_epoche  = 0;	int this_admin_epoche = 0;	int diff_add_updates = 0;	int diff_add_epoche  = 0;	int diff_add_admin_epoche = 0;	int diff_del_updates = 0;	int diff_del_epoche  = 0;	int diff_del_admin_epoche = 0;	crm_debug("Processing \"%s\" event", op);		value = crm_element_value(existing_cib, XML_ATTR_GENERATION);	this_epoche = atoi(value?value:"0");		value = crm_element_value(existing_cib, XML_ATTR_NUMUPDATES);	this_updates = atoi(value?value:"0");		value = crm_element_value(existing_cib, XML_ATTR_GENERATION_ADMIN);	this_admin_epoche = atoi(value?value:"0");		cib_diff_version_details(		input,		&diff_add_admin_epoche, &diff_add_epoche, &diff_add_updates, 		&diff_del_admin_epoche, &diff_del_epoche, &diff_del_updates);	if(diff_del_admin_epoche == diff_add_admin_epoche	   && diff_del_epoche == diff_add_epoche	   && diff_del_updates == diff_add_updates) {		apply_diff = FALSE;		log_level = LOG_ERR;		reason = "+ and - versions in the diff did not change";		log_cib_diff(LOG_ERR, input, __FUNCTION__);	}	if(apply_diff && diff_del_admin_epoche > this_admin_epoche) {		do_resync = TRUE;		apply_diff = FALSE;		log_level = LOG_INFO;		reason = "current \""XML_ATTR_GENERATION_ADMIN"\" is less than required";			} else if(apply_diff && diff_del_admin_epoche < this_admin_epoche) {		apply_diff = FALSE;		log_level = LOG_WARNING;		reason = "current \""XML_ATTR_GENERATION_ADMIN"\" is greater than required";	}	if(apply_diff && diff_del_epoche > this_epoche) {		do_resync = TRUE;		apply_diff = FALSE;		log_level = LOG_INFO;		reason = "current \""XML_ATTR_GENERATION"\" is less than required";			} else if(apply_diff && diff_del_epoche < this_epoche) {		apply_diff = FALSE;		log_level = LOG_WARNING;		reason = "current \""XML_ATTR_GENERATION"\" is greater than required";	}	if(apply_diff && diff_del_updates > this_updates) {		do_resync = TRUE;		apply_diff = FALSE;		log_level = LOG_INFO;		reason = "current \""XML_ATTR_NUMUPDATES"\" is less than required";			} else if(apply_diff && diff_del_updates < this_updates) {		apply_diff = FALSE;		log_level = LOG_WARNING;		reason = "current \""XML_ATTR_NUMUPDATES"\" is greater than required";	}	if(apply_diff	   && apply_cib_diff(existing_cib, input, result_cib) == FALSE) {		log_level = LOG_WARNING;		reason = "Failed application of an update diff";		if(options & cib_force_diff && cib_is_master == FALSE) {  			log_level = LOG_INFO;			reason = "Failed application of a global update.  Requesting full refresh.";			do_resync = TRUE;		} else if(options & cib_force_diff) {			reason = "Failed application of a global update.  Not requesting full refresh.";		}	}	if(reason != NULL) {		crm_log_maybe(			log_level,			"Diff %d.%d.%d -> %d.%d.%d not applied to %d.%d.%d: %s",			diff_del_admin_epoche,diff_del_epoche,diff_del_updates,			diff_add_admin_epoche,diff_add_epoche,diff_add_updates,			this_admin_epoche,this_epoche,this_updates, reason);				result = cib_diff_failed;	}	if(do_resync && cib_is_master == FALSE) {		HA_Message *sync_me = ha_msg_new(2);		free_xml(*result_cib);		*result_cib = NULL;		result = cib_diff_resync;		crm_info("Requesting re-sync from peer: %s", reason);		ha_msg_add(sync_me, F_TYPE, "cib");		ha_msg_add(sync_me, F_CIB_OPERATION, CIB_OP_SYNC_ONE);		if(send_ha_message(hb_conn, sync_me, NULL) == FALSE) {			result = cib_not_connected;		}		ha_msg_del(sync_me);			} else if(do_resync) {		crm_err("Not resyncing in master mode");	}			return result;}