From: Samuel Just Date: Sat, 1 Mar 2014 22:33:11 +0000 (-0800) Subject: osd_types,PG: trim mod_desc for log entries to min size X-Git-Tag: v0.78~106^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=62fd382fbf10f2b78946426644d445549a7ebed1;p=ceph.git osd_types,PG: trim mod_desc for log entries to min size 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 --- diff --git a/src/osd/PG.cc b/src/osd/PG.cc index a525b719529..3af870fa9d1 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -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; diff --git a/src/osd/osd_types.h b/src/osd/osd_types.h index f74723bbbaa..4c03fc0a622 100644 --- a/src/osd/osd_types.h +++ b/src/osd/osd_types.h @@ -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;