~jheiss/galera/galera

« back to all changes in this revision

Viewing changes to galera/src/replicator_smm.cpp

  • Committer: Alex Yurchenko
  • Date: 2012-01-16 03:54:07 UTC
  • mto: This revision was merged to the branch mainline in revision 109.
  • Revision ID: ayurchen@void-20120116035407-fnlisz8pubqxh1m5
References lp:915499, lp:907071 - synced with SVN r2671

Show diffs side-by-side

added added

removed removed

Lines of Context:
63
63
static void
64
64
apply_trx_ws(void*                    recv_ctx,
65
65
             wsrep_apply_cb_t         apply_cb,
66
 
             wsrep_rollback_cb_t      rollback_cb,
 
66
             wsrep_commit_cb_t        commit_cb,
67
67
             const galera::TrxHandle& trx)
68
68
    throw (galera::ApplyException, gu::Exception)
69
69
{
103
103
 
104
104
                if (WSREP_TRX_FAIL == err)
105
105
                {
106
 
                    int const rcode(rollback_cb(recv_ctx, trx.global_seqno()));
 
106
                    int const rcode(commit_cb(recv_ctx,trx.global_seqno(),false));
107
107
                    if (WSREP_OK != rcode)
108
108
                    {
109
109
                        gu_throw_fatal << "Rollback failed. Trx: " << trx;
168
168
    :
169
169
    logger_             (reinterpret_cast<gu_log_cb_t>(args->logger_cb)),
170
170
    config_             (args->options),
171
 
    set_defaults_       (config_, defaults),
 
171
    set_defaults_       (config_, defaults, args->node_address),
172
172
    protocol_version_   (args->proto_ver),
173
173
    state_              (S_CLOSED),
174
174
    sst_state_          (SST_NONE),
183
183
    view_cb_            (args->view_handler_cb),
184
184
    apply_cb_           (args->apply_cb),
185
185
    commit_cb_          (args->commit_cb),
186
 
    rollback_cb_        (args->rollback_cb),
187
186
    sst_donate_cb_      (args->sst_donate_cb),
188
187
    synced_cb_          (args->synced_cb),
189
188
    sst_donor_          (),
439
438
    CommitOrder co(*trx, co_mode_);
440
439
 
441
440
    gu_trace(apply_monitor_.enter(ao));
442
 
    gu_trace(apply_trx_ws(recv_ctx, apply_cb_, rollback_cb_, *trx));
 
441
    gu_trace(apply_trx_ws(recv_ctx, apply_cb_, commit_cb_, *trx));
443
442
    // at this point any exception in apply_trx_ws() is fatal, not
444
443
    // catching anything.
445
444
    if (gu_likely(co_mode_ != CommitOrder::BYPASS))
446
445
    {
447
446
        gu_trace(commit_monitor_.enter(co));
448
447
 
449
 
        if (gu_unlikely (WSREP_OK != commit_cb_(recv_ctx, trx->global_seqno())))
 
448
        if (gu_unlikely (WSREP_OK != commit_cb_(recv_ctx, trx->global_seqno(),
 
449
                                                true)))
450
450
            gu_throw_fatal << "Commit failed. Trx: " << trx;
451
451
 
452
452
        commit_monitor_.leave(co);
453
453
    }
454
454
    else
455
455
    {
456
 
        if (gu_unlikely (WSREP_OK != commit_cb_(recv_ctx, trx->global_seqno())))
 
456
        if (gu_unlikely (WSREP_OK != commit_cb_(recv_ctx, trx->global_seqno(),
 
457
                                                true)))
457
458
            gu_throw_fatal << "Commit failed. Trx: " << trx;
458
459
    }
459
460
    apply_monitor_.leave(ao);
775
776
        ++local_replays_;
776
777
        trx->set_state(TrxHandle::S_REPLAYING);
777
778
 
778
 
        gu_trace(apply_trx_ws(trx_ctx, apply_cb_, rollback_cb_, *trx));
 
779
        gu_trace(apply_trx_ws(trx_ctx, apply_cb_, commit_cb_, *trx));
779
780
 
780
 
        if (gu_unlikely (WSREP_OK != commit_cb_(trx_ctx, trx->global_seqno())))
 
781
        if (gu_unlikely (WSREP_OK != commit_cb_(trx_ctx, trx->global_seqno(),
 
782
                                                true)))
781
783
            gu_throw_fatal << "Commit failed. Trx: " << trx;
782
784
 
783
785
        // apply, commit monitors are released in post commit
816
818
    ApplyOrder ao(*trx);
817
819
    apply_monitor_.leave(ao);
818
820
    cert_.set_trx_committed(trx);
819
 
#if 0 // REMOVE
820
 
    if (trx->action() != 0)
821
 
    {
822
 
        gcache_.free(trx->action());
823
 
        trx->set_action(0);
824
 
    }
825
 
    else
826
 
    {
827
 
        log_warn << "no assigned cached action for " << *trx;
828
 
    }
829
 
#endif
830
821
    trx->set_state(TrxHandle::S_COMMITTED);
831
822
    report_last_committed();
832
823
    ++local_commits_;