void mutation::copy_from(mutation_ptr& old) { data.updates = old->data.updates; client_requests = old->client_requests; _appro_data_bytes = old->_appro_data_bytes; _create_ts_ns = old->_create_ts_ns; for (auto& r : client_requests) { if (r != nullptr) { dsn_msg_add_ref(r); // release in dctor } } // let's always re-append the mutation to // replication logs as the ballot number // is changed, to ensure the invariance: // if decree(A) >= decree(B) // then ballot(A) >= ballot(B) /*if (old->is_logged()) { set_logged(); data.header.log_offset = old->data.header.log_offset; } */ _prepare_request = old->prepare_msg(); if (_prepare_request) { dsn_msg_add_ref(_prepare_request); } }
void replica::ack_prepare_message(error_code err, mutation_ptr& mu) { prepare_ack resp; resp.gpid = get_gpid(); resp.err = err; resp.ballot = get_ballot(); resp.decree = mu->data.header.decree; // for PS_POTENTIAL_SECONDARY ONLY resp.last_committed_decree_in_app = _app->last_committed_decree(); resp.last_committed_decree_in_prepare_list = last_committed_decree(); dassert(nullptr != mu->prepare_msg(), ""); reply(mu->prepare_msg(), resp); ddebug("%s: mutation %s ack_prepare_message, err = %s", name(), mu->name(), err.to_string()); }
void mutation::move_from(mutation_ptr& old) { data.updates = std::move(old->data.updates); rpc_code = old->rpc_code; _client_request = old->client_msg(); if (_client_request) { old->_client_request = nullptr; } _prepare_request = old->prepare_msg(); if (_prepare_request) { old->_prepare_request = nullptr; } }
void mutation::copy_from(mutation_ptr& old) { data.updates = old->data.updates; rpc_code = old->rpc_code; if (old->is_logged()) { set_logged(); data.header.log_offset = old->data.header.log_offset; } _client_request = old->client_msg(); if (_client_request) { dsn_msg_add_ref(_client_request); } _prepare_request = old->prepare_msg(); if (_prepare_request) { dsn_msg_add_ref(_prepare_request); } }