db/view: view_builder::execute(): only inject partition-start if needed
When resuming a build-step, the view builder injects the partition-start fragment of the last processed partition, to bring the consumer (compactor) into the correct state before it starts to consume the remainder of the partition content. This results in an invalid fragment stream when the partition was actually over or there is nothing left for the build step. Make the inject conditional on when the reader contains more data for the partition. Fixes: #11607
This commit is contained in:
@@ -2261,7 +2261,9 @@ void view_builder::execute(build_step& step, exponential_backoff_retry r) {
|
||||
batch_size,
|
||||
query::max_partitions,
|
||||
view_builder::consumer{*this, step, now});
|
||||
consumer.consume_new_partition(step.current_key); // Initialize the state in case we're resuming a partition
|
||||
if (auto mfp = step.reader.peek().get(); mfp && !mfp->is_partition_start()) {
|
||||
consumer.consume_new_partition(step.current_key); // Initialize the state in case we're resuming a partition
|
||||
}
|
||||
auto built = step.reader.consume_in_thread(std::move(consumer));
|
||||
|
||||
_as.check();
|
||||
|
||||
Reference in New Issue
Block a user