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>
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;
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;