Commit 27cbb4c7 authored by Rich Prohaska's avatar Rich Prohaska Committed by Yoni Fogel

closes[t:2620] cleanup the lazy assert in the brtloader's close and abort functions

git-svn-id: file:///svn/toku/tokudb@20330 c7de825b-a66e-492c-adef-691d508d4ae1
parent 62d107b6
...@@ -2289,6 +2289,8 @@ int toku_brt_loader_close (BRTLOADER bl, ...@@ -2289,6 +2289,8 @@ int toku_brt_loader_close (BRTLOADER bl,
brt_loader_poll_func poll_function, void *poll_extra brt_loader_poll_func poll_function, void *poll_extra
) )
{ {
int result = 0;
int r; int r;
//printf("Closing\n"); //printf("Closing\n");
...@@ -2299,48 +2301,56 @@ int toku_brt_loader_close (BRTLOADER bl, ...@@ -2299,48 +2301,56 @@ int toku_brt_loader_close (BRTLOADER bl,
if (bl->extractor_live) { if (bl->extractor_live) {
r = finish_extractor(bl); r = finish_extractor(bl);
lazy_assert(r == 0); // LAZY !!! should check this error code and cleanup if needed. if (r)
result = r;
invariant(!bl->extractor_live); invariant(!bl->extractor_live);
} }
// check for an error during extraction // check for an error during extraction
if (result == 0) {
r = brt_loader_call_error_function(&bl->error_callback); r = brt_loader_call_error_function(&bl->error_callback);
if (r) { if (r)
brtloader_destroy(bl, TRUE); result = r;
return r;
} }
if (result == 0) {
r = toku_brt_loader_close_internal(bl); r = toku_brt_loader_close_internal(bl);
if (r && result == 0)
result = r;
} else
brtloader_destroy(bl, TRUE);
return r; return result;
} }
int toku_brt_loader_finish_extractor(BRTLOADER bl) { int toku_brt_loader_finish_extractor(BRTLOADER bl) {
int result = 0; int result = 0;
if (!bl->extractor_live) if (bl->extractor_live) {
result = EINVAL;
else {
int r = finish_extractor(bl); int r = finish_extractor(bl);
if (r) if (r)
result = r; result = r;
} invariant(!bl->extractor_live);
} else
result = EINVAL;
return result; return result;
} }
int toku_brt_loader_abort(BRTLOADER bl, BOOL is_error) int toku_brt_loader_abort(BRTLOADER bl, BOOL is_error)
/* Effect : Abort the bulk loader, free brtloader resources */ /* Effect : Abort the bulk loader, free brtloader resources */
{ {
int result = 0;
// cleanup the extractor thread // cleanup the extractor thread
if (bl->extractor_live) { if (bl->extractor_live) {
int r = finish_extractor(bl); int r = finish_extractor(bl);
assert(r == 0); if (r)
assert(!bl->extractor_live); result = r;
invariant(!bl->extractor_live);
} }
for (int i = 0; i < bl->N; i++) for (int i = 0; i < bl->N; i++)
assert(!bl->fractal_threads_live[i]); invariant(!bl->fractal_threads_live[i]);
int result = 0;
brtloader_destroy(bl, is_error); brtloader_destroy(bl, is_error);
return result; return result;
} }
......
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