Commit 938a3d92 authored by Dave Wells's avatar Dave Wells Committed by Yoni Fogel

assert labeling 3

git-svn-id: file:///svn/toku/tokudb@20296 c7de825b-a66e-492c-adef-691d508d4ae1
parent a75fe0e9
...@@ -141,8 +141,8 @@ void brtloader_fi_destroy (struct file_infos *fi, BOOL is_error) ...@@ -141,8 +141,8 @@ void brtloader_fi_destroy (struct file_infos *fi, BOOL is_error)
{ {
int r = toku_pthread_mutex_destroy(&fi->lock); lazy_assert(r == 0); int r = toku_pthread_mutex_destroy(&fi->lock); lazy_assert(r == 0);
if (!is_error) { if (!is_error) {
assert(fi->n_files_open==0); invariant(fi->n_files_open==0);
assert(fi->n_files_extant==0); invariant(fi->n_files_extant==0);
} }
for (int i=0; i<fi->n_files; i++) { for (int i=0; i<fi->n_files; i++) {
if (fi->file_infos[i].is_open) { if (fi->file_infos[i].is_open) {
...@@ -667,7 +667,7 @@ void add_row (struct rowset *rows, DBT *key, DBT *val) ...@@ -667,7 +667,7 @@ void add_row (struct rowset *rows, DBT *key, DBT *val)
while (next_off > rows->n_bytes_limit) { while (next_off > rows->n_bytes_limit) {
rows->n_bytes_limit = rows->n_bytes_limit*2; rows->n_bytes_limit = rows->n_bytes_limit*2;
} }
assert(next_off <= rows->n_bytes_limit); invariant(next_off <= rows->n_bytes_limit);
REALLOC_N(rows->n_bytes_limit, rows->data); REALLOC_N(rows->n_bytes_limit, rows->data);
} }
memcpy(rows->data+off, key->data, key->size); memcpy(rows->data+off, key->data, key->size);
...@@ -853,7 +853,7 @@ static int process_primary_rows_internal (BRTLOADER bl, struct rowset *primary_r ...@@ -853,7 +853,7 @@ static int process_primary_rows_internal (BRTLOADER bl, struct rowset *primary_r
{ {
int r = bl->generate_row_for_put(bl->dbs[i], bl->src_db, &skey, &sval, &pkey, &pval, NULL); int r = bl->generate_row_for_put(bl->dbs[i], bl->src_db, &skey, &sval, &pkey, &pval, NULL);
assert(r==0); // LAZY lazy_assert(r==0); // LAZY
} }
if (row_wont_fit(rows, skey.size + sval.size)) { if (row_wont_fit(rows, skey.size + sval.size)) {
...@@ -906,7 +906,7 @@ static int process_primary_rows_internal (BRTLOADER bl, struct rowset *primary_r ...@@ -906,7 +906,7 @@ static int process_primary_rows_internal (BRTLOADER bl, struct rowset *primary_r
for (int i=0; i<bl->N; i++) { for (int i=0; i<bl->N; i++) {
if (error_codes[i]) r = error_codes[i]; if (error_codes[i]) r = error_codes[i];
} }
assert(r); // found the error lazy_assert(r); // found the error
} }
toku_free(error_codes); toku_free(error_codes);
BL_TRACE(blt_extractor); BL_TRACE(blt_extractor);
...@@ -1533,7 +1533,7 @@ int merge_files (struct merge_fileset *fs, ...@@ -1533,7 +1533,7 @@ int merge_files (struct merge_fileset *fs,
int progress_allocation_for_this_pass = progress_allocation/n_passes_left; int progress_allocation_for_this_pass = progress_allocation/n_passes_left;
progress_allocation -= progress_allocation_for_this_pass; progress_allocation -= progress_allocation_for_this_pass;
assert(fs->n_temp_files>0); invariant(fs->n_temp_files>0);
struct merge_fileset next_file_set; struct merge_fileset next_file_set;
BOOL to_queue = (BOOL)(fs->n_temp_files <= mergelimit); BOOL to_queue = (BOOL)(fs->n_temp_files <= mergelimit);
init_merge_fileset(&next_file_set); init_merge_fileset(&next_file_set);
...@@ -2027,7 +2027,7 @@ static int toku_loader_write_brt_from_q (BRTLOADER bl, ...@@ -2027,7 +2027,7 @@ static int toku_loader_write_brt_from_q (BRTLOADER bl,
} }
{ {
assert(sts.n_subtrees==1); invariant(sts.n_subtrees==1);
BLOCKNUM root_block = make_blocknum(sts.subtrees[0].block); BLOCKNUM root_block = make_blocknum(sts.subtrees[0].block);
toku_free(sts.subtrees); sts.subtrees = NULL; toku_free(sts.subtrees); sts.subtrees = NULL;
...@@ -2046,7 +2046,7 @@ static int toku_loader_write_brt_from_q (BRTLOADER bl, ...@@ -2046,7 +2046,7 @@ static int toku_loader_write_brt_from_q (BRTLOADER bl,
toku_serialize_descriptor_contents_to_wbuf(&wbuf, descriptor); toku_serialize_descriptor_contents_to_wbuf(&wbuf, descriptor);
u_int32_t checksum = x1764_finish(&wbuf.checksum); u_int32_t checksum = x1764_finish(&wbuf.checksum);
wbuf_int(&wbuf, checksum); wbuf_int(&wbuf, checksum);
assert(wbuf.ndone==desc_size); invariant(wbuf.ndone==desc_size);
r = toku_os_write(out.fd, wbuf.buf, wbuf.ndone); r = toku_os_write(out.fd, wbuf.buf, wbuf.ndone);
out.current_off += desc_size; out.current_off += desc_size;
toku_free(buf); // wbuf_destroy toku_free(buf); // wbuf_destroy
...@@ -2149,7 +2149,7 @@ static int loader_do_i (BRTLOADER bl, ...@@ -2149,7 +2149,7 @@ static int loader_do_i (BRTLOADER bl,
{ {
mode_t mode = S_IRWXU|S_IRWXG|S_IRWXO; mode_t mode = S_IRWXU|S_IRWXG|S_IRWXO;
int fd = open(new_fname, O_RDWR| O_CREAT | O_BINARY, mode); int fd = open(new_fname, O_RDWR| O_CREAT | O_BINARY, mode);
assert(fd>=0); lazy_assert(fd>=0);
// This structure must stay live until the join below. // This structure must stay live until the join below.
struct fractal_thread_args fta = {bl, struct fractal_thread_args fta = {bl,
...@@ -2166,7 +2166,7 @@ static int loader_do_i (BRTLOADER bl, ...@@ -2166,7 +2166,7 @@ static int loader_do_i (BRTLOADER bl,
// ignore r2, since we already have an error // ignore r2, since we already have an error
goto error; goto error;
} }
assert(bl->fractal_threads_live[which_db]==FALSE); invariant(bl->fractal_threads_live[which_db]==FALSE);
bl->fractal_threads_live[which_db] = TRUE; bl->fractal_threads_live[which_db] = TRUE;
r = merge_files(fs, bl, which_db, dest_db, compare, allocation_for_merge, bl->fractal_queues[which_db]); r = merge_files(fs, bl, which_db, dest_db, compare, allocation_for_merge, bl->fractal_queues[which_db]);
...@@ -2221,7 +2221,7 @@ static int toku_brt_loader_close_internal (BRTLOADER bl) ...@@ -2221,7 +2221,7 @@ static int toku_brt_loader_close_internal (BRTLOADER bl)
if (result!=0) goto error; if (result!=0) goto error;
toku_free((void*)bl->new_fnames_in_env[i]); toku_free((void*)bl->new_fnames_in_env[i]);
bl->new_fnames_in_env[i] = NULL; bl->new_fnames_in_env[i] = NULL;
assert(0<=bl->progress && bl->progress <= PROGRESS_MAX); invariant(0<=bl->progress && bl->progress <= PROGRESS_MAX);
result = update_progress(0, bl, "did index"); result = update_progress(0, bl, "did index");
if (result) goto error; if (result) goto error;
} }
...@@ -2645,7 +2645,7 @@ static void write_nonleaf_node (BRTLOADER bl, struct dbout *out, int64_t blocknu ...@@ -2645,7 +2645,7 @@ static void write_nonleaf_node (BRTLOADER bl, struct dbout *out, int64_t blocknu
ci->have_fullhash = FALSE; ci->have_fullhash = FALSE;
ci->fullhash = 0; ci->fullhash = 0;
int r = toku_fifo_create(&ci->buffer); int r = toku_fifo_create(&ci->buffer);
assert(r==0); resource_assert(r==0);
ci->n_bytes_in_buffer = 0; ci->n_bytes_in_buffer = 0;
} }
......
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