diff options
author | Samuel Just <sam.just@inktank.com> | 2013-07-17 15:04:10 -0700 |
---|---|---|
committer | Samuel Just <sam.just@inktank.com> | 2013-07-19 14:51:43 -0700 |
commit | 08aa499a0c455e0a30ec87df0bea41bf74ae7f0d (patch) | |
tree | d9c641c3f3662d72b26a7977e75533815211e3e2 | |
parent | 15eadb31cbf685749933067e51d52cfcfcf0b428 (diff) | |
download | ceph-08aa499a0c455e0a30ec87df0bea41bf74ae7f0d.tar.gz |
PG: start flush on primary only after we process the master log
Once we start serving reads, stray objects must have already
been removed. Therefore, we have to flush all operations
up to the transaction writing out the authoritative log.
On replicas, we flush in Stray() if we will not eventually
be activated and in ReplicaActive if we are in the acting
set. This way a replica won't serve a replica read until
the store is consistent.
Signed-off-by: Samuel Just <sam.just@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
(cherry picked from commit b41f1ba48563d1d3fd17c2f62d10103b5d63f305)
-rw-r--r-- | src/osd/PG.cc | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/osd/PG.cc b/src/osd/PG.cc index c1bf790fe78..935ebe7f42c 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -5904,11 +5904,6 @@ PG::RecoveryState::Started::Started(my_context ctx) { state_name = "Started"; context< RecoveryMachine >().log_enter(state_name); - PG *pg = context< RecoveryMachine >().pg; - pg->start_flush( - context< RecoveryMachine >().get_cur_transaction(), - context< RecoveryMachine >().get_on_applied_context_list(), - context< RecoveryMachine >().get_on_safe_context_list()); } boost::statechart::result @@ -6863,6 +6858,12 @@ PG::RecoveryState::ReplicaActive::ReplicaActive(my_context ctx) state_name = "Started/ReplicaActive"; context< RecoveryMachine >().log_enter(state_name); + + PG *pg = context< RecoveryMachine >().pg; + pg->start_flush( + context< RecoveryMachine >().get_cur_transaction(), + context< RecoveryMachine >().get_on_applied_context_list(), + context< RecoveryMachine >().get_on_safe_context_list()); } @@ -6952,6 +6953,11 @@ PG::RecoveryState::Stray::Stray(my_context ctx) assert(!pg->is_active()); assert(!pg->is_peering()); assert(!pg->is_primary()); + if (!pg->is_replica()) // stray, need to flush for pulls + pg->start_flush( + context< RecoveryMachine >().get_cur_transaction(), + context< RecoveryMachine >().get_on_applied_context_list(), + context< RecoveryMachine >().get_on_safe_context_list()); } boost::statechart::result PG::RecoveryState::Stray::react(const MLogRec& logevt) @@ -7299,6 +7305,10 @@ boost::statechart::result PG::RecoveryState::GetLog::react(const GotLog&) msg->info, msg->log, msg->missing, newest_update_osd); } + pg->start_flush( + context< RecoveryMachine >().get_cur_transaction(), + context< RecoveryMachine >().get_on_applied_context_list(), + context< RecoveryMachine >().get_on_safe_context_list()); return transit< GetMissing >(); } |