#1150 create a wrapper macro around sysdb_transaction_start/_end
Closed: Invalid None Opened 9 years ago by jhrozek.

We should create helper macros around sysdb_transaction_start/_commit/_end (or extend these functions) to avoid duplicating code in the common case where we track whether we are inside a transaction with a boolean variable in_transaction.


Fields changed

milestone: NEEDS_TRIAGE => SSSD Deferred
type: defect => task

Fields changed

rhbz: => 0

There are still a couple of places in the code where the following pattern is used

    if (in_transaction) {
        if (ret == EOK) {
            sret = sysdb_transaction_commit(sysdb);
            if (sret != EOK) {
                DEBUG(SSSDBG_OP_FAILURE, ("Could not commit transaction\n"));
            }
        }

        if (ret != EOK || sret != EOK){
            sret = sysdb_transaction_cancel(sysdb);
            if (sret != EOK) {
                DEBUG(SSSDBG_OP_FAILURE, ("Could not cancel transaction\n"));
            }
        }
    }

here ret is still EOK if sysdb_transaction_commit() fails. The approved pattern looks like

    ret = sysdb_transaction_commit(sysdb);
    if (ret == EOK) in_transaction = false;

done:
    if (in_transaction) {
        sret = sysdb_transaction_cancel(sysdb);
        if (sret != EOK) {
            DEBUG(SSSDBG_CRIT_FAILURE, ("Could not cancel transaction\n"));
        }
    }
    talloc_free(tmp_ctx);
    return ret;

Instead of updating the pattern it would make sense to introduce the macros described in this ticket.

feature_milestone: =>
milestone: SSSD Deferred => NEEDS_TRIAGE

Fields changed

milestone: NEEDS_TRIAGE => SSSD 1.9.0

Fields changed

owner: somebody => mzidek

Fields changed

milestone: SSSD 1.9.0 => SSSD 1.10.0

Fields changed

milestone: SSSD 1.10.0 => SSSD 1.10 beta

Fields changed

selected: => Not need

Moving tickets that are not a priority for SSSD 1.10 into the next release.

milestone: SSSD 1.10 beta => SSSD 1.11 beta

Fields changed

mark: => 0

This is not really possible in a nice way. The good thing is that Michal unified the code and cleaned up transaction processing.

changelog: =>
design: =>
design_review: => 0
fedora_test_page: =>
resolution: => wontfix
review: => 0
status: new => closed

Metadata Update from @jhrozek:
- Issue assigned to mzidek
- Issue set to the milestone: SSSD 1.13.1

3 years ago

SSSD is moving from Pagure to Github. This means that new issues and pull requests
will be accepted only in SSSD's github repository.

This issue has been cloned to Github and is available here:
- https://github.com/SSSD/sssd/issues/2192

If you want to receive further updates on the issue, please navigate to the github issue
and click on subscribe button.

Thank you for understanding. We apologize for all inconvenience.

Login to comment on this ticket.

Metadata