]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ReplicatedPG: skip stat invalidation when recording write errors
authorJosh Durgin <jdurgin@redhat.com>
Thu, 2 Jun 2016 22:04:59 +0000 (15:04 -0700)
committerJosh Durgin <jdurgin@redhat.com>
Sat, 9 Jul 2016 01:33:13 +0000 (18:33 -0700)
This is only needed for the lost/unfound use of submit_log_entries() etc.

Signed-off-by: Josh Durgin <jdurgin@redhat.com>
src/osd/PG.cc
src/osd/PG.h
src/osd/PGLog.cc
src/osd/PGLog.h
src/osd/ReplicatedPG.h

index e4eb1bcbead451b2b6aff6be55c08618eb6e57d2..d4b531c8044c23e9c450385650bb24979b74d2ee 100644 (file)
@@ -4545,7 +4545,7 @@ void PG::share_pg_info()
   }
 }
 
-void PG::append_log_entries_update_missing(
+bool PG::append_log_entries_update_missing(
   const list<pg_log_entry_t> &entries,
   ObjectStore::Transaction &t)
 {
@@ -4553,11 +4553,11 @@ void PG::append_log_entries_update_missing(
   assert(entries.begin()->version > info.last_update);
 
   PGLogEntryHandler rollbacker;
-  pg_log.append_new_log_entries(
-    info.last_backfill,
-    info.last_backfill_bitwise,
-    entries,
-    &rollbacker);
+  bool invalidate_stats =
+    pg_log.append_new_log_entries(info.last_backfill,
+                                 info.last_backfill_bitwise,
+                                 entries,
+                                 &rollbacker);
   rollbacker.apply(this, &t);
   info.last_update = pg_log.get_head();
 
@@ -4566,9 +4566,10 @@ void PG::append_log_entries_update_missing(
     info.last_complete = info.last_update;
   }
 
-  info.stats.stats_invalid = true;
+  info.stats.stats_invalid = info.stats.stats_invalid || invalidate_stats;
   dirty_info = true;
   write_if_dirty(t);
+  return invalidate_stats;
 }
 
 
@@ -4579,7 +4580,7 @@ void PG::merge_new_log_entries(
   dout(10) << __func__ << " " << entries << dendl;
   assert(is_primary());
 
-  append_log_entries_update_missing(entries, t);
+  bool rebuild_missing = append_log_entries_update_missing(entries, t);
   for (set<pg_shard_t>::const_iterator i = actingbackfill.begin();
        i != actingbackfill.end();
        ++i) {
@@ -4589,7 +4590,7 @@ void PG::merge_new_log_entries(
     assert(peer_info.count(peer));
     pg_missing_t& pmissing(peer_missing[peer]);
     pg_info_t& pinfo(peer_info[peer]);
-    PGLog::append_log_entries_update_missing(
+    bool invalidate_stats = PGLog::append_log_entries_update_missing(
       pinfo.last_backfill,
       info.last_backfill_bitwise,
       entries,
@@ -4598,8 +4599,14 @@ void PG::merge_new_log_entries(
       NULL,
       this);
     pinfo.last_update = info.last_update;
-    pinfo.stats.stats_invalid = true;
+    pinfo.stats.stats_invalid = pinfo.stats.stats_invalid || invalidate_stats;
+    rebuild_missing = rebuild_missing || invalidate_stats;
   }
+
+  if (!rebuild_missing) {
+    return;
+  }
+
   for (auto &&i: entries) {
     missing_loc.rebuild(
       i.soid,
index 506428ca92b80f664f3fa2f338d21212c1cfac22..ffe5d82f3c0fdcad6d4f02e7c74a519b44976372 100644 (file)
@@ -2274,7 +2274,7 @@ public:
   void share_pg_info();
 
 
-  void append_log_entries_update_missing(
+  bool append_log_entries_update_missing(
     const list<pg_log_entry_t> &entries,
     ObjectStore::Transaction &t);
 
index 140d19ea2fff12c3e5188eaa9acbe3ab66aaa474..c851f33eee38465e79db88c06e8314faad422196 100644 (file)
@@ -567,7 +567,7 @@ void PGLog::rewind_divergent_log(ObjectStore::Transaction& t, eversion_t newhead
   dirty_big_info = true;
 }
 
-void PGLog::append_log_entries_update_missing(
+bool PGLog::append_log_entries_update_missing(
   const hobject_t &last_backfill,
   bool last_backfill_bitwise,
   const list<pg_log_entry_t> &entries,
@@ -576,6 +576,7 @@ void PGLog::append_log_entries_update_missing(
   LogEntryHandler *rollbacker,
   const DoutPrefixProvider *dpp)
 {
+  bool invalidate_stats = false;
   if (log && !entries.empty()) {
     assert(log->head < entries.begin()->version);
     log->head = entries.rbegin()->version;
@@ -583,6 +584,7 @@ void PGLog::append_log_entries_update_missing(
   for (list<pg_log_entry_t>::const_iterator p = entries.begin();
        p != entries.end();
        ++p) {
+    invalidate_stats = invalidate_stats || !p->is_error();
     if (log) {
       log->log.push_back(*p);
       pg_log_entry_t &ne = log->log.back();
@@ -604,6 +606,7 @@ void PGLog::append_log_entries_update_missing(
   }
   if (log)
     log->reset_rollback_info_trimmed_to_riter();
+  return invalidate_stats;
 }
 
 void PGLog::merge_log(ObjectStore::Transaction& t,
index 22d969f30254f3791852f751f47033ee84427650..46b2f3c4f0c132878fcf2e30205f89bd5b44e131 100644 (file)
@@ -779,7 +779,7 @@ public:
                 pg_info_t &info, LogEntryHandler *rollbacker,
                 bool &dirty_info, bool &dirty_big_info);
 
-  static void append_log_entries_update_missing(
+  static bool append_log_entries_update_missing(
     const hobject_t &last_backfill,
     bool last_backfill_bitwise,
     const list<pg_log_entry_t> &entries,
@@ -787,12 +787,12 @@ public:
     pg_missing_t &missing,
     LogEntryHandler *rollbacker,
     const DoutPrefixProvider *dpp);
-  void append_new_log_entries(
+  bool append_new_log_entries(
     const hobject_t &last_backfill,
     bool last_backfill_bitwise,
     const list<pg_log_entry_t> &entries,
     LogEntryHandler *rollbacker) {
-    append_log_entries_update_missing(
+    bool invalidate_stats = append_log_entries_update_missing(
       last_backfill,
       last_backfill_bitwise,
       entries,
@@ -803,6 +803,7 @@ public:
     if (!entries.empty()) {
       mark_writeout_from(entries.begin()->version);
     }
+    return invalidate_stats;
   }
 
   void write_log(ObjectStore::Transaction& t,
index d5a88d9ae06a04d091c54b7cbec8df9952ca50fa..dd860c7708ca6fbac20743c5c3e9d4423f2a8199 100644 (file)
@@ -903,7 +903,9 @@ protected:
 
   /**
    * Merge entries atomically into all actingbackfill osds
-   * adjusting missing and recovery state as necessary
+   * adjusting missing and recovery state as necessary.
+   *
+   * Also used to store error log entries for dup detection.
    */
   void submit_log_entries(
     const list<pg_log_entry_t> &entries,