Commit 0d96531b authored by Rich Prohaska's avatar Rich Prohaska Committed by Yoni Fogel

minor changes to compile with icc and make the windows port easier. addresses #1195

git-svn-id: file:///svn/toku/tokudb.1195@7647 c7de825b-a66e-492c-adef-691d508d4ae1
parent 5873fc59
...@@ -45,7 +45,7 @@ VGRIND = valgrind --quiet --error-exitcode=1 --leak-check=yes ...@@ -45,7 +45,7 @@ VGRIND = valgrind --quiet --error-exitcode=1 --leak-check=yes
ifeq ($(CC),icc) ifeq ($(CC),icc)
#icc only: #icc only:
OPTFLAGS = -O3 -ip -ipo2 OPTFLAGS = -O3 -ip
COMBINE_C = -ipo-c COMBINE_C = -ipo-c
FORMAT= #No argument for extra format warnings. FORMAT= #No argument for extra format warnings.
WALL = -Wall -Wcheck # '-Wextra' becomes '-Wcheck' in icc WALL = -Wall -Wcheck # '-Wextra' becomes '-Wcheck' in icc
......
...@@ -207,7 +207,7 @@ get_nonleaf_reactivity (BRTNODE node) { ...@@ -207,7 +207,7 @@ get_nonleaf_reactivity (BRTNODE node) {
static BOOL static BOOL
nonleaf_node_is_gorged (BRTNODE node) { nonleaf_node_is_gorged (BRTNODE node) {
return toku_serialize_brtnode_size(node) > node->nodesize; return (BOOL)(toku_serialize_brtnode_size(node) > node->nodesize);
} }
static int static int
...@@ -249,7 +249,7 @@ static u_int32_t compute_child_fullhash (CACHEFILE cf, BRTNODE node, int childnu ...@@ -249,7 +249,7 @@ static u_int32_t compute_child_fullhash (CACHEFILE cf, BRTNODE node, int childnu
return child_fullhash; return child_fullhash;
} }
} }
abort(); abort(); return 0;
} }
static void static void
...@@ -847,9 +847,9 @@ brt_nonleaf_split (BRT t, BRTNODE node, BRTNODE *nodea, BRTNODE *nodeb, DBT *spl ...@@ -847,9 +847,9 @@ brt_nonleaf_split (BRT t, BRTNODE node, BRTNODE *nodea, BRTNODE *nodeb, DBT *spl
MALLOC_N(n_children_in_b, B->u.n.childkeys); MALLOC_N(n_children_in_b, B->u.n.childkeys);
B->u.n.n_children =n_children_in_b; B->u.n.n_children =n_children_in_b;
if (0) { if (0) {
printf("%s:%d %p (%" PRIu64 ") splits, old estimates:", __FILE__, __LINE__, node, node->thisnodename.b); printf("%s:%d %p (%" PRId64 ") splits, old estimates:", __FILE__, __LINE__, node, node->thisnodename.b);
int i; int i;
for (i=0; i<node->u.n.n_children; i++) printf(" %" PRId64, BNC_SUBTREE_LEAFENTRY_ESTIMATE(node, i)); for (i=0; i<node->u.n.n_children; i++) printf(" %" PRIu64, BNC_SUBTREE_LEAFENTRY_ESTIMATE(node, i));
printf("\n"); printf("\n");
} }
...@@ -1090,9 +1090,9 @@ static int ...@@ -1090,9 +1090,9 @@ static int
brt_split_child (BRT t, BRTNODE node, int childnum, TOKULOGGER logger, BOOL *did_react) brt_split_child (BRT t, BRTNODE node, int childnum, TOKULOGGER logger, BOOL *did_react)
{ {
if (0) { if (0) {
printf("%s:%d Node %" PRIu64 "->u.n.n_children=%d estimates=", __FILE__, __LINE__, node->thisnodename.b, node->u.n.n_children); printf("%s:%d Node %" PRId64 "->u.n.n_children=%d estimates=", __FILE__, __LINE__, node->thisnodename.b, node->u.n.n_children);
int i; int i;
for (i=0; i<node->u.n.n_children; i++) printf(" %" PRId64, BNC_SUBTREE_LEAFENTRY_ESTIMATE(node, i)); for (i=0; i<node->u.n.n_children; i++) printf(" %" PRIu64, BNC_SUBTREE_LEAFENTRY_ESTIMATE(node, i));
printf("\n"); printf("\n");
} }
assert(node->height>0); assert(node->height>0);
...@@ -1141,9 +1141,9 @@ brt_split_child (BRT t, BRTNODE node, int childnum, TOKULOGGER logger, BOOL *did ...@@ -1141,9 +1141,9 @@ brt_split_child (BRT t, BRTNODE node, int childnum, TOKULOGGER logger, BOOL *did
{ {
int r = handle_split_of_child (t, node, childnum, nodea, nodeb, &splitk, logger); int r = handle_split_of_child (t, node, childnum, nodea, nodeb, &splitk, logger);
if (0) { if (0) {
printf("%s:%d Node %" PRIu64 "->u.n.n_children=%d estimates=", __FILE__, __LINE__, node->thisnodename.b, node->u.n.n_children); printf("%s:%d Node %" PRId64 "->u.n.n_children=%d estimates=", __FILE__, __LINE__, node->thisnodename.b, node->u.n.n_children);
int i; int i;
for (i=0; i<node->u.n.n_children; i++) printf(" %" PRId64, BNC_SUBTREE_LEAFENTRY_ESTIMATE(node, i)); for (i=0; i<node->u.n.n_children; i++) printf(" %" PRIu64, BNC_SUBTREE_LEAFENTRY_ESTIMATE(node, i));
printf("\n"); printf("\n");
} }
return r; return r;
...@@ -1168,7 +1168,7 @@ should_compare_both_keys (BRTNODE node, BRT_CMD cmd) ...@@ -1168,7 +1168,7 @@ should_compare_both_keys (BRTNODE node, BRT_CMD cmd)
case BRT_NONE: case BRT_NONE:
break; break;
} }
abort(); abort(); return 0;
} }
static int apply_cmd_to_le_committed (u_int32_t klen, void *kval, static int apply_cmd_to_le_committed (u_int32_t klen, void *kval,
...@@ -1199,7 +1199,7 @@ static int apply_cmd_to_le_committed (u_int32_t klen, void *kval, ...@@ -1199,7 +1199,7 @@ static int apply_cmd_to_le_committed (u_int32_t klen, void *kval,
newlen, disksize, new_data); newlen, disksize, new_data);
case BRT_NONE: break; case BRT_NONE: break;
} }
abort(); abort(); return 0;
} }
static int apply_cmd_to_le_both (TXNID xid, static int apply_cmd_to_le_both (TXNID xid,
...@@ -1247,7 +1247,7 @@ static int apply_cmd_to_le_both (TXNID xid, ...@@ -1247,7 +1247,7 @@ static int apply_cmd_to_le_both (TXNID xid,
newlen, disksize, new_data); newlen, disksize, new_data);
case BRT_NONE: break; case BRT_NONE: break;
} }
abort(); abort(); return 0;
} }
static int apply_cmd_to_le_provdel (TXNID xid, static int apply_cmd_to_le_provdel (TXNID xid,
...@@ -1299,7 +1299,7 @@ static int apply_cmd_to_le_provdel (TXNID xid, ...@@ -1299,7 +1299,7 @@ static int apply_cmd_to_le_provdel (TXNID xid,
return 0; return 0;
case BRT_NONE: break; case BRT_NONE: break;
} }
abort(); abort(); return 0;
} }
static int apply_cmd_to_le_provpair (TXNID xid, static int apply_cmd_to_le_provpair (TXNID xid,
...@@ -1350,7 +1350,7 @@ static int apply_cmd_to_le_provpair (TXNID xid, ...@@ -1350,7 +1350,7 @@ static int apply_cmd_to_le_provpair (TXNID xid,
newlen, disksize, new_data); newlen, disksize, new_data);
case BRT_NONE: break; case BRT_NONE: break;
} }
abort(); abort(); return 0;
} }
static int static int
...@@ -1386,7 +1386,7 @@ apply_cmd_to_leaf (BRT_CMD cmd, ...@@ -1386,7 +1386,7 @@ apply_cmd_to_leaf (BRT_CMD cmd,
LESWITCHCALL(stored_data, apply_cmd_to, cmd, LESWITCHCALL(stored_data, apply_cmd_to, cmd,
newlen, disksize, new_data); newlen, disksize, new_data);
} }
abort(); abort(); return 0;
} }
static int static int
...@@ -1782,7 +1782,7 @@ brt_nonleaf_put_cmd (BRT t, BRTNODE node, BRT_CMD cmd, TOKULOGGER logger, ...@@ -1782,7 +1782,7 @@ brt_nonleaf_put_cmd (BRT t, BRTNODE node, BRT_CMD cmd, TOKULOGGER logger,
case BRT_NONE: case BRT_NONE:
break; break;
} }
abort(); abort(); return 0;
} }
static LEAFENTRY static LEAFENTRY
...@@ -1829,7 +1829,7 @@ balance_leaf_nodes (BRTNODE a, BRTNODE b, struct kv_pair **splitk) ...@@ -1829,7 +1829,7 @@ balance_leaf_nodes (BRTNODE a, BRTNODE b, struct kv_pair **splitk)
// If b is bigger then move stuff from b to a until b is the smaller. // If b is bigger then move stuff from b to a until b is the smaller.
// If a is bigger then move stuff from a to b until a is the smaller. // If a is bigger then move stuff from a to b until a is the smaller.
{ {
BOOL move_from_right = (toku_serialize_brtnode_size(a) < toku_serialize_brtnode_size(b)); BOOL move_from_right = (BOOL)(toku_serialize_brtnode_size(a) < toku_serialize_brtnode_size(b));
BRTNODE from = move_from_right ? b : a; BRTNODE from = move_from_right ? b : a;
BRTNODE to = move_from_right ? a : b; BRTNODE to = move_from_right ? a : b;
OMT omtfrom = from->u.l.buffer; OMT omtfrom = from->u.l.buffer;
...@@ -1879,6 +1879,7 @@ maybe_merge_pinned_leaf_nodes (BRT t, BRTNODE a, BRTNODE b, TOKULOGGER logger, B ...@@ -1879,6 +1879,7 @@ maybe_merge_pinned_leaf_nodes (BRT t, BRTNODE a, BRTNODE b, TOKULOGGER logger, B
{ {
unsigned int sizea = toku_serialize_brtnode_size(a); unsigned int sizea = toku_serialize_brtnode_size(a);
unsigned int sizeb = toku_serialize_brtnode_size(b); unsigned int sizeb = toku_serialize_brtnode_size(b);
t=t; logger=logger;
if ((sizea + sizeb)*4 > (a->nodesize*3)) { if ((sizea + sizeb)*4 > (a->nodesize*3)) {
// the combined size is more than 3/4 of a node, so don't merge them. // the combined size is more than 3/4 of a node, so don't merge them.
*did_merge = FALSE; *did_merge = FALSE;
...@@ -1890,7 +1891,6 @@ maybe_merge_pinned_leaf_nodes (BRT t, BRTNODE a, BRTNODE b, TOKULOGGER logger, B ...@@ -1890,7 +1891,6 @@ maybe_merge_pinned_leaf_nodes (BRT t, BRTNODE a, BRTNODE b, TOKULOGGER logger, B
*did_merge = TRUE; *did_merge = TRUE;
return merge_leaf_nodes(a, b); return merge_leaf_nodes(a, b);
} }
t=t; logger=logger;
} }
static int static int
...@@ -2106,7 +2106,7 @@ brt_handle_maybe_reactive_child(BRT t, BRTNODE node, int childnum, enum reactivi ...@@ -2106,7 +2106,7 @@ brt_handle_maybe_reactive_child(BRT t, BRTNODE node, int childnum, enum reactivi
case RE_FUSIBLE: case RE_FUSIBLE:
return brt_merge_child(t, node, childnum, did_io, logger, did_react); return brt_merge_child(t, node, childnum, did_io, logger, did_react);
} }
abort(); // this cannot happen abort(); return 0; // this cannot happen
} }
static int static int
...@@ -2132,7 +2132,7 @@ brt_handle_maybe_reactive_child_at_root (BRT brt, CACHEKEY *rootp, BRTNODE *node ...@@ -2132,7 +2132,7 @@ brt_handle_maybe_reactive_child_at_root (BRT brt, CACHEKEY *rootp, BRTNODE *node
case RE_FUSIBLE: case RE_FUSIBLE:
return 0; // Cannot merge anything at the root, so return happy. return 0; // Cannot merge anything at the root, so return happy.
} }
abort(); abort(); return 0;
} }
...@@ -2358,7 +2358,7 @@ CACHEKEY* toku_calculate_root_offset_pointer (BRT brt, u_int32_t *roothash) { ...@@ -2358,7 +2358,7 @@ CACHEKEY* toku_calculate_root_offset_pointer (BRT brt, u_int32_t *roothash) {
} }
} }
} }
abort(); abort(); return 0;
} }
int toku_brt_root_put_cmd(BRT brt, BRT_CMD cmd, TOKULOGGER logger) int toku_brt_root_put_cmd(BRT brt, BRT_CMD cmd, TOKULOGGER logger)
...@@ -3111,7 +3111,7 @@ pair_leafval_heaviside_le_committed (u_int32_t klen, void *kval, ...@@ -3111,7 +3111,7 @@ pair_leafval_heaviside_le_committed (u_int32_t klen, void *kval,
case BRT_SEARCH_LEFT: return cmp==0 ? -1 : +1; case BRT_SEARCH_LEFT: return cmp==0 ? -1 : +1;
case BRT_SEARCH_RIGHT: return cmp==0 ? +1 : -1; // Because the comparison runs backwards for right searches. case BRT_SEARCH_RIGHT: return cmp==0 ? +1 : -1; // Because the comparison runs backwards for right searches.
} }
abort(); abort(); return 0;
} }
......
...@@ -167,7 +167,7 @@ static void ...@@ -167,7 +167,7 @@ static void
dump_block_translation(struct brt_header *h, u_int64_t offset) { dump_block_translation(struct brt_header *h, u_int64_t offset) {
if (offset < h->translated_blocknum_limit) { if (offset < h->translated_blocknum_limit) {
struct block_translation_pair *bx = &h->block_translation[offset]; struct block_translation_pair *bx = &h->block_translation[offset];
printf("%"PRIu64": %"PRIu64" %"PRIu64"\n", offset, bx->diskoff, bx->size); printf("%"PRIu64": %"PRId64" %"PRId64"\n", offset, bx->diskoff, bx->size);
} }
} }
......
...@@ -56,21 +56,22 @@ cachetable_unpin_and_remove_test (int n) { ...@@ -56,21 +56,22 @@ cachetable_unpin_and_remove_test (int n) {
} }
// unpin and remove // unpin and remove
CACHEKEY oldkeys[n]; CACHEKEY testkeys[n];
for (i=0; i<n; i++) testkeys[i] = keys[i];
while (nkeys > 0) { while (nkeys > 0) {
i = random() % nkeys; i = random() % nkeys;
u_int32_t hi = toku_cachetable_hash(f1, make_blocknum(keys[i].b)); u_int32_t hi = toku_cachetable_hash(f1, make_blocknum(testkeys[i].b));
r = toku_cachetable_unpin_and_remove(f1, keys[i]); r = toku_cachetable_unpin_and_remove(f1, testkeys[i]);
assert(r == 0); assert(r == 0);
toku_cachefile_verify(f1); toku_cachefile_verify(f1);
// verify that k is removed // verify that k is removed
void *v; void *v;
r = toku_cachetable_maybe_get_and_pin(f1, make_blocknum(keys[i].b), hi, &v); r = toku_cachetable_maybe_get_and_pin(f1, make_blocknum(testkeys[i].b), hi, &v);
assert(r != 0); assert(r != 0);
oldkeys[i] = keys[i]; keys[i] = keys[nkeys-1]; nkeys -= 1; testkeys[i] = testkeys[nkeys-1]; nkeys -= 1;
} }
// verify that all are really removed // verify that all are really removed
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment