PREDECL_LIST(mgmt_be_batches);
struct mgmt_be_batch_ctx {
- /* Batch-Id as assigned by MGMTD */
- uint64_t batch_id;
-
struct mgmt_be_txn_req txn_req;
uint32_t flags;
}
static struct mgmt_be_batch_ctx *
-mgmt_be_find_batch_by_id(struct mgmt_be_txn_ctx *txn,
- uint64_t batch_id)
+mgmt_be_batch_create(struct mgmt_be_txn_ctx *txn)
{
struct mgmt_be_batch_ctx *batch = NULL;
- FOREACH_BE_TXN_BATCH_IN_LIST (txn, batch) {
- if (batch->batch_id == batch_id)
- return batch;
- }
+ batch = XCALLOC(MTYPE_MGMTD_BE_BATCH, sizeof(struct mgmt_be_batch_ctx));
- return NULL;
-}
+ mgmt_be_batches_add_tail(&txn->cfg_batches, batch);
-static struct mgmt_be_batch_ctx *
-mgmt_be_batch_create(struct mgmt_be_txn_ctx *txn, uint64_t batch_id)
-{
- struct mgmt_be_batch_ctx *batch = NULL;
-
- batch = mgmt_be_find_batch_by_id(txn, batch_id);
- if (!batch) {
- batch = XCALLOC(MTYPE_MGMTD_BE_BATCH,
- sizeof(struct mgmt_be_batch_ctx));
- assert(batch);
-
- batch->batch_id = batch_id;
- mgmt_be_batches_add_tail(&txn->cfg_batches, batch);
-
- MGMTD_BE_CLIENT_DBG("Added new batch-id: %" PRIu64
- " to transaction",
- batch_id);
- }
+ MGMTD_BE_CLIENT_DBG("Added new batch to transaction");
return batch;
}
}
static int mgmt_be_send_cfgdata_create_reply(struct mgmt_be_client *client_ctx,
- uint64_t txn_id, uint64_t batch_id,
- bool success,
+ uint64_t txn_id, bool success,
const char *error_if_any)
{
Mgmtd__BeMessage be_msg;
mgmtd__be_cfg_data_create_reply__init(&cfgdata_reply);
cfgdata_reply.txn_id = (uint64_t)txn_id;
- cfgdata_reply.batch_id = (uint64_t)batch_id;
cfgdata_reply.success = success;
if (error_if_any)
cfgdata_reply.error_if_any = (char *)error_if_any;
be_msg.message_case = MGMTD__BE_MESSAGE__MESSAGE_CFG_DATA_REPLY;
be_msg.cfg_data_reply = &cfgdata_reply;
- MGMTD_BE_CLIENT_DBG("Sending CFGDATA_CREATE_REPLY txn-id: %" PRIu64
- " batch-id: %" PRIu64,
- txn_id, batch_id);
+ MGMTD_BE_CLIENT_DBG("Sending CFGDATA_CREATE_REPLY txn-id: %" PRIu64,
+ txn_id);
return mgmt_be_client_send_msg(client_ctx, &be_msg);
}
err_buf[sizeof(err_buf) - 1] = 0;
MGMTD_BE_CLIENT_ERR(
"Failed to update configs for txn-id: %" PRIu64
- " batch-id: %" PRIu64
" to candidate, err: '%s'",
- txn->txn_id, batch->batch_id, err_buf);
+ txn->txn_id, err_buf);
return -1;
}
gettimeofday(&edit_nb_cfg_end, NULL);
client_ctx->num_prep_nb_cfg++;
FOREACH_BE_TXN_BATCH_IN_LIST (txn, batch) {
- mgmt_be_send_cfgdata_create_reply(
- client_ctx, txn->txn_id, batch->batch_id,
- error ? false : true, error ? err_buf : NULL);
if (!error) {
SET_FLAG(batch->flags,
MGMTD_BE_BATCH_FLAGS_CFG_PREPARED);
}
}
+ mgmt_be_send_cfgdata_create_reply(client_ctx, txn->txn_id,
+ error ? false : true, error ? err_buf : NULL);
+
MGMTD_BE_CLIENT_DBG(
"Avg-nb-edit-duration %lu uSec, nb-prep-duration %lu (avg: %lu) uSec, batch size %u",
client_ctx->avg_edit_nb_cfg_tm, prep_nb_cfg_tm,
*/
static int mgmt_be_update_setcfg_in_batch(struct mgmt_be_client *client_ctx,
struct mgmt_be_txn_ctx *txn,
- uint64_t batch_id,
Mgmtd__YangCfgDataReq *cfg_req[],
int num_req)
{
int index;
struct nb_cfg_change *cfg_chg;
- batch = mgmt_be_batch_create(txn, batch_id);
- if (!batch) {
- MGMTD_BE_CLIENT_ERR("Batch create failed!");
- return -1;
- }
+ batch = mgmt_be_batch_create(txn);
+ assert(batch);
txn_req = &batch->txn_req;
txn_req->event = MGMTD_BE_TXN_PROC_SETCFG;
- MGMTD_BE_CLIENT_DBG("Created SETCFG request for batch-id: %" PRIu64
- " txn-id: %" PRIu64 " cfg-items:%d",
- batch_id, txn->txn_id, num_req);
+ MGMTD_BE_CLIENT_DBG("Created SETCFG request for txn-id: %" PRIu64
+ " cfg-items:%d", txn->txn_id, num_req);
txn_req->req.set_cfg.num_cfg_changes = num_req;
for (index = 0; index < num_req; index++) {
}
static int mgmt_be_process_cfgdata_req(struct mgmt_be_client *client_ctx,
- uint64_t txn_id, uint64_t batch_id,
+ uint64_t txn_id,
Mgmtd__YangCfgDataReq *cfg_req[],
int num_req, bool end_of_data)
{
if (!txn)
goto failed;
- mgmt_be_update_setcfg_in_batch(client_ctx, txn, batch_id, cfg_req,
- num_req);
+ mgmt_be_update_setcfg_in_batch(client_ctx, txn, cfg_req, num_req);
if (txn && end_of_data) {
MGMTD_BE_CLIENT_DBG("End of data; CFG_PREPARE_REQ processing");
break;
case MGMTD__BE_MESSAGE__MESSAGE_CFG_DATA_REQ:
MGMTD_BE_CLIENT_DBG("Got CFG_DATA_REQ txn-id: %" PRIu64
- " batch-id: %" PRIu64 " end-of-data %u",
+ " end-of-data %u",
be_msg->cfg_data_req->txn_id,
- be_msg->cfg_data_req->batch_id,
be_msg->cfg_data_req->end_of_data);
mgmt_be_process_cfgdata_req(
client_ctx, be_msg->cfg_data_req->txn_id,
- be_msg->cfg_data_req->batch_id,
be_msg->cfg_data_req->data_req,
be_msg->cfg_data_req->n_data_req,
be_msg->cfg_data_req->end_of_data);
struct mgmt_txn_be_cfg_batch {
struct mgmt_txn_ctx *txn;
- uint64_t batch_id;
enum mgmt_be_client_id be_id;
struct mgmt_be_client_adapter *be_adapter;
Mgmtd__YangCfgDataReq cfg_data[MGMTD_MAX_CFG_CHANGES_IN_BATCH];
Mgmtd__YangDataValue value[MGMTD_MAX_CFG_CHANGES_IN_BATCH];
size_t num_cfg_data;
int buf_space_left;
- enum mgmt_commit_phase comm_phase;
struct mgmt_txn_batches_item list_linkage;
};
enum mgmt_commit_phase curr_phase;
enum mgmt_commit_phase next_phase;
+ enum mgmt_commit_phase be_phase[MGMTD_BE_CLIENT_ID_MAX];
+
/*
* Set of config changes to commit. This is used only
* when changes are NOT to be determined by comparing
/*
* List of backend batches for this commit to be validated
* and applied at the backend.
- *
- * FIXME: Need to re-think this design for the case set of
- * validators for a given YANG data item is different from
- * the set of notifiers for the same. We may need to have
- * separate list of batches for VALIDATE and APPLY.
*/
- struct mgmt_txn_batches_head curr_batches[MGMTD_BE_CLIENT_ID_MAX];
- struct mgmt_txn_batches_head next_batches[MGMTD_BE_CLIENT_ID_MAX];
+ struct mgmt_txn_batches_head batches[MGMTD_BE_CLIENT_ID_MAX];
/*
- * The last batch added for any backend client. This is always on
- * 'curr_batches'
+ * The last batch added for any backend client.
*/
struct mgmt_txn_be_cfg_batch *last_be_cfg_batch[MGMTD_BE_CLIENT_ID_MAX];
- struct hash *batches;
- uint64_t next_batch_id;
struct mgmt_commit_stats *cmt_stats;
};
static void mgmt_txn_register_event(struct mgmt_txn_ctx *txn,
enum mgmt_txn_event event);
-static int
-mgmt_move_be_commit_to_next_phase(struct mgmt_txn_ctx *txn,
- struct mgmt_be_client_adapter *adapter);
-
static struct mgmt_txn_be_cfg_batch *
mgmt_txn_cfg_batch_alloc(struct mgmt_txn_ctx *txn, enum mgmt_be_client_id id,
struct mgmt_be_client_adapter *be_adapter)
MGMTD_TXN_LOCK(txn);
assert(txn->commit_cfg_req);
mgmt_txn_batches_add_tail(&txn->commit_cfg_req->req.commit_cfg
- .curr_batches[id],
+ .batches[id],
batch);
batch->be_adapter = be_adapter;
batch->buf_space_left = MGMTD_BE_CFGDATA_MAX_MSG_LEN;
mgmt_be_adapter_lock(be_adapter);
txn->commit_cfg_req->req.commit_cfg.last_be_cfg_batch[id] = batch;
- if (!txn->commit_cfg_req->req.commit_cfg.next_batch_id)
- txn->commit_cfg_req->req.commit_cfg.next_batch_id++;
- batch->batch_id = txn->commit_cfg_req->req.commit_cfg.next_batch_id++;
- hash_get(txn->commit_cfg_req->req.commit_cfg.batches, batch,
- hash_alloc_intern);
return batch;
}
size_t indx;
struct mgmt_commit_cfg_req *cmtcfg_req;
- MGMTD_TXN_DBG(" freeing batch-id: %" PRIu64 " txn-id %" PRIu64,
- (*batch)->batch_id, (*batch)->txn->txn_id);
+ MGMTD_TXN_DBG(" freeing batch txn-id %" PRIu64, (*batch)->txn->txn_id);
assert((*batch)->txn && (*batch)->txn->type == MGMTD_TXN_TYPE_CONFIG);
cmtcfg_req = &(*batch)->txn->commit_cfg_req->req.commit_cfg;
- hash_release(cmtcfg_req->batches, *batch);
- mgmt_txn_batches_del(&cmtcfg_req->curr_batches[(*batch)->be_id], *batch);
- mgmt_txn_batches_del(&cmtcfg_req->next_batches[(*batch)->be_id], *batch);
+ mgmt_txn_batches_del(&cmtcfg_req->batches[(*batch)->be_id], *batch);
if ((*batch)->be_adapter)
mgmt_be_adapter_unlock(&(*batch)->be_adapter);
*batch = NULL;
}
-static unsigned int mgmt_txn_cfgbatch_hash_key(const void *data)
-{
- const struct mgmt_txn_be_cfg_batch *batch = data;
-
- return jhash2((uint32_t *)&batch->batch_id,
- sizeof(batch->batch_id) / sizeof(uint32_t), 0);
-}
-
-static bool mgmt_txn_cfgbatch_hash_cmp(const void *d1, const void *d2)
-{
- const struct mgmt_txn_be_cfg_batch *batch1 = d1;
- const struct mgmt_txn_be_cfg_batch *batch2 = d2;
-
- return (batch1->batch_id == batch2->batch_id);
-}
-
-static void mgmt_txn_cfgbatch_hash_free(void *data)
-{
- struct mgmt_txn_be_cfg_batch *batch = data;
-
- mgmt_txn_cfg_batch_free(&batch);
-}
-
-static inline struct mgmt_txn_be_cfg_batch *
-mgmt_txn_cfgbatch_id2ctx(struct mgmt_txn_ctx *txn, uint64_t batch_id)
-{
- struct mgmt_txn_be_cfg_batch key = { 0 };
- struct mgmt_txn_be_cfg_batch *batch;
-
- if (!txn->commit_cfg_req)
- return NULL;
-
- key.batch_id = batch_id;
- batch = hash_lookup(txn->commit_cfg_req->req.commit_cfg.batches, &key);
-
- return batch;
-}
-
static void mgmt_txn_cleanup_be_cfg_batches(struct mgmt_txn_ctx *txn,
enum mgmt_be_client_id id)
{
struct mgmt_txn_be_cfg_batch *batch;
struct mgmt_txn_batches_head *list;
- list = &txn->commit_cfg_req->req.commit_cfg.curr_batches[id];
- FOREACH_TXN_CFG_BATCH_IN_LIST (list, batch)
- mgmt_txn_cfg_batch_free(&batch);
-
- mgmt_txn_batches_fini(list);
-
- list = &txn->commit_cfg_req->req.commit_cfg.next_batches[id];
+ list = &txn->commit_cfg_req->req.commit_cfg.batches[id];
FOREACH_TXN_CFG_BATCH_IN_LIST (list, batch)
mgmt_txn_cfg_batch_free(&batch);
txn_req->req_id, txn->txn_id, txn->session_id);
FOREACH_MGMTD_BE_CLIENT_ID (id) {
+ txn_req->req.commit_cfg.be_phase[id] =
+ MGMTD_COMMIT_PHASE_PREPARE_CFG;
mgmt_txn_batches_init(
- &txn_req->req.commit_cfg.curr_batches[id]);
- mgmt_txn_batches_init(
- &txn_req->req.commit_cfg.next_batches[id]);
+ &txn_req->req.commit_cfg.batches[id]);
}
- txn_req->req.commit_cfg.batches =
- hash_create(mgmt_txn_cfgbatch_hash_key,
- mgmt_txn_cfgbatch_hash_cmp,
- "MGMT Config Batches");
+ txn_req->req.commit_cfg.curr_phase = MGMTD_COMMIT_PHASE_PREPARE_CFG;
break;
case MGMTD_TXN_PROC_GETCFG:
txn_req->req.get_data =
* anything more with them
*/
mgmt_txn_cleanup_be_cfg_batches((*txn_req)->txn, id);
- if (ccreq->batches) {
- hash_clean(ccreq->batches,
- mgmt_txn_cfgbatch_hash_free);
- hash_free(ccreq->batches);
- ccreq->batches = NULL;
- }
/*
* If we were in the middle of the state machine then
return 0;
}
-static void
-mgmt_move_txn_cfg_batch_to_next(struct mgmt_commit_cfg_req *cmtcfg_req,
- struct mgmt_txn_be_cfg_batch *batch,
- struct mgmt_txn_batches_head *src_list,
- struct mgmt_txn_batches_head *dst_list,
- bool update_commit_phase,
- enum mgmt_commit_phase to_phase)
-{
- mgmt_txn_batches_del(src_list, batch);
-
- if (update_commit_phase) {
- MGMTD_TXN_DBG("Move txn-id %" PRIu64 " batch-id: %" PRIu64
- " from '%s' --> '%s'",
- batch->txn->txn_id, batch->batch_id,
- mgmt_commit_phase2str(batch->comm_phase),
- mgmt_txn_commit_phase_str(batch->txn, false));
- batch->comm_phase = to_phase;
- }
-
- mgmt_txn_batches_add_tail(dst_list, batch);
-}
-
-static void mgmt_move_txn_cfg_batches(struct mgmt_txn_ctx *txn,
- struct mgmt_commit_cfg_req *cmtcfg_req,
- struct mgmt_txn_batches_head *src_list,
- struct mgmt_txn_batches_head *dst_list,
- bool update_commit_phase,
- enum mgmt_commit_phase to_phase)
-{
- struct mgmt_txn_be_cfg_batch *batch;
-
- FOREACH_TXN_CFG_BATCH_IN_LIST (src_list, batch) {
- mgmt_move_txn_cfg_batch_to_next(cmtcfg_req, batch, src_list,
- dst_list, update_commit_phase,
- to_phase);
- }
-}
-
static int
mgmt_try_move_commit_to_next_phase(struct mgmt_txn_ctx *txn,
struct mgmt_commit_cfg_req *cmtcfg_req)
{
- struct mgmt_txn_batches_head *curr_list, *next_list;
enum mgmt_be_client_id id;
MGMTD_TXN_DBG("txn-id: %" PRIu64 ", Phase(current:'%s' next:'%s')",
*/
FOREACH_MGMTD_BE_CLIENT_ID (id) {
if (IS_IDBIT_SET(cmtcfg_req->clients, id) &&
- mgmt_txn_batches_count(&cmtcfg_req->curr_batches[id])) {
+ cmtcfg_req->be_phase[id] == cmtcfg_req->curr_phase) {
/*
* There's atleast once client who hasn't moved to
* next phase.
*/
cmtcfg_req->curr_phase = cmtcfg_req->next_phase;
cmtcfg_req->next_phase++;
- MGMTD_TXN_DBG("Move back all config batches for txn-id: %" PRIu64
- " from next to current branch",
- txn->txn_id);
- FOREACH_MGMTD_BE_CLIENT_ID (id) {
- curr_list = &cmtcfg_req->curr_batches[id];
- next_list = &cmtcfg_req->next_batches[id];
- mgmt_move_txn_cfg_batches(txn, cmtcfg_req, next_list, curr_list,
- false, 0);
- }
mgmt_txn_register_event(txn, MGMTD_TXN_PROC_COMMITCFG);
return 0;
}
-static int
-mgmt_move_be_commit_to_next_phase(struct mgmt_txn_ctx *txn,
- struct mgmt_be_client_adapter *adapter)
-{
- struct mgmt_commit_cfg_req *cmtcfg_req;
- struct mgmt_txn_batches_head *curr_list, *next_list;
-
- if (txn->type != MGMTD_TXN_TYPE_CONFIG || !txn->commit_cfg_req)
- return -1;
-
- cmtcfg_req = &txn->commit_cfg_req->req.commit_cfg;
-
- MGMTD_TXN_DBG("Move txn-id: %" PRIu64
- " for '%s' Phase(current: '%s' next:'%s')",
- txn->txn_id, adapter->name,
- mgmt_txn_commit_phase_str(txn, true),
- mgmt_txn_commit_phase_str(txn, false));
-
- MGMTD_TXN_DBG("Move all config batches for '%s' from current to next list",
- adapter->name);
- curr_list = &cmtcfg_req->curr_batches[adapter->id];
- next_list = &cmtcfg_req->next_batches[adapter->id];
- mgmt_move_txn_cfg_batches(txn, cmtcfg_req, curr_list, next_list, true,
- cmtcfg_req->next_phase);
-
- MGMTD_TXN_DBG("txn-id: %" PRIu64 ", Phase(current:'%s' next:'%s')",
- txn->txn_id, mgmt_txn_commit_phase_str(txn, true),
- mgmt_txn_commit_phase_str(txn, false));
-
- /*
- * Check if all clients has moved to next phase or not.
- */
- mgmt_try_move_commit_to_next_phase(txn, cmtcfg_req);
-
- return 0;
-}
-
/*
* This is the real workhorse
*/
value;
value = NULL;
- MGMTD_TXN_DBG(" -- %s, batch-id: %" PRIu64 " item:%d",
- adapter->name, batch->batch_id,
+ MGMTD_TXN_DBG(" -- %s, batch item:%d", adapter->name,
(int)batch->num_cfg_data);
batch->num_cfg_data++;
return -1;
}
+ /* Move all BE clients to create phase */
+ FOREACH_MGMTD_BE_CLIENT_ID(id) {
+ if (IS_IDBIT_SET(cmtcfg_req->clients, id))
+ cmtcfg_req->be_phase[id] =
+ MGMTD_COMMIT_PHASE_TXN_CREATE;
+ }
+
cmtcfg_req->next_phase = MGMTD_COMMIT_PHASE_TXN_CREATE;
return 0;
}
enum mgmt_be_client_id id;
struct mgmt_be_client_adapter *adapter;
struct mgmt_commit_cfg_req *cmtcfg_req;
- struct mgmt_txn_be_cfg_batch *batch;
assert(txn->type == MGMTD_TXN_TYPE_CONFIG && txn->commit_cfg_req);
"Could not send TXN_CREATE to backend adapter");
return -1;
}
-
- FOREACH_TXN_CFG_BATCH_IN_LIST (&txn->commit_cfg_req->req
- .commit_cfg
- .curr_batches[id],
- batch)
- batch->comm_phase =
- MGMTD_COMMIT_PHASE_TXN_CREATE;
}
}
assert(IS_IDBIT_SET(cmtcfg_req->clients, adapter->id));
indx = 0;
- num_batches =
- mgmt_txn_batches_count(&cmtcfg_req->curr_batches[adapter->id]);
- FOREACH_TXN_CFG_BATCH_IN_LIST (&cmtcfg_req->curr_batches[adapter->id],
+ num_batches = mgmt_txn_batches_count(&cmtcfg_req->batches[adapter->id]);
+ FOREACH_TXN_CFG_BATCH_IN_LIST (&cmtcfg_req->batches[adapter->id],
batch) {
assert(cmtcfg_req->next_phase == MGMTD_COMMIT_PHASE_SEND_CFG);
cfg_req.num_reqs = batch->num_cfg_data;
indx++;
if (mgmt_be_send_cfgdata_req(adapter, txn->txn_id,
- batch->batch_id,
cfg_req.cfgdata_reqs,
cfg_req.num_reqs,
indx == num_batches)) {
txn, MGMTD_INTERNAL_ERROR,
"Internal Error! Could not send config data to backend!");
MGMTD_TXN_ERR("Could not send CFGDATA_CREATE txn-id: %" PRIu64
- " batch-id: %" PRIu64 " to client '%s",
- txn->txn_id, batch->batch_id,
- adapter->name);
+ " to client '%s", txn->txn_id, adapter->name);
return -1;
}
cmtcfg_req->cmt_stats->last_num_cfgdata_reqs++;
- mgmt_move_txn_cfg_batch_to_next(
- cmtcfg_req, batch,
- &cmtcfg_req->curr_batches[adapter->id],
- &cmtcfg_req->next_batches[adapter->id], true,
- MGMTD_COMMIT_PHASE_SEND_CFG);
}
+ cmtcfg_req->be_phase[adapter->id] = MGMTD_COMMIT_PHASE_SEND_CFG;
+
/*
* This could be the last Backend Client to send CFGDATA_CREATE_REQ to.
* Try moving the commit to next phase.
&txn->commit_cfg_req->req.commit_cfg;
assert(txn->type == MGMTD_TXN_TYPE_CONFIG);
- assert(!mgmt_txn_batches_count(&cmtcfg_req->curr_batches[adapter->id]));
if (IS_IDBIT_UNSET(cmtcfg_req->clients, adapter->id))
return 0;
enum mgmt_be_client_id id;
struct mgmt_be_client_adapter *adapter;
struct mgmt_commit_cfg_req *cmtcfg_req;
- struct mgmt_txn_batches_head *batch_list;
- struct mgmt_txn_be_cfg_batch *batch;
assert(txn->type == MGMTD_TXN_TYPE_CONFIG && txn->commit_cfg_req);
if (!adapter)
return -1;
- batch_list = &cmtcfg_req->curr_batches[id];
if (mgmt_be_send_cfgapply_req(adapter, txn->txn_id)) {
(void)mgmt_txn_send_commit_cfg_reply(
txn, MGMTD_INTERNAL_ERROR,
UNSET_FLAG(adapter->flags,
MGMTD_BE_ADAPTER_FLAGS_CFG_SYNCED);
-
- FOREACH_TXN_CFG_BATCH_IN_LIST (batch_list, batch)
- batch->comm_phase = MGMTD_COMMIT_PHASE_APPLY_CFG;
}
}
txn, MGMTD_INTERNAL_ERROR,
"Internal error! Failed to initiate transaction at backend!");
}
- } else {
- /*
- * Done with TXN_DELETE. Move the backend client to next phase.
- */
- if (false)
- mgmt_move_be_commit_to_next_phase(txn, adapter);
}
return 0;
}
-int mgmt_txn_notify_be_cfgdata_reply(uint64_t txn_id, uint64_t batch_id,
- bool success, char *error_if_any,
+int mgmt_txn_notify_be_cfgdata_reply(uint64_t txn_id, bool success,
+ char *error_if_any,
struct mgmt_be_client_adapter *adapter)
{
struct mgmt_txn_ctx *txn;
- struct mgmt_txn_be_cfg_batch *batch;
struct mgmt_commit_cfg_req *cmtcfg_req;
txn = mgmt_txn_id2ctx(txn_id);
return -1;
cmtcfg_req = &txn->commit_cfg_req->req.commit_cfg;
- batch = mgmt_txn_cfgbatch_id2ctx(txn, batch_id);
- if (!batch || batch->txn != txn)
- return -1;
-
if (!success) {
MGMTD_TXN_ERR("CFGDATA_CREATE_REQ sent to '%s' failed txn-id: %" PRIu64
- " batch-id %" PRIu64 " err: %s",
- adapter->name, txn->txn_id, batch->batch_id,
+ " err: %s", adapter->name, txn->txn_id,
error_if_any ? error_if_any : "None");
mgmt_txn_send_commit_cfg_reply(
txn, MGMTD_INTERNAL_ERROR,
}
MGMTD_TXN_DBG("CFGDATA_CREATE_REQ sent to '%s' was successful txn-id: %" PRIu64
- " batch-id %" PRIu64 " err: %s",
- adapter->name, txn->txn_id, batch->batch_id,
+ " err: %s", adapter->name, txn->txn_id,
error_if_any ? error_if_any : "None");
- mgmt_move_txn_cfg_batch_to_next(cmtcfg_req, batch,
- &cmtcfg_req->curr_batches[adapter->id],
- &cmtcfg_req->next_batches[adapter->id],
- true, MGMTD_COMMIT_PHASE_APPLY_CFG);
+
+ cmtcfg_req->be_phase[adapter->id] = MGMTD_COMMIT_PHASE_APPLY_CFG;
mgmt_try_move_commit_to_next_phase(txn, cmtcfg_req);
return 0;
}
- mgmt_move_txn_cfg_batches(txn, cmtcfg_req,
- &cmtcfg_req->curr_batches[adapter->id],
- &cmtcfg_req->next_batches[adapter->id],
- true, MGMTD_COMMIT_PHASE_TXN_DELETE);
+ cmtcfg_req->be_phase[adapter->id] = MGMTD_COMMIT_PHASE_TXN_DELETE;
/*
* All configuration for the specific backend has been applied.