<commit_before>// Copyright 2010-2013 RethinkDB, all rights reserved.
#include "serializer/merger.hpp"

#include "errors.hpp"

#include "serializer/types.hpp"
#include "arch/runtime/coroutines.hpp"
#include "config/args.hpp"



merger_serializer_t::merger_serializer_t(serializer_t *_inner, int _max_active_writes) :
    inner(_inner),
    index_writes_io_account(make_io_account(MERGED_INDEX_WRITE_IO_PRIORITY)),
    num_active_writes(0),
    max_active_writes(_max_active_writes) {
}

merger_serializer_t::~merger_serializer_t() {
    assert_thread();
    rassert(num_active_writes == 0);
    rassert(outstanding_index_writes.empty());
    
    delete index_writes_io_account;
    delete inner;
}

void merger_serializer_t::index_write(const std::vector<index_write_op_t>& write_ops, file_account_t *) {
    rassert(coro_t::self() != NULL);
    assert_thread();
    
    std::shared_ptr<cond_t> write_complete;
    {
        // Our set of write ops must be processed atomically...
        ASSERT_NO_CORO_WAITING;
        for (auto op = write_ops.begin(); op != write_ops.end(); ++op) {
            push_index_write(*op);
        }
        // ... and we also take a copy of the on_index_writes_complete signal<commit_msg>Missing initialization<commit_after>// Copyright 2010-2013 RethinkDB, all rights reserved.
#include "serializer/merger.hpp"

#include "errors.hpp"

#include "serializer/types.hpp"
#include "arch/runtime/coroutines.hpp"
#include "config/args.hpp"



merger_serializer_t::merger_serializer_t(serializer_t *_inner, int _max_active_writes) :
    inner(_inner),
    index_writes_io_account(make_io_account(MERGED_INDEX_WRITE_IO_PRIORITY)),
    on_index_writes_complete(new cond_t()),
    num_active_writes(0),
    max_active_writes(_max_active_writes) {
}

merger_serializer_t::~merger_serializer_t() {
    assert_thread();
    rassert(num_active_writes == 0);
    rassert(outstanding_index_writes.empty());
    
    delete index_writes_io_account;
    delete inner;
}

void merger_serializer_t::index_write(const std::vector<index_write_op_t>& write_ops, file_account_t *) {
    rassert(coro_t::self() != NULL);
    assert_thread();
    
    std::shared_ptr<cond_t> write_complete;
    {
        // Our set of write ops must be processed atomically...
        ASSERT_NO_CORO_WAITING;
        for (auto op = write_ops.begin(); op != write_ops.end(); ++op) {
            push_index_write(*op);
        }
        // ... and we also take a copy of the on_index_writes_complete signal
{'fraction_non_alphanumeric': 0.11413696435722867, 'fraction_numerical': 0.008009611533840609, 'mean_word_length': 4.204166666666667, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7215359', 'n_tokens_mistral': 888, 'n_tokens_neox': 861, 'n_words': 146}