From 8113b32d124f487856a858c7f68a4e531399f66d Mon Sep 17 00:00:00 2001 From: Douglas Rumbaugh Date: Thu, 21 Dec 2023 17:07:29 -0500 Subject: DynamicExtension: comments/reorganization Clarified the reasoning for a few things in comments that just tripped me up during debugging. --- include/framework/DynamicExtension.h | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) (limited to 'include') diff --git a/include/framework/DynamicExtension.h b/include/framework/DynamicExtension.h index fe43c52..c5c4a1a 100644 --- a/include/framework/DynamicExtension.h +++ b/include/framework/DynamicExtension.h @@ -261,23 +261,29 @@ private: auto compactions = structure->get_compaction_tasks(); while (compactions.size() > 0) { - /* otherwise, we need to schedule a compaction */ + + /* schedule a compaction */ ReconstructionArgs *args = new ReconstructionArgs(); args->epoch = epoch; - // FIXME: all full buffers can be flushed at this point--but that requires - // retooling the shard interface a bit to do efficiently. args->merges = compactions; args->extension = this; args->compaction = true; + /* NOTE: args is deleted by the reconstruction job, so shouldn't be freed here */ auto wait = args->result.get_future(); + /* + * the reconstruction process calls end_job(), + * so we must start one before calling it + */ epoch->start_job(); + m_sched.schedule_job(reconstruction, 0, args); - /* wait for reconstruction completion */ + /* wait for compaction completion */ wait.get(); + /* get a new batch of compactions to perform, if needed */ compactions = structure->get_compaction_tasks(); } } @@ -557,17 +563,23 @@ private: } void schedule_reconstruction() { - //fprintf(stderr, "%ld\t Reconstruction Scheduling", m_current_epoch); auto epoch = create_new_epoch(); + /* + * the reconstruction process calls end_job(), + * so we must start one before calling it + */ epoch->start_job(); - ReconstructionArgs *args = new ReconstructionArgs(); - args->epoch = epoch; // FIXME: all full buffers can be flushed at this point--but that requires // retooling the shard interface a bit to do efficiently. + // + ReconstructionArgs *args = new ReconstructionArgs(); + args->epoch = epoch; args->merges = epoch->get_structure()->get_reconstruction_tasks(epoch->get_buffers()[0]->get_record_count()); args->extension = this; args->compaction = false; + /* NOTE: args is deleted by the reconstruction job, so shouldn't be freed here */ + m_sched.schedule_job(reconstruction, 0, args); } -- cgit v1.2.3