~ubuntu-branches/ubuntu/vivid/mariadb-5.5/vivid-proposed

« back to all changes in this revision

Viewing changes to storage/tokudb/ft-index/src/tests/threaded_stress_test_helpers.h

  • Committer: Package Import Robot
  • Author(s): Otto Kekäläinen
  • Date: 2014-11-14 21:04:24 UTC
  • mfrom: (1.1.6)
  • Revision ID: package-import@ubuntu.com-20141114210424-xlyna0ozl11647o5
Tags: 5.5.40-0ubuntu0.14.10.1
* SECURITY UPDATE: Update to 5.5.40 to fix security issues (LP: #1391676)
  - CVE-2014-6507
  - CVE-2014-6491
  - CVE-2014-6500
  - CVE-2014-6469
  - CVE-2014-6555
  - CVE-2014-6559
  - CVE-2014-6494
  - CVE-2014-6496
  - CVE-2014-6464
* Add bsdutils as mariadb-server dependency like upstream does in 5.5.40.

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
 
30
30
COPYRIGHT NOTICE:
31
31
 
32
 
  TokuDB, Tokutek Fractal Tree Indexing Library.
 
32
  TokuFT, Tokutek Fractal Tree Indexing Library.
33
33
  Copyright (C) 2007-2013 Tokutek, Inc.
34
34
 
35
35
DISCLAIMER:
86
86
  under this License.
87
87
*/
88
88
 
 
89
#pragma once
 
90
 
89
91
#ident "Copyright (c) 2009-2013 Tokutek Inc.  All rights reserved."
90
92
#ident "$Id$"
91
93
 
102
104
// with keys in the range [0, table_size - 1] unless disperse_keys is true,
103
105
// then the keys are scrambled up in the integer key space.
104
106
 
105
 
#ifndef _THREADED_STRESS_TEST_HELPERS_H_
106
 
#define _THREADED_STRESS_TEST_HELPERS_H_
107
 
 
108
107
#include "toku_config.h"
109
108
#include "test.h"
110
109
 
123
122
 
124
123
#include <src/ydb-internal.h>
125
124
 
126
 
#include <ft/ybt.h>
 
125
#include <util/dbt.h>
127
126
 
128
127
#include <util/rwlock.h>
129
128
#include <util/kibbutz.h>
209
208
    bool nocrashstatus; // do not print engine status upon crash
210
209
    bool prelock_updates; // update threads perform serial updates on a prelocked range
211
210
    bool disperse_keys; // spread the keys out during a load (by reversing the bits in the loop index) to make a wide tree we can spread out random inserts into
 
211
    bool memcmp_keys; // pack keys big endian and use the builtin key comparison function in the fractal tree
212
212
    bool direct_io; // use direct I/O
213
213
    const char *print_engine_status; // print engine status rows matching a simple regex "a|b|c", matching strings where a or b or c is a subtring.
214
214
};
833
833
    }
834
834
    invariant(key >= 0);
835
835
    if (args->key_size == sizeof(int)) {
836
 
        const int key32 = key;
 
836
        const int key32 = args->memcmp_keys ? toku_htonl(key) : key;
837
837
        memcpy(data, &key32, sizeof(key32));
838
838
    } else {
839
839
        invariant(args->key_size >= sizeof(key));
840
 
        memcpy(data, &key, sizeof(key));
841
 
        memset(data + sizeof(key), 0, args->key_size - sizeof(key));
 
840
        const int64_t key64 = args->memcmp_keys ? toku_htonl(key) : key;
 
841
        memcpy(data, &key64, sizeof(key64));
 
842
        memset(data + sizeof(key64), 0, args->key_size - sizeof(key64));
842
843
    }
843
844
}
844
845
 
1076
1077
    return r;
1077
1078
}
1078
1079
 
 
1080
static int UU() frag_op(DB_TXN *UU(txn), ARG arg, void* UU(operation_extra), void *UU(stats_extra)) {
 
1081
    int db_index = myrandom_r(arg->random_data)%arg->cli->num_DBs;
 
1082
    DB *db = arg->dbp[db_index];
 
1083
 
 
1084
    TOKU_DB_FRAGMENTATION_S frag;
 
1085
    int r = db->get_fragmentation(db, &frag);
 
1086
    invariant_zero(r);
 
1087
    return r;
 
1088
}
 
1089
 
1079
1090
static void UU() get_key_after_bytes_callback(const DBT *UU(end_key), uint64_t UU(skipped), void *UU(extra)) {
1080
1091
    // nothing
1081
1092
}
1966
1977
    db_env_set_num_bucket_mutexes(env_args.num_bucket_mutexes);
1967
1978
    r = db_env_create(&env, 0); assert(r == 0);
1968
1979
    r = env->set_redzone(env, 0); CKERR(r);
1969
 
    r = env->set_default_bt_compare(env, bt_compare); CKERR(r);
 
1980
    if (!cli_args->memcmp_keys) {
 
1981
        r = env->set_default_bt_compare(env, bt_compare); CKERR(r);
 
1982
    }
1970
1983
    r = env->set_lk_max_memory(env, env_args.lk_max_memory); CKERR(r);
1971
1984
    r = env->set_cachesize(env, env_args.cachetable_size / (1 << 30), env_args.cachetable_size % (1 << 30), 1); CKERR(r);
1972
1985
    r = env->set_lg_bsize(env, env_args.rollback_node_size); CKERR(r);
2164
2177
    db_env_set_num_bucket_mutexes(env_args.num_bucket_mutexes);
2165
2178
    r = db_env_create(&env, 0); assert(r == 0);
2166
2179
    r = env->set_redzone(env, 0); CKERR(r);
2167
 
    r = env->set_default_bt_compare(env, bt_compare); CKERR(r);
 
2180
    if (!cli_args->memcmp_keys) {
 
2181
        r = env->set_default_bt_compare(env, bt_compare); CKERR(r);
 
2182
    }
2168
2183
    r = env->set_lk_max_memory(env, env_args.lk_max_memory); CKERR(r);
2169
2184
    env->set_update(env, env_args.update_function);
2170
2185
    r = env->set_cachesize(env, env_args.cachetable_size / (1 << 30), env_args.cachetable_size % (1 << 30), 1); CKERR(r);
2282
2297
        .nocrashstatus = false,
2283
2298
        .prelock_updates = false,
2284
2299
        .disperse_keys = false,
 
2300
        .memcmp_keys = false,
2285
2301
        .direct_io = false,
2286
2302
        };
2287
2303
    DEFAULT_ARGS.env_args.envdir = TOKU_TEST_FILENAME;
2669
2685
        BOOL_ARG("nocrashstatus",                     nocrashstatus),
2670
2686
        BOOL_ARG("prelock_updates",                   prelock_updates),
2671
2687
        BOOL_ARG("disperse_keys",                     disperse_keys),
 
2688
        BOOL_ARG("memcmp_keys",                       memcmp_keys),
2672
2689
        BOOL_ARG("direct_io",                         direct_io),
2673
2690
 
2674
2691
        STRING_ARG("--envdir",                        env_args.envdir),
2924
2941
    // We want to control the row size and its compressibility.
2925
2942
    open_and_stress_tables(args, false, cmp);
2926
2943
}
2927
 
 
2928
 
#endif