mirror of
https://github.com/MariaDB/server.git
synced 2025-01-21 22:34:18 +01:00
close[t:4273] Fix #4273. {{{svn merge -r 37842:37875 ../tokudb.4273}}}.
git-svn-id: file:///svn/toku/tokudb@37891 c7de825b-a66e-492c-adef-691d508d4ae1
This commit is contained in:
parent
1ead590aec
commit
6cc79aee9d
26 changed files with 179 additions and 101 deletions
|
@ -594,8 +594,6 @@ struct __toku_db_txn {
|
|||
void* __toku_dummy3[1];
|
||||
u_int32_t (*id) (DB_TXN *); /* 32-bit offset=88 size=4, 64=bit offset=152 size=8 */
|
||||
void* __toku_dummy4[3]; /* Padding at the end */
|
||||
char iic[0] __attribute__((aligned(__BIGGEST_ALIGNMENT__)));
|
||||
#define db_txn_struct_i(x) ((struct __toku_db_txn_internal *)(&(x)->iic))
|
||||
};
|
||||
struct __toku_db_txn_stat {
|
||||
void* __toku_dummy0[1];
|
||||
|
@ -626,8 +624,6 @@ struct __toku_dbc {
|
|||
void* __toku_dummy2[1];
|
||||
int (*c_get) (DBC *, DBT *, DBT *, u_int32_t); /* 32-bit offset=204 size=4, 64=bit offset=304 size=8 */
|
||||
void* __toku_dummy3[11]; /* Padding at the end */
|
||||
char iic[0] __attribute__((aligned(__BIGGEST_ALIGNMENT__)));
|
||||
#define dbc_struct_i(x) ((struct __toku_dbc_internal *)(&(x)->iic))
|
||||
};
|
||||
#ifdef _TOKUDB_WRAP_H
|
||||
#define txn_begin txn_begin_tokudb
|
||||
|
|
|
@ -609,8 +609,6 @@ struct __toku_db_txn {
|
|||
void* __toku_dummy3[1];
|
||||
u_int32_t (*id) (DB_TXN *); /* 32-bit offset=112 size=4, 64=bit offset=200 size=8 */
|
||||
void* __toku_dummy4[4]; /* Padding at the end */
|
||||
char iic[0] __attribute__((aligned(__BIGGEST_ALIGNMENT__)));
|
||||
#define db_txn_struct_i(x) ((struct __toku_db_txn_internal *)(&(x)->iic))
|
||||
};
|
||||
struct __toku_db_txn_stat {
|
||||
void* __toku_dummy0[1];
|
||||
|
@ -641,8 +639,6 @@ struct __toku_dbc {
|
|||
void* __toku_dummy2[1];
|
||||
int (*c_get) (DBC *, DBT *, DBT *, u_int32_t); /* 32-bit offset=204 size=4, 64=bit offset=296 size=8 */
|
||||
void* __toku_dummy3[10]; /* Padding at the end */
|
||||
char iic[0] __attribute__((aligned(__BIGGEST_ALIGNMENT__)));
|
||||
#define dbc_struct_i(x) ((struct __toku_dbc_internal *)(&(x)->iic))
|
||||
};
|
||||
#ifdef _TOKUDB_WRAP_H
|
||||
#define txn_begin txn_begin_tokudb
|
||||
|
|
|
@ -615,8 +615,6 @@ struct __toku_db_txn {
|
|||
void* __toku_dummy3[2];
|
||||
u_int32_t (*id) (DB_TXN *); /* 32-bit offset=112 size=4, 64=bit offset=216 size=8 */
|
||||
void* __toku_dummy4[5]; /* Padding at the end */
|
||||
char iic[0] __attribute__((aligned(__BIGGEST_ALIGNMENT__)));
|
||||
#define db_txn_struct_i(x) ((struct __toku_db_txn_internal *)(&(x)->iic))
|
||||
};
|
||||
struct __toku_db_txn_stat {
|
||||
void* __toku_dummy0[1];
|
||||
|
@ -647,8 +645,6 @@ struct __toku_dbc {
|
|||
void* __toku_dummy2[1];
|
||||
int (*c_get) (DBC *, DBT *, DBT *, u_int32_t); /* 32-bit offset=204 size=4, 64=bit offset=304 size=8 */
|
||||
void* __toku_dummy3[10]; /* Padding at the end */
|
||||
char iic[0] __attribute__((aligned(__BIGGEST_ALIGNMENT__)));
|
||||
#define dbc_struct_i(x) ((struct __toku_dbc_internal *)(&(x)->iic))
|
||||
};
|
||||
#ifdef _TOKUDB_WRAP_H
|
||||
#define txn_begin txn_begin_tokudb
|
||||
|
|
|
@ -615,8 +615,6 @@ struct __toku_db_txn {
|
|||
void* __toku_dummy3[2];
|
||||
u_int32_t (*id) (DB_TXN *); /* 32-bit offset=112 size=4, 64=bit offset=216 size=8 */
|
||||
void* __toku_dummy4[5]; /* Padding at the end */
|
||||
char iic[0] __attribute__((aligned(__BIGGEST_ALIGNMENT__)));
|
||||
#define db_txn_struct_i(x) ((struct __toku_db_txn_internal *)(&(x)->iic))
|
||||
};
|
||||
struct __toku_db_txn_stat {
|
||||
void* __toku_dummy0[1];
|
||||
|
@ -647,8 +645,6 @@ struct __toku_dbc {
|
|||
void* __toku_dummy2[1];
|
||||
int (*c_get) (DBC *, DBT *, DBT *, u_int32_t); /* 32-bit offset=220 size=4, 64=bit offset=336 size=8 */
|
||||
void* __toku_dummy3[10]; /* Padding at the end */
|
||||
char iic[0] __attribute__((aligned(__BIGGEST_ALIGNMENT__)));
|
||||
#define dbc_struct_i(x) ((struct __toku_dbc_internal *)(&(x)->iic))
|
||||
};
|
||||
#ifdef _TOKUDB_WRAP_H
|
||||
#define txn_begin txn_begin_tokudb
|
||||
|
|
|
@ -618,8 +618,6 @@ struct __toku_db_txn {
|
|||
void* __toku_dummy3[2];
|
||||
u_int32_t (*id) (DB_TXN *); /* 32-bit offset=116 size=4, 64=bit offset=224 size=8 */
|
||||
void* __toku_dummy4[5]; /* Padding at the end */
|
||||
char iic[0] __attribute__((aligned(__BIGGEST_ALIGNMENT__)));
|
||||
#define db_txn_struct_i(x) ((struct __toku_db_txn_internal *)(&(x)->iic))
|
||||
};
|
||||
struct __toku_db_txn_stat {
|
||||
void* __toku_dummy0[2];
|
||||
|
@ -651,8 +649,6 @@ struct __toku_dbc {
|
|||
void* __toku_dummy2[1];
|
||||
int (*c_get) (DBC *, DBT *, DBT *, u_int32_t); /* 32-bit offset=260 size=4, 64=bit offset=416 size=8 */
|
||||
void* __toku_dummy3[10]; /* Padding at the end */
|
||||
char iic[0] __attribute__((aligned(__BIGGEST_ALIGNMENT__)));
|
||||
#define dbc_struct_i(x) ((struct __toku_dbc_internal *)(&(x)->iic))
|
||||
};
|
||||
#ifdef _TOKUDB_WRAP_H
|
||||
#define txn_begin txn_begin_tokudb
|
||||
|
|
|
@ -362,8 +362,6 @@ static void print_struct (const char *structname, enum need_internal_type need_i
|
|||
assert(diff64<8); /* there could be a few left from alignment. */
|
||||
}
|
||||
if (need_internal==INTERNAL_AT_END) {
|
||||
printf(" char iic[0] __attribute__((aligned(__BIGGEST_ALIGNMENT__)));\n");
|
||||
printf("#define %s_struct_i(x) ((struct __toku_%s_internal *)(&(x)->iic))\n", structname, structname);
|
||||
did_toku_internal = 1;
|
||||
}
|
||||
printf("};\n");
|
||||
|
|
|
@ -562,8 +562,6 @@ struct __toku_db_txn {
|
|||
int (*abort) (DB_TXN *);
|
||||
int (*commit) (DB_TXN*, u_int32_t);
|
||||
u_int32_t (*id) (DB_TXN *);
|
||||
char iic[0] __attribute__((aligned(__BIGGEST_ALIGNMENT__)));
|
||||
#define db_txn_struct_i(x) ((struct __toku_db_txn_internal *)(&(x)->iic))
|
||||
};
|
||||
struct __toku_db_txn_stat {
|
||||
u_int32_t st_nactive;
|
||||
|
@ -585,8 +583,6 @@ struct __toku_dbc {
|
|||
int (*c_count) (DBC *, db_recno_t *, u_int32_t);
|
||||
int (*c_del) (DBC *, u_int32_t);
|
||||
int (*c_get) (DBC *, DBT *, DBT *, u_int32_t);
|
||||
char iic[0] __attribute__((aligned(__BIGGEST_ALIGNMENT__)));
|
||||
#define dbc_struct_i(x) ((struct __toku_dbc_internal *)(&(x)->iic))
|
||||
};
|
||||
#ifdef _TOKUDB_WRAP_H
|
||||
#define txn_begin txn_begin_tokudb
|
||||
|
|
|
@ -22,10 +22,8 @@ void test_db(void) {
|
|||
env.open(DIR, DB_CREATE|DB_PRIVATE, 0666);
|
||||
Db db(&env, 0);
|
||||
|
||||
int r;
|
||||
|
||||
try {
|
||||
r = db.remove("DoesNotExist.db", NULL, 0);
|
||||
db.remove("DoesNotExist.db", NULL, 0);
|
||||
abort(); // must not make it here.
|
||||
} catch (DbException e) {
|
||||
assert(e.get_errno() == ENOENT);
|
||||
|
|
|
@ -30,7 +30,7 @@ endif
|
|||
|
||||
ifdef BDBDIR
|
||||
BDB_CPPFLAGS = -I$(BDBDIR)/include -DHAVE_CXX_STDHEADERS
|
||||
BDB_LDFLAGS = -L$(BDBDIR)/lib -ldb_cxx -Wl,-rpath,$(BDBDIR)/lib
|
||||
BDB_LDFLAGS = -L$(BDBDIR)/lib -ldb_cxx -Wl,-rpath,$(BDBDIR)/lib -ldl
|
||||
else
|
||||
BDB_CPPFLAGS =
|
||||
BDB_LDFLAGS = -ldb_cxx
|
||||
|
|
|
@ -562,8 +562,6 @@ struct __toku_db_txn {
|
|||
int (*abort) (DB_TXN *);
|
||||
int (*commit) (DB_TXN*, u_int32_t);
|
||||
u_int32_t (*id) (DB_TXN *);
|
||||
char iic[0] __attribute__((aligned(__BIGGEST_ALIGNMENT__)));
|
||||
#define db_txn_struct_i(x) ((struct __toku_db_txn_internal *)(&(x)->iic))
|
||||
};
|
||||
struct __toku_db_txn_stat {
|
||||
u_int32_t st_nactive;
|
||||
|
@ -585,8 +583,6 @@ struct __toku_dbc {
|
|||
int (*c_count) (DBC *, db_recno_t *, u_int32_t);
|
||||
int (*c_del) (DBC *, u_int32_t);
|
||||
int (*c_get) (DBC *, DBT *, DBT *, u_int32_t);
|
||||
char iic[0] __attribute__((aligned(__BIGGEST_ALIGNMENT__)));
|
||||
#define dbc_struct_i(x) ((struct __toku_dbc_internal *)(&(x)->iic))
|
||||
};
|
||||
#ifdef _TOKUDB_WRAP_H
|
||||
#define txn_begin txn_begin_tokudb
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
../windows/toku_assert.c
|
118
linux/toku_assert.c
Normal file
118
linux/toku_assert.c
Normal file
|
@ -0,0 +1,118 @@
|
|||
/* -*- mode: C; c-basic-offset: 4 -*- */
|
||||
#ident "Copyright (c) 2007-2010 Tokutek Inc. All rights reserved."
|
||||
|
||||
#include <toku_portability.h>
|
||||
#include "toku_assert.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <malloc.h>
|
||||
#if !TOKU_WINDOWS
|
||||
#include <execinfo.h>
|
||||
#endif
|
||||
|
||||
|
||||
#if !TOKU_WINDOWS
|
||||
#define N_POINTERS 1000
|
||||
// These are statically allocated so that the backtrace can run without any calls to malloc()
|
||||
static void *backtrace_pointers[N_POINTERS];
|
||||
#endif
|
||||
|
||||
// Function pointers are zero by default so asserts can be used by brt-layer tests without an environment.
|
||||
static int (*toku_maybe_get_engine_status_text_p)(char* buff, int buffsize) = 0;
|
||||
static void (*toku_maybe_set_env_panic_p)(int code, char* msg) = 0;
|
||||
|
||||
void toku_assert_set_fpointers(int (*toku_maybe_get_engine_status_text_pointer)(char*, int),
|
||||
void (*toku_maybe_set_env_panic_pointer)(int, char*)) {
|
||||
toku_maybe_get_engine_status_text_p = toku_maybe_get_engine_status_text_pointer;
|
||||
toku_maybe_set_env_panic_p = toku_maybe_set_env_panic_pointer;
|
||||
}
|
||||
|
||||
void (*do_assert_hook)(void) = NULL;
|
||||
|
||||
static void toku_do_backtrace_abort(void) __attribute__((noreturn));
|
||||
|
||||
static void
|
||||
toku_do_backtrace_abort(void) {
|
||||
|
||||
// backtrace
|
||||
#if !TOKU_WINDOWS
|
||||
int n = backtrace(backtrace_pointers, N_POINTERS);
|
||||
fprintf(stderr, "Backtrace: (Note: toku_do_assert=0x%p)\n", toku_do_assert); fflush(stderr);
|
||||
backtrace_symbols_fd(backtrace_pointers, n, fileno(stderr));
|
||||
#endif
|
||||
|
||||
fflush(stderr);
|
||||
|
||||
if (toku_maybe_get_engine_status_text_p) {
|
||||
int buffsize = 1024 * 32;
|
||||
char buff[buffsize];
|
||||
|
||||
toku_maybe_get_engine_status_text_p(buff, buffsize);
|
||||
fprintf(stderr, "Engine status:\n%s\n", buff);
|
||||
}
|
||||
else
|
||||
fprintf(stderr, "Engine status function not available\n");
|
||||
fprintf(stderr, "Memory usage:\n");
|
||||
fflush(stderr); // just in case malloc_stats() crashes, we still want engine status (and to know that malloc_stats() failed)
|
||||
malloc_stats();
|
||||
fflush(stderr);
|
||||
|
||||
|
||||
#if TOKU_WINDOWS
|
||||
//Following commented methods will not always end the process (could hang).
|
||||
//They could be unacceptable for other reasons as well (popups,
|
||||
//flush buffers before quitting, etc)
|
||||
// abort()
|
||||
// assert(FALSE) (assert.h assert)
|
||||
// raise(SIGABRT)
|
||||
// divide by 0
|
||||
// null dereference
|
||||
// _exit
|
||||
// exit
|
||||
// ExitProcess
|
||||
TerminateProcess(GetCurrentProcess(), 134); //Only way found so far to unconditionally
|
||||
//Terminate the process
|
||||
#endif
|
||||
|
||||
if (do_assert_hook) do_assert_hook();
|
||||
|
||||
abort();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
set_panic_if_not_panicked(int caller_errno, char * msg) {
|
||||
int code = caller_errno ? caller_errno : -1;
|
||||
if (toku_maybe_set_env_panic_p) {
|
||||
toku_maybe_set_env_panic_p(code, msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#define MSGLEN 1024
|
||||
|
||||
void
|
||||
toku_do_assert_fail (const char *expr_as_string, const char *function, const char *file, int line, int caller_errno) {
|
||||
char msg[MSGLEN];
|
||||
snprintf(msg, MSGLEN, "%s:%d %s: Assertion `%s' failed (errno=%d)\n", file, line, function, expr_as_string, caller_errno);
|
||||
perror(msg);
|
||||
set_panic_if_not_panicked(caller_errno, msg);
|
||||
toku_do_backtrace_abort();
|
||||
}
|
||||
|
||||
void
|
||||
toku_do_assert_zero_fail (uintptr_t expr, const char *expr_as_string, const char *function, const char *file, int line, int caller_errno) {
|
||||
char msg[MSGLEN];
|
||||
snprintf(msg, MSGLEN, "%s:%d %s: Assertion `%s == 0' failed (errno=%d) (%s=%"PRIuPTR")\n", file, line, function, expr_as_string, caller_errno, expr_as_string, expr);
|
||||
perror(msg);
|
||||
set_panic_if_not_panicked(caller_errno, msg);
|
||||
toku_do_backtrace_abort();
|
||||
}
|
||||
|
||||
void
|
||||
toku_do_assert(int expr, const char *expr_as_string, const char *function, const char* file, int line, int caller_errno) {
|
||||
if (expr == 0)
|
||||
toku_do_assert_fail(expr_as_string, function, file, line, caller_errno);
|
||||
}
|
||||
|
|
@ -2005,8 +2005,7 @@ static void
|
|||
deserialize_descriptor_from_rbuf(struct rbuf *rb, DESCRIPTOR desc, int layout_version) {
|
||||
if (layout_version == BRT_LAYOUT_VERSION_13) {
|
||||
// in older versions of TokuDB the Descriptor had a 4 byte version, which we must skip over
|
||||
u_int32_t dummy_version;
|
||||
dummy_version = rbuf_int(rb);
|
||||
u_int32_t dummy_version __attribute__((__unused__)) = rbuf_int(rb);
|
||||
}
|
||||
u_int32_t size;
|
||||
bytevec data;
|
||||
|
@ -2264,7 +2263,6 @@ deserialize_brtheader_from_fd_into_rbuf(int fd, toku_off_t offset_of_header, str
|
|||
}
|
||||
}
|
||||
u_int32_t version = 0;
|
||||
u_int32_t build_id = 0;
|
||||
if (r==0) {
|
||||
//Version MUST be in network order regardless of disk order.
|
||||
version = rbuf_network_int(rb);
|
||||
|
@ -2272,7 +2270,7 @@ deserialize_brtheader_from_fd_into_rbuf(int fd, toku_off_t offset_of_header, str
|
|||
if (version < BRT_LAYOUT_MIN_SUPPORTED_VERSION) r = TOKUDB_DICTIONARY_TOO_OLD; //Cannot use
|
||||
if (version > BRT_LAYOUT_VERSION) r = TOKUDB_DICTIONARY_TOO_NEW; //Cannot use
|
||||
//build_id MUST be in network order regardless of disk order.
|
||||
build_id = rbuf_network_int(rb);
|
||||
u_int32_t build_id __attribute__((__unused__)) = rbuf_network_int(rb);
|
||||
}
|
||||
u_int32_t size;
|
||||
if (r==0) {
|
||||
|
|
13
newbrt/brt.c
13
newbrt/brt.c
|
@ -4435,7 +4435,6 @@ maybe_apply_ancestors_messages_to_node (BRT t, BRTNODE node, ANCESTORS ancestors
|
|||
// If workdone for any nonleaf nodes exceeds threshold then flush them, but don't do any merges or splits.
|
||||
{
|
||||
VERIFY_NODE(t, node);
|
||||
BOOL update_stats = FALSE;
|
||||
if (node->height > 0) { goto exit; }
|
||||
// know we are a leaf node
|
||||
// need to apply messages to each basement node
|
||||
|
@ -4459,22 +4458,10 @@ maybe_apply_ancestors_messages_to_node (BRT t, BRTNODE node, ANCESTORS ancestors
|
|||
// we don't want to check this node again if the next time
|
||||
// we query it, the msn hasn't changed.
|
||||
curr_bn->max_msn_applied = curr_ancestors->node->max_msn_applied_to_node_on_disk;
|
||||
update_stats = TRUE;
|
||||
}
|
||||
}
|
||||
curr_bn->stale_ancestor_messages_applied = true;
|
||||
}
|
||||
// Must update the leaf estimates. Might as well use the estimates from the soft copy (even if they make it out to disk), since they are
|
||||
// the best estimates we have.
|
||||
if (update_stats) {
|
||||
ANCESTORS curr_ancestors = ancestors;
|
||||
BRTNODE prev_node = node;
|
||||
while (curr_ancestors) {
|
||||
BRTNODE next_node = curr_ancestors->node;
|
||||
prev_node = next_node;
|
||||
curr_ancestors = curr_ancestors->next;
|
||||
}
|
||||
}
|
||||
exit:
|
||||
VERIFY_NODE(t, node);
|
||||
}
|
||||
|
|
|
@ -60,6 +60,7 @@ typedef struct pair_attr_s {
|
|||
} PAIR_ATTR;
|
||||
|
||||
static inline PAIR_ATTR make_pair_attr(long size) {
|
||||
#if !defined(__cplusplus)
|
||||
PAIR_ATTR result={
|
||||
.size = size,
|
||||
.nonleaf_size = 0,
|
||||
|
@ -67,6 +68,9 @@ static inline PAIR_ATTR make_pair_attr(long size) {
|
|||
.rollback_size = 0,
|
||||
.cache_pressure_size = 0
|
||||
};
|
||||
#else
|
||||
PAIR_ATTR result = {size, 0, 0, 0, 0};
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -297,7 +297,7 @@ static int
|
|||
toku_apply_rollinclude (TXNID xid,
|
||||
uint64_t num_nodes,
|
||||
BLOCKNUM spilled_head,
|
||||
uint32_t spilled_head_hash,
|
||||
uint32_t spilled_head_hash __attribute__((__unused__)),
|
||||
BLOCKNUM spilled_tail,
|
||||
uint32_t spilled_tail_hash,
|
||||
TOKUTXN txn,
|
||||
|
|
|
@ -135,7 +135,6 @@ static int search_cmp(struct brt_search* UU(so), DBT* UU(key)) {
|
|||
|
||||
static void
|
||||
test2(int fd, struct brt_header *brt_h, BRTNODE *dn) {
|
||||
int r;
|
||||
struct brtnode_fetch_extra bfe_subset;
|
||||
DBT left, right;
|
||||
DB dummy_db;
|
||||
|
@ -162,7 +161,8 @@ test2(int fd, struct brt_header *brt_h, BRTNODE *dn) {
|
|||
FALSE
|
||||
);
|
||||
|
||||
r = toku_deserialize_brtnode_from(fd, make_blocknum(20), 0/*pass zero for hash*/, dn, &bfe_subset);
|
||||
int r = toku_deserialize_brtnode_from(fd, make_blocknum(20), 0/*pass zero for hash*/, dn, &bfe_subset);
|
||||
assert(r==0);
|
||||
BOOL is_leaf = ((*dn)->height == 0);
|
||||
// at this point, although both partitions are available, only the
|
||||
// second basement node should have had its clock
|
||||
|
@ -194,7 +194,6 @@ test2(int fd, struct brt_header *brt_h, BRTNODE *dn) {
|
|||
|
||||
static void
|
||||
test3_leaf(int fd, struct brt_header *brt_h, BRTNODE *dn) {
|
||||
int r;
|
||||
struct brtnode_fetch_extra bfe_min;
|
||||
DBT left, right;
|
||||
DB dummy_db;
|
||||
|
@ -208,7 +207,8 @@ test3_leaf(int fd, struct brt_header *brt_h, BRTNODE *dn) {
|
|||
brt_h
|
||||
);
|
||||
|
||||
r = toku_deserialize_brtnode_from(fd, make_blocknum(20), 0/*pass zero for hash*/, dn, &bfe_min);
|
||||
int r = toku_deserialize_brtnode_from(fd, make_blocknum(20), 0/*pass zero for hash*/, dn, &bfe_min);
|
||||
assert(r==0);
|
||||
//
|
||||
// make sure we have a leaf
|
||||
//
|
||||
|
|
|
@ -13,7 +13,6 @@ static void test1 (size_t chars_per_file, size_t bytes_per_read) {
|
|||
int fds[N];
|
||||
char fnames[N][100];
|
||||
size_t n_read[N];
|
||||
int still_live[N];
|
||||
int n_live=N;
|
||||
for (int i=0; i<N; i++) {
|
||||
snprintf(fnames[i], 100, "dbufio-test-destroy-file%d.data", i);
|
||||
|
@ -22,7 +21,6 @@ static void test1 (size_t chars_per_file, size_t bytes_per_read) {
|
|||
//printf("fds[%d]=%d is %s\n", i, fds[i], fnames[i]);
|
||||
assert(fds[i]>=0);
|
||||
n_read[i]=0;
|
||||
still_live[i]=i;
|
||||
for (size_t j=0; j<chars_per_file; j++) {
|
||||
unsigned char c = (i+j)%256;
|
||||
int r = toku_os_write(fds[i], &c, 1);
|
||||
|
|
|
@ -100,17 +100,20 @@ insert_random_message_to_leaf(BRT t, BASEMENTNODE blb, LEAFENTRY *save, XIDS xid
|
|||
{
|
||||
int keylen = (random() % 16) + 16;
|
||||
int vallen = (random() % 1024) + 16;
|
||||
char key[keylen+(sizeof pfx)];
|
||||
struct of_pair {
|
||||
int32_t pfx;
|
||||
char key[keylen];
|
||||
} keyp;
|
||||
char val[vallen];
|
||||
*(int *) key = pfx;
|
||||
rand_bytes_limited((char *) key + (sizeof pfx), keylen);
|
||||
keyp.pfx = pfx;
|
||||
rand_bytes_limited(&keyp.key, keylen);
|
||||
rand_bytes(val, vallen);
|
||||
MSN msn = next_dummymsn();
|
||||
|
||||
DBT keydbt_s, *keydbt, valdbt_s, *valdbt;
|
||||
keydbt = &keydbt_s;
|
||||
valdbt = &valdbt_s;
|
||||
toku_fill_dbt(keydbt, key, keylen + (sizeof pfx));
|
||||
toku_fill_dbt(keydbt, &keyp, keylen + (sizeof pfx));
|
||||
toku_fill_dbt(valdbt, val, vallen);
|
||||
BRT_MSG_S msg;
|
||||
msg.type = BRT_INSERT;
|
||||
|
@ -138,17 +141,20 @@ insert_same_message_to_leaves(BRT t, BASEMENTNODE blb1, BASEMENTNODE blb2, LEAFE
|
|||
{
|
||||
int keylen = (random() % 16) + 16;
|
||||
int vallen = (random() % 1024) + 16;
|
||||
char key[keylen+(sizeof pfx)];
|
||||
struct of_pair {
|
||||
int32_t pfx;
|
||||
char key[keylen];
|
||||
} keyp;
|
||||
char val[vallen];
|
||||
*(int *) key = pfx;
|
||||
rand_bytes_limited((char *) key + (sizeof pfx), keylen);
|
||||
keyp.pfx = pfx;
|
||||
rand_bytes_limited(&keyp.key, keylen);
|
||||
rand_bytes(val, vallen);
|
||||
MSN msn = next_dummymsn();
|
||||
|
||||
DBT keydbt_s, *keydbt, valdbt_s, *valdbt;
|
||||
keydbt = &keydbt_s;
|
||||
valdbt = &valdbt_s;
|
||||
toku_fill_dbt(keydbt, key, keylen + (sizeof pfx));
|
||||
toku_fill_dbt(keydbt, &keyp, keylen + (sizeof pfx));
|
||||
toku_fill_dbt(valdbt, val, vallen);
|
||||
BRT_MSG_S msg;
|
||||
msg.type = BRT_INSERT;
|
||||
|
|
|
@ -223,7 +223,7 @@ static int uint_cmp(const void *ap, const void *bp) {
|
|||
|
||||
static void check_results(DB **dbs) {
|
||||
for(int j=0;j<NUM_DBS;j++) {
|
||||
unsigned int prev_k = 0, prev_v = 0;
|
||||
unsigned int prev_k = 0;
|
||||
|
||||
DBT key, val;
|
||||
unsigned int k=0, v=0;
|
||||
|
@ -271,7 +271,7 @@ static void check_results(DB **dbs) {
|
|||
assert(prev_k < k);
|
||||
|
||||
// update prev = current
|
||||
prev_k = k; prev_v = v;
|
||||
prev_k = k;
|
||||
}
|
||||
|
||||
toku_free(expected_key);
|
||||
|
|
|
@ -239,7 +239,7 @@ static void check_results(DB **dbs) {
|
|||
|
||||
// verify rows
|
||||
for (int j = 0;j < NUM_DBS; j++) {
|
||||
unsigned int prev_k = 0, prev_v = 0;
|
||||
unsigned int prev_k = 0;
|
||||
|
||||
DBT key, val;
|
||||
unsigned int k=0, v=0;
|
||||
|
@ -287,7 +287,7 @@ static void check_results(DB **dbs) {
|
|||
assert(prev_k < k);
|
||||
|
||||
// update prev = current
|
||||
prev_k = k; prev_v = v;
|
||||
prev_k = k;
|
||||
}
|
||||
|
||||
toku_free(expected_key);
|
||||
|
|
|
@ -128,14 +128,6 @@ static void preload_dbs(DB **dbs)
|
|||
{
|
||||
gettimeofday(&starttime, NULL);
|
||||
uint row;
|
||||
uint32_t db_flags[MAX_DBS];
|
||||
uint32_t dbt_flags[MAX_DBS];
|
||||
uint32_t flags = DB_NOOVERWRITE;
|
||||
flags = 0;
|
||||
for(int i=0;i<MAX_DBS;i++) {
|
||||
db_flags[i] = flags;
|
||||
dbt_flags[i] = 0;
|
||||
}
|
||||
|
||||
if ( verbose ) { printf("loading");fflush(stdout); }
|
||||
|
||||
|
|
|
@ -37,15 +37,6 @@ static void preload_dbs(DB **dbs)
|
|||
gettimeofday(&starttime, NULL);
|
||||
int r;
|
||||
DB_TXN *txn;
|
||||
uint32_t db_flags[MAX_DBS];
|
||||
uint32_t dbt_flags[MAX_DBS];
|
||||
uint32_t flags = DB_NOOVERWRITE;
|
||||
flags = 0;
|
||||
for(int i=0;i<MAX_DBS;i++) {
|
||||
db_flags[i] = flags;
|
||||
dbt_flags[i] = 0;
|
||||
}
|
||||
|
||||
|
||||
DBT skey, sval;
|
||||
DBT key, val;
|
||||
|
|
|
@ -226,14 +226,14 @@ static int do_random_fileop(int i, int state) {
|
|||
|
||||
static void do_random_fileops(void)
|
||||
{
|
||||
int r, i, state, next_state;
|
||||
int i, state, next_state;
|
||||
DB_TXN *txn;
|
||||
for (i=0;i<NUM_DICTIONARIES;i++) {
|
||||
r = env->txn_begin(env, NULL, &txn, 0);
|
||||
CHK(env->txn_begin(env, NULL, &txn, 0));
|
||||
state = get_state(i);
|
||||
next_state = do_random_fileop(i, state);
|
||||
put_state(i, next_state);
|
||||
r = txn->commit(txn, 0);
|
||||
CHK(txn->commit(txn, 0));
|
||||
update_crash_timer();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -212,6 +212,11 @@ struct __toku_db_txn_internal {
|
|||
DB_TXN *child;
|
||||
struct toku_list dbs_that_must_close_before_abort;
|
||||
};
|
||||
struct __toku_db_txn_external {
|
||||
struct __toku_db_txn external_part;
|
||||
struct __toku_db_txn_internal internal_part;
|
||||
};
|
||||
#define db_txn_struct_i(x) (&((struct __toku_db_txn_external *)x)->internal_part)
|
||||
|
||||
struct __toku_dbc_internal {
|
||||
struct brt_cursor *c;
|
||||
|
@ -225,6 +230,14 @@ struct __toku_dbc_internal {
|
|||
BOOL rmw;
|
||||
};
|
||||
|
||||
struct __toku_dbc_external {
|
||||
struct __toku_dbc external_part;
|
||||
struct __toku_dbc_internal internal_part;
|
||||
};
|
||||
|
||||
#define dbc_struct_i(x) (&((struct __toku_dbc_external *)x)->internal_part)
|
||||
|
||||
|
||||
int toku_db_pre_acquire_table_lock(DB *db, DB_TXN *txn, BOOL just_lock);
|
||||
|
||||
int toku_grab_write_lock(DB *db, DBT *key, TOKUTXN tokutxn);
|
||||
|
|
20
src/ydb.c
20
src/ydb.c
|
@ -2988,11 +2988,10 @@ toku_txn_begin(DB_ENV *env, DB_TXN * stxn, DB_TXN ** txn, u_int32_t flags, int i
|
|||
}
|
||||
if (flags!=0) return toku_ydb_do_error(env, EINVAL, "Invalid flags passed to DB_ENV->txn_begin\n");
|
||||
|
||||
size_t result_size = sizeof(DB_TXN)+sizeof(struct __toku_db_txn_internal); // the internal stuff is stuck on the end.
|
||||
DB_TXN *result = toku_malloc(result_size);
|
||||
if (result == 0)
|
||||
return ENOMEM;
|
||||
memset(result, 0, result_size);
|
||||
struct __toku_db_txn_external *XMALLOC(eresult); // so the internal stuff is stuck on the end.
|
||||
memset(eresult, 0, sizeof(*eresult));
|
||||
DB_TXN *result = &eresult->external_part;
|
||||
|
||||
//toku_ydb_notef("parent=%p flags=0x%x\n", stxn, flags);
|
||||
result->mgrp = env;
|
||||
#define STXN(name) result->name = locked_txn_ ## name
|
||||
|
@ -4501,7 +4500,7 @@ toku_db_cursor(DB * db, DB_TXN * txn, DBC ** c, u_int32_t flags, int is_temporar
|
|||
HANDLE_DB_ILLEGAL_WORKING_PARENT_TXN(db, txn);
|
||||
DB_ENV* env = db->dbenv;
|
||||
int r;
|
||||
size_t result_size = sizeof(DBC)+sizeof(struct __toku_dbc_internal); // internal stuff stuck on the end
|
||||
|
||||
if (flags & ~(DB_SERIALIZABLE | DB_INHERIT_ISOLATION | DB_RMW | DBC_DISABLE_PREFETCHING)) {
|
||||
return toku_ydb_do_error(
|
||||
env,
|
||||
|
@ -4509,14 +4508,15 @@ toku_db_cursor(DB * db, DB_TXN * txn, DBC ** c, u_int32_t flags, int is_temporar
|
|||
"Invalid flags set for toku_db_cursor\n"
|
||||
);
|
||||
}
|
||||
|
||||
r = toku_grab_read_lock_on_directory(db, txn);
|
||||
if (r != 0)
|
||||
return r;
|
||||
|
||||
DBC *result = toku_malloc(result_size);
|
||||
if (result == 0)
|
||||
return ENOMEM;
|
||||
memset(result, 0, result_size);
|
||||
struct __toku_dbc_external *XMALLOC(eresult); // so the internal stuff is stuck on the end
|
||||
memset(eresult, 0, sizeof(*eresult));
|
||||
DBC *result = &eresult->external_part;
|
||||
|
||||
#define SCRS(name) result->name = locked_ ## name
|
||||
SCRS(c_get);
|
||||
SCRS(c_close);
|
||||
|
|
|
@ -137,6 +137,8 @@ else ifeq ($(GCCVERSION),4.4.1)
|
|||
COMBINE := 0
|
||||
else ifeq ($(GCCVERSION),4.4.0)
|
||||
GCC_VERSION_SPECIFIC = -Wno-deprecated
|
||||
else ifeq ($(GCCVERSION),4.6.2)
|
||||
COMBINE := 0
|
||||
endif
|
||||
|
||||
WALL = $(GCC_VERSION_SPECIFIC) -Wall -Wextra -Wcast-align -Wbad-function-cast -Wno-missing-noreturn -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations \
|
||||
|
@ -162,6 +164,8 @@ else ifeq ($(GCCVERSION),4.4.1)
|
|||
CFLAGS += -Wno-strict-aliasing
|
||||
else ifeq ($(GCCVERSION),4.4.0)
|
||||
CFLAGS += -Wno-strict-aliasing
|
||||
else ifeq ($(GCCVERSION),4.6.2)
|
||||
CFLAGS += -Wno-error=deprecated-declarations
|
||||
endif
|
||||
LIBPORTABILITY_SO=$(TOKUROOT)lib/libtokuportability.$(SOEXT)
|
||||
LIBPORTABILITY_A=$(TOKUROOT)lib/libtokuportability.$(AEXT)
|
||||
|
|
Loading…
Add table
Reference in a new issue