]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd_types,PG: trim mod_desc for log entries to min size 1344/head
authorSamuel Just <sam.just@inktank.com>
Sat, 1 Mar 2014 22:33:11 +0000 (14:33 -0800)
committerSamuel Just <sam.just@inktank.com>
Sat, 1 Mar 2014 22:54:06 +0000 (14:54 -0800)
In the event that mod_desc.bl contains pointers into a large
message buffer, we'd otherwise end up keeping around the entire
MOSDECSubOpWrite which created each log entry.

Fixes: #7539
Signed-off-by: Samuel Just <sam.just@inktank.com>
src/osd/PG.cc
src/osd/osd_types.h

index a525b7195299c0a57695723a7dbb2f5f79796e44..3af870fa9d1b10afe30bc1d5963342fbf82edf30 100644 (file)
@@ -2631,6 +2631,12 @@ void PG::add_log_entry(pg_log_entry_t& e, bufferlist& log_bl)
   if (e.user_version > info.last_user_version)
     info.last_user_version = e.user_version;
 
+  /**
+   * Make sure we don't keep around more than we need to in the
+   * in-memory log
+   */
+  e.mod_desc.trim_bl();
+
   // log mutation
   pg_log.add(e);
   dout(10) << "add_log_entry " << e << dendl;
index f74723bbbaac137748974116485721bf24d77136..4c03fc0a622f91fe0b01378c6473ae37f53c24d1 100644 (file)
@@ -1856,6 +1856,16 @@ public:
   bool empty() const {
     return can_local_rollback && (bl.length() == 0);
   }
+
+  /**
+   * Create fresh copy of bl bytes to avoid keeping large buffers around
+   * in the case that bl contains ptrs which point into a much larger
+   * message buffer
+   */
+  void trim_bl() {
+    if (bl.length() > 0)
+      bl.rebuild();
+  }
   void encode(bufferlist &bl) const;
   void decode(bufferlist::iterator &bl);
   void dump(Formatter *f) const;