summaryrefslogtreecommitdiffstats
path: root/src/journal
diff options
context:
space:
mode:
authorJason Dillaman <dillaman@redhat.com>2016-07-20 14:06:13 +0200
committerJason Dillaman <dillaman@redhat.com>2016-07-21 18:52:57 +0200
commit8c1877b82fee0db1dba76252b32ff348226d41a7 (patch)
tree50ee49ec616561a50a87552fdc563e0562305930 /src/journal
parentjournal: optionally fetch entries in small chunks during replay (diff)
downloadceph-8c1877b82fee0db1dba76252b32ff348226d41a7.tar.xz
ceph-8c1877b82fee0db1dba76252b32ff348226d41a7.zip
journal: optionally restrict maximum entry payload size
Journal playback will need to read at least a full entry which was currently limited to the maximum object size. In memory constrained environment, this new optional limit will set a fix upper bound on memory usage. Signed-off-by: Jason Dillaman <dillaman@redhat.com>
Diffstat (limited to 'src/journal')
-rw-r--r--src/journal/Journaler.cc8
-rw-r--r--src/journal/Settings.h1
2 files changed, 8 insertions, 1 deletions
diff --git a/src/journal/Journaler.cc b/src/journal/Journaler.cc
index 05d80693dc8..27cc33845c0 100644
--- a/src/journal/Journaler.cc
+++ b/src/journal/Journaler.cc
@@ -395,7 +395,13 @@ void Journaler::stop_append(Context *on_safe) {
}
uint64_t Journaler::get_max_append_size() const {
- return m_metadata->get_object_size() - Entry::get_fixed_size();
+ uint64_t max_payload_size = m_metadata->get_object_size() -
+ Entry::get_fixed_size();
+ if (m_metadata->get_settings().max_payload_bytes > 0) {
+ max_payload_size = MIN(max_payload_size,
+ m_metadata->get_settings().max_payload_bytes);
+ }
+ return max_payload_size;
}
Future Journaler::append(uint64_t tag_tid, const bufferlist &payload_bl) {
diff --git a/src/journal/Settings.h b/src/journal/Settings.h
index d8f5e746930..603770cbaf6 100644
--- a/src/journal/Settings.h
+++ b/src/journal/Settings.h
@@ -11,6 +11,7 @@ namespace journal {
struct Settings {
double commit_interval = 5; ///< commit position throttle (in secs)
uint64_t max_fetch_bytes = 0; ///< 0 implies no limit
+ uint64_t max_payload_bytes = 0; ///< 0 implies object size limit
};
} // namespace journal