db/view/view_updating_consumer: account for the size of mutations

All partitions will have a corresponding mutation object in the buffer.
These objects have non-negligible sizes, yet the consumer did not bump
the _buffer_size when a new partition was consumer. This resulted in
empty partitions not moving the _buffer_size at all, and thus they could
accumulate without bounds in the buffer, never triggering a flush just
by themselves. We have recently seen this causing OOM.
This patch fixes that by bumping the _buffer_size with the size of the
freshly created mutation object.
This commit is contained in:
Botond Dénes
2023-07-25 09:42:45 -04:00
parent fda4168300
commit d66b07823b

View File

@@ -83,7 +83,11 @@ public:
void consume_new_partition(const dht::decorated_key& dk) {
_mut_builder.emplace(_schema);
_mut_builder->consume_new_partition(dk);
// Further accounting is inaccurate as we base it on the consumed
// mutation-fragments, not on their final form in the mutation.
// This is good enough, as long as the difference is small and mostly
// constant (per fragment).
_buffer_size += _mut_builder->consume_new_partition(dk).memory_usage(*_schema);
}
void consume(tombstone t) {