<commit_before>// Copyright 2010-2013 RethinkDB, all rights reserved.
#include "errors.hpp"
#include "btree/slice.hpp"
#include "btree/node.hpp"
#include "btree/operations.hpp"
#include "buffer_cache/buffer_cache.hpp"
#include "concurrency/cond_var.hpp"

// Run backfilling at a reduced priority
#define BACKFILL_CACHE_PRIORITY 10

void btree_slice_t::create(cache_t *cache, const std::vector<char> &metainfo_key, const std::vector<char> &metainfo_value) {

    // SAMRSI: Should we wait on this signal?  Pass it in as a parameter?
    sync_callback_t disk_ack_signal;

    /* Initialize the btree superblock and the delete queue */
    transaction_t txn(cache, rwi_write, 1, repli_timestamp_t::distant_past, order_token_t::ignore, &disk_ack_signal);

    buf_lock_t superblock(&txn, SUPERBLOCK_ID, rwi_write);

    // Initialize replication time barrier to 0 so that if we are a slave, we will begin by pulling
    // ALL updates from master.
    superblock.touch_recency(repli_timestamp_t::distant_past);

    btree_superblock_t *sb = reinterpret_cast<btree_superblock_t *>(superblock.get_data_write());
    bzero(sb, cache->get_block_size().value());

    // sb->metainfo_blob has been properly zeroed.

    sb->magic = btree_superblock_t::expected_magic;
    sb->root_block = NULL_BLOCK_ID;
    sb->stat_block = NULL_BLOCK_ID;

    set_superblock_metainfo(&txn, &superblock, metainfo_key, metainfo_value);
}

btree_slice_t::btree_slice_t(cache_t *c, perfmon_collection_t *parent)
    : stats(parent),
      cache_(c),
      root_eviction_priority(INITIAL_ROOT_EVICTION_PRIORITY) {
    cache()->create_cache_account(BACKFILL_CACHE_PRIORITY, &backfill_account);

    pre_begin_txn_checkpoint_.set_tagappend("pre_begin_txn");
}

btree_slice_t::~btree_slice_t() { }<commit_msg>Made btree_slice_t::create wait for its disk_ack_signal.<commit_after>// Copyright 2010-2013 RethinkDB, all rights reserved.
#include "errors.hpp"
#include "btree/slice.hpp"
#include "btree/node.hpp"
#include "btree/operations.hpp"
#include "buffer_cache/buffer_cache.hpp"
#include "concurrency/cond_var.hpp"

// Run backfilling at a reduced priority
#define BACKFILL_CACHE_PRIORITY 10

void btree_slice_t::create(cache_t *cache, const std::vector<char> &metainfo_key, const std::vector<char> &metainfo_value) {
    sync_callback_t disk_ack_signal;
    {
        /* Initialize the btree superblock and the delete queue */
        transaction_t txn(cache, rwi_write, 1, repli_timestamp_t::distant_past, order_token_t::ignore, &disk_ack_signal);

        buf_lock_t superblock(&txn, SUPERBLOCK_ID, rwi_write);

        // Initialize replication time barrier to 0 so that if we are a slave, we will begin by pulling
        // ALL updates from master.
        superblock.touch_recency(repli_timestamp_t::distant_past);

        btree_superblock_t *sb = reinterpret_cast<btree_superblock_t *>(superblock.get_data_write());
        bzero(sb, cache->get_block_size().value());

        // sb->metainfo_blob has been properly zeroed.
        sb->magic = btree_superblock_t::expected_magic;
        sb->root_block = NULL_BLOCK_ID;
        sb->stat_block = NULL_BLOCK_ID;

        set_superblock_metainfo(&txn, &superblock, metainfo_key, metainfo_value);
    }
    disk_ack_signal.wait();
}

btree_slice_t::btree_slice_t(cache_t *c, perfmon_collection_t *parent)
    : stats(parent),
      cache_(c),
      root_eviction_priority(INITIAL_ROOT_EVICTION_PRIORITY) {
    cache()->create_cache_account(BACKFILL_CACHE_PRIORITY, &backfill_account);

    pre_begin_txn_checkpoint_.set_tagappend("pre_begin_txn");
}

btree_slice_t::~btree_slice_t() { }
{'fraction_non_alphanumeric': 0.10575858250276855, 'fraction_numerical': 0.006644518272425249, 'mean_word_length': 4.913256955810147, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 21, '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': '1259668', 'n_tokens_mistral': 1292, 'n_tokens_neox': 1238, 'n_words': 245}