Skip to content

Commit

Permalink
Fixed: commit fail at end of transaction caused assertion
Browse files Browse the repository at this point in the history
  • Loading branch information
olofhagsand committed Aug 23, 2024
1 parent c2317a5 commit da544e9
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 19 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
## 1.2.0
Expected: October 2024

### Corrected Bugs

* Fixed: commit fail in transaction caused assertion

## 1.1.0

3 July 2024

### New features
Expand Down
6 changes: 0 additions & 6 deletions src/controller_cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,11 +247,8 @@ controller_gentree_all(cligen_handle ch)
/* Generate auto-cligen tree from the specs */
if (yang2cli_yspec(h, yspec1, newtree) < 0)
goto done;
#if 1
// Optimize
if (yang_parse_optimize_uses(h, yspec1) < 0)
goto done;
#endif
/* Sanity (ph needed further down) */
if ((ph = cligen_ph_find(ch, newtree)) == NULL){
clixon_err(OE_YANG, 0, "autocli should have been generated but is not?");
Expand Down Expand Up @@ -355,11 +352,8 @@ controller_gentree_one(cligen_handle ch,
/* Generate auto-cligen tree from the specs */
if (yang2cli_yspec(h, yspec1, newtree) < 0)
goto done;
#if 1
// Optimize
if (yang_parse_optimize_uses(h, yspec1) < 0)
goto done;
#endif
/* Sanity (ph needed further down) */
if ((ph = cligen_ph_find(ch, newtree)) == NULL){
clixon_err(OE_YANG, 0, "autocli should have been generated but is not?");
Expand Down
23 changes: 10 additions & 13 deletions src/controller_device_state.c
Original file line number Diff line number Diff line change
Expand Up @@ -434,11 +434,8 @@ device_schemas_mount_parse(clixon_handle h,
clixon_err(OE_YANG, 0, "No yang spec");
goto done;
}
#if 1
// Optimize
if (yang_parse_optimize_uses(h, yspec1) < 0)
goto done;
#endif
/* Given yang-lib, actual parsing of all modules into yspec */
if ((ret = yang_lib2yspec(h, xyanglib, yspec1)) < 0)
goto done;
Expand Down Expand Up @@ -956,7 +953,8 @@ device_state_check_fail(clixon_handle h,
* @param[in] h Clixon handle
* @param[in] dh Device handle.
* @param[in] ct Controller transaction
* @retval 0 OK
* @retval 1 OK
* @retval 0 Failed
* @retval -1 Error
*/
static int
Expand Down Expand Up @@ -1045,12 +1043,12 @@ device_commit_when_done(clixon_handle h,
}
if ((ret = candidate_commit(h, NULL, db, 0, 0, cbret)) < 0){
/* Handle that candidate_commit can return < 0 if transaction ongoing */
cprintf(cbret, "%s", clixon_err_reason());
cprintf(cbret, "Failed to commit: %s", clixon_err_reason());
ret = 0;
}
if (ret == 0){ /* discard */
clixon_debug(CLIXON_DBG_CTRL, "%s", cbuf_get(cbret));
if (device_close_connection(dh, "Failed to commit: %s", cbuf_get(cbret)) < 0)
if (device_close_connection(dh, "%s", cbuf_get(cbret)) < 0)
goto done;
if (controller_transaction_failed(h, ct->ct_id, ct, dh, TR_FAILED_DEV_LEAVE,
device_handle_name_get(dh),
Expand Down Expand Up @@ -1310,20 +1308,19 @@ device_state_handler(clixon_handle h,
goto done;
break;
}
/* The device is OK */
if (device_state_check_ok(h, dh, ct) < 0)
goto done;
if (ct->ct_state == TS_DONE &&
ct->ct_result == TR_SUCCESS &&
!ct->ct_pull_transient){
if (controller_transaction_nr_devices(h, tid) == 1 &&
!ct->ct_pull_transient) {
/* See puts from each device in device_state_recv_config() */
if ((ret = device_commit_when_done(h, dh, ct, "tmpdev")) < 0)
goto done;
if (ret == 0)
break;
xmldb_delete(h, "tmpdev");
}
break;
/* The device is OK */
if (device_state_check_ok(h, dh, ct) < 0)
goto done;
break;
case CS_PUSH_LOCK:
if (device_state_check_sanity(dh, tid, ct, name, conn_state, rpcname) == 0)
break;
Expand Down

0 comments on commit da544e9

Please sign in to comment.