summaryrefslogtreecommitdiff
path: root/ft/tests/recovery-test5123.cc
blob: 023fa77e35cbbe9e6e11473fa90b63773e029d5b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/* -*- mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
// vim: ft=cpp:expandtab:ts=8:sw=4:softtabstop=4:
#ident "$Id$"
#ident "Copyright (c) 2010-2013 Tokutek Inc.  All rights reserved."
#ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it."

#include "test.h"

#include "toku_os.h"
#include "checkpoint.h"

#include "test-ft-txns.h"

static void test_5123(void) {
    TOKULOGGER logger;
    CACHETABLE ct;
    test_setup(TOKU_TEST_FILENAME, &logger, &ct);

    int r;
    TXNID_PAIR one = {.parent_id64 = (TXNID)1, TXNID_NONE};
    TXNID_PAIR two = {.parent_id64 = (TXNID)2, TXNID_NONE};
    TXNID_PAIR three = {.parent_id64 = (TXNID)3, TXNID_NONE};

    toku_log_xbegin(logger, NULL, false, one, TXNID_PAIR_NONE);
    toku_log_xbegin(logger, NULL, false, three, TXNID_PAIR_NONE);
    toku_log_xbegin(logger, NULL, false, two, TXNID_PAIR_NONE);

    toku_log_xcommit(logger, NULL, false, NULL, two);

    toku_logger_close_rollback(logger);

    toku_cachetable_close(&ct);
    // "Crash"
    r = toku_logger_close(&logger);
    CKERR(r);
    ct = NULL;
    logger = NULL;

    // "Recover"
    test_setup_and_recover(TOKU_TEST_FILENAME, &logger, &ct);

    shutdown_after_recovery(&logger, &ct);
}

int test_main (int argc, const char *argv[]) {
    default_parse_args(argc, argv);
    test_5123();
    return 0;
}