~codership/galera/2.x

« back to all changes in this revision

Viewing changes to galera/src/replicator_smm.cpp

  • Committer: Alexey Yurchenko
  • Date: 2014-01-29 14:43:26 UTC
  • mto: This revision was merged to the branch mainline in revision 167.
  • Revision ID: alexey.yurchenko@codership.com-20140129144326-aa70nhzofl0smkm8
Fixes:
* provider pause() is fixed to avoid potential deadlock with replicating threads.
* lp:1099478 - handle own address in the address list properly (do not throw exception)
* lp:1259952 - fixed allocation of multiple of pages when posix_fallocate() is unavailable
* lp:1261996 - fixed compilation on Solaris 11
* lp:1232747 - fixed group remerge after partitioning event

Synced with SVN r3450

Show diffs side-by-side

added added

removed removed

Lines of Context:
180
180
    state_uuid_         (WSREP_UUID_UNDEFINED),
181
181
    state_uuid_str_     (),
182
182
    cc_seqno_           (WSREP_SEQNO_UNDEFINED),
 
183
    pause_seqno_        (WSREP_SEQNO_UNDEFINED),
183
184
    app_ctx_            (args->app_ctx),
184
185
    view_cb_            (args->view_handler_cb),
185
186
    apply_cb_           (args->apply_cb),
1369
1370
 
1370
1371
wsrep_seqno_t galera::ReplicatorSMM::pause()
1371
1372
{
1372
 
    try
1373
 
    {
1374
 
        gu_trace(local_monitor_.lock());
1375
 
    }
1376
 
    catch (gu::Exception& e)
1377
 
    {
1378
 
        if (e.get_errno() == EALREADY) return cert_.position();
1379
 
        throw;
1380
 
    }
1381
 
 
 
1373
    // Grab local seqno for local_monitor_
 
1374
    wsrep_seqno_t const local_seqno(
 
1375
        static_cast<wsrep_seqno_t>(gcs_.local_sequence()));
 
1376
    LocalOrder lo(local_seqno);
 
1377
    local_monitor_.enter(lo);
 
1378
 
 
1379
    // Local monitor should take care that concurrent
 
1380
    // pause requests are enqueued
 
1381
    assert(pause_seqno_ == WSREP_SEQNO_UNDEFINED);
 
1382
    pause_seqno_ = local_seqno;
 
1383
 
 
1384
    // Get drain seqno from cert index
1382
1385
    wsrep_seqno_t const ret(cert_.position());
1383
 
 
1384
1386
    apply_monitor_.drain(ret);
1385
1387
    assert (apply_monitor_.last_left() >= ret);
1386
1388
 
1392
1394
 
1393
1395
    st_.set(state_uuid_, ret);
1394
1396
 
1395
 
    log_info << "Provider paused at " << state_uuid_ << ':' << ret;
 
1397
    log_info << "Provider paused at " << state_uuid_ << ':' << ret
 
1398
             << " (" << pause_seqno_ << ")";
1396
1399
 
1397
1400
    return ret;
1398
1401
}
1399
1402
 
1400
1403
void galera::ReplicatorSMM::resume()
1401
1404
{
 
1405
    assert(pause_seqno_ != WSREP_SEQNO_UNDEFINED);
 
1406
    if (pause_seqno_ == WSREP_SEQNO_UNDEFINED)
 
1407
    {
 
1408
        gu_throw_error(EALREADY) << "tried to resume unpaused provider";
 
1409
    }
 
1410
 
1402
1411
    st_.set(state_uuid_, WSREP_SEQNO_UNDEFINED);
1403
 
 
1404
 
    try
1405
 
    {
1406
 
        gu_trace(local_monitor_.unlock());
1407
 
    }
1408
 
    catch (gu::Exception& e)
1409
 
    {
1410
 
        if (e.get_errno() == EBUSY)
1411
 
        {
1412
 
            /* monitor is still locked, restore saved state */
1413
 
            st_.set(state_uuid_, cert_.position());
1414
 
            return;
1415
 
        }
1416
 
        throw;
1417
 
    }
1418
 
 
 
1412
    log_info << "resuming provider at " << pause_seqno_;
 
1413
    LocalOrder lo(pause_seqno_);
 
1414
    pause_seqno_ = WSREP_SEQNO_UNDEFINED;
 
1415
    local_monitor_.leave(lo);
1419
1416
    log_info << "Provider resumed.";
1420
1417
}
1421
1418