diff options
author | Keith Bostic <keith@wiredtiger.com> | 2015-02-11 16:49:26 -0500 |
---|---|---|
committer | Keith Bostic <keith@wiredtiger.com> | 2015-02-11 16:49:26 -0500 |
commit | 108c7e5e1865cbb586b83ec25451e0b32caa2fa8 (patch) | |
tree | 4b624cb92f2a42bb9356b1e97f1cdbaf1d459cf3 /src/lsm | |
parent | 20b0ade45ac52aba80260a8ad49694c60476d9ae (diff) | |
download | mongo-108c7e5e1865cbb586b83ec25451e0b32caa2fa8.tar.gz |
CID 47823 At condition chunk != NULL, the value of chunk cannot be NULL.
While in the neighborhood, re-order the verbose call and the refcnt
increment so we don't need to undo the refcnt increment on error.
Diffstat (limited to 'src/lsm')
-rw-r--r-- | src/lsm/lsm_work_unit.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/src/lsm/lsm_work_unit.c b/src/lsm/lsm_work_unit.c index 2e87dd539db..5b1e0ced69c 100644 --- a/src/lsm/lsm_work_unit.c +++ b/src/lsm/lsm_work_unit.c @@ -75,7 +75,7 @@ __wt_lsm_get_chunk_to_flush(WT_SESSION_IMPL *session, u_int i; *chunkp = NULL; - chunk = evict_chunk = flush_chunk = NULL; + evict_chunk = flush_chunk = NULL; WT_ASSERT(session, lsm_tree->queue_ref > 0); WT_RET(__wt_lsm_tree_readlock(session, lsm_tree)); @@ -117,17 +117,13 @@ __wt_lsm_get_chunk_to_flush(WT_SESSION_IMPL *session, } else chunk = (evict_chunk != NULL) ? evict_chunk : flush_chunk; - if (chunk != NULL) { - (void)WT_ATOMIC_ADD4(chunk->refcnt, 1); - WT_ERR(__wt_verbose(session, WT_VERB_LSM, - "Flush%s: return chunk %u of %u: %s", - force ? " w/ force" : "", - i, lsm_tree->nchunks, chunk->uri)); - } + WT_ERR(__wt_verbose(session, WT_VERB_LSM, + "Flush%s: return chunk %u of %u: %s", + force ? " w/ force" : "", i, lsm_tree->nchunks, chunk->uri)); + + (void)WT_ATOMIC_ADD4(chunk->refcnt, 1); -err: if (ret != 0 && chunk != NULL) - (void)WT_ATOMIC_SUB4(chunk->refcnt, 1); - WT_RET(__wt_lsm_tree_readunlock(session, lsm_tree)); +err: WT_RET(__wt_lsm_tree_readunlock(session, lsm_tree)); *chunkp = chunk; return (ret); |