Skip to content

Commit e961e37

Browse files
committed
Updated ParallelWriterWorkerV4 to support writing each buffer type independently
This allows, for example, all buffer types of a worker to be written concurrently.
1 parent 8d22407 commit e961e37

2 files changed

Lines changed: 46 additions & 0 deletions

File tree

libtiledbvcf/src/write/parallel_writer_worker_v4.cc

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,32 @@ void ParallelWriterWorkerV4::flush_ingestion_tasks(bool finalize, size_t i) {
220220
stats_worker_->flush(finalize, i);
221221
}
222222

223+
void ParallelWriterWorkerV4::write_record_buffers(
224+
std::unique_ptr<Query>& record_query, bool finalize, size_t i) {
225+
Buffers& buffers = buffers_[i];
226+
227+
// Write the buffered records
228+
write_buffers(
229+
record_query, buffers.record_buffers, buffers.records_buffered, finalize);
230+
231+
// Clear the buffers
232+
buffers.record_buffers.clear();
233+
buffers.records_buffered = 0;
234+
}
235+
236+
void ParallelWriterWorkerV4::write_anchor_buffers(
237+
std::unique_ptr<Query>& anchor_query, bool finalize, size_t i) {
238+
Buffers& buffers = buffers_[i];
239+
240+
// Write the buffered anchors
241+
write_buffers(
242+
anchor_query, buffers.anchor_buffers, buffers.anchors_buffered, finalize);
243+
244+
// Clear the buffers
245+
buffers.anchor_buffers.clear();
246+
buffers.anchors_buffered = 0;
247+
}
248+
223249
void ParallelWriterWorkerV4::write_buffers(
224250
std::unique_ptr<Query>& record_query,
225251
std::unique_ptr<Query>& anchor_query,

libtiledbvcf/src/write/parallel_writer_worker_v4.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,26 @@ class ParallelWriterWorkerV4 : public WriterWorker,
224224
return flush_ingestion_tasks(finalize, 0);
225225
}
226226

227+
/**
228+
* Writes buffered records.
229+
*
230+
* @param record_query The query to use for writing records
231+
* @param finalize Whether or not the write queriy should be finalized
232+
* @param i Which buffers to write
233+
*/
234+
void write_record_buffers(
235+
std::unique_ptr<Query>& record_query, bool finalize, size_t i);
236+
237+
/**
238+
* Writes buffered anchors.
239+
*
240+
* @param anchor_query The query to use for writing anchors
241+
* @param finalize Whether or not the write queriy should be finalized
242+
* @param i Which buffers to write
243+
*/
244+
void write_anchor_buffers(
245+
std::unique_ptr<Query>& anchor_query, bool finalize, size_t i);
246+
227247
/**
228248
* Writes all buffered data, i.e. records, anchors, allele counts, variant
229249
* stats, and sample stats. Note that sample stats are only written when

0 commit comments

Comments
 (0)