summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Bostic <keith.bostic@mongodb.com>2017-07-30 21:11:02 -0400
committerMichael Cahill <michael.cahill@mongodb.com>2017-07-31 11:11:02 +1000
commit2e9744d11a65c63ba7445060dc78371250f04051 (patch)
tree218b2530a6f5e587f59a3c98496b87f290dcff22
parent9494eb2899e010c378f882348ff3b58d37ecab08 (diff)
downloadmongo-2e9744d11a65c63ba7445060dc78371250f04051.tar.gz
WT-3467 Minor lint/cleanup (#3541)mongodb-3.5.11
-rw-r--r--.gitignore1
-rw-r--r--src/btree/bt_split.c6
-rw-r--r--src/evict/evict_lru.c4
-rw-r--r--src/evict/evict_stat.c2
-rw-r--r--src/include/bitstring.i3
-rw-r--r--src/include/btmem.h16
-rw-r--r--src/include/buf.i24
-rw-r--r--src/include/serial.i15
-rw-r--r--src/log/log.c9
-rw-r--r--src/session/session_api.c9
-rw-r--r--src/support/time.c28
11 files changed, 42 insertions, 75 deletions
diff --git a/.gitignore b/.gitignore
index a4168362c50..204cd421fd1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -120,6 +120,7 @@ _wiredtiger.pyd
**/test/csuite/test_wt3120_filesys
**/test/csuite/test_wt3135_search_near_collator
**/test/csuite/test_wt3184_dup_index_collator
+**/test/csuite/test_wt3338_partial_update
**/test/csuite/test_wt3363_checkpoint_op_races
**/test/cursor_order/cursor_order
**/test/fops/t
diff --git a/src/btree/bt_split.c b/src/btree/bt_split.c
index 8005e4b3b41..2862c7fb6d7 100644
--- a/src/btree/bt_split.c
+++ b/src/btree/bt_split.c
@@ -32,9 +32,8 @@ typedef enum {
/*
* __page_split_timing_stress --
- * Optionally add delay to simulate the race conditions in
- * page split for debug purposes. The purpose is to uncover
- * the race conditions in page split.
+ * Optionally add delay to simulate the race conditions in page split for
+ * debug purposes. The purpose is to uncover the race conditions in page split.
*/
static void
__page_split_timing_stress(WT_SESSION_IMPL *session,
@@ -47,7 +46,6 @@ __page_split_timing_stress(WT_SESSION_IMPL *session,
/* We only want to sleep when page split race flag is set. */
if (FLD_ISSET(conn->timing_stress_flags, flag))
__wt_sleep(0, micro_seconds);
-
}
/*
diff --git a/src/evict/evict_lru.c b/src/evict/evict_lru.c
index f6e149ed1f5..6b341a85df8 100644
--- a/src/evict/evict_lru.c
+++ b/src/evict/evict_lru.c
@@ -1506,10 +1506,8 @@ retry: while (slot < max_entries) {
goto retry;
}
-err: if (dhandle_locked) {
+err: if (dhandle_locked)
__wt_readunlock(session, &conn->dhandle_lock);
- dhandle_locked = false;
- }
/*
* If we didn't find any entries on a walk when we weren't interrupted,
diff --git a/src/evict/evict_stat.c b/src/evict/evict_stat.c
index 63d0aff60f1..b8878f1ce2f 100644
--- a/src/evict/evict_stat.c
+++ b/src/evict/evict_stat.c
@@ -29,7 +29,7 @@ __evict_stat_walk(WT_SESSION_IMPL *session)
btree = S2BT(session);
cache = S2C(session)->cache;
next_walk = NULL;
- dsk_size = gen_gap = gen_gap_max = gen_gap_sum = max_pagesize = 0;
+ gen_gap_max = gen_gap_sum = max_pagesize = 0;
num_memory = num_not_queueable = num_queued = 0;
num_smaller_allocsz = pages_clean = pages_dirty = pages_internal = 0;
pages_leaf = seen_count = size = visited_count = 0;
diff --git a/src/include/bitstring.i b/src/include/bitstring.i
index a9ec91d49ff..bd14fa613a8 100644
--- a/src/include/bitstring.i
+++ b/src/include/bitstring.i
@@ -166,8 +166,6 @@ __bit_ffc(uint8_t *bitf, uint64_t nbits, uint64_t *retp)
uint8_t lb;
uint64_t byte, stopbyte, value;
- value = 0; /* -Wuninitialized */
-
if (nbits == 0)
return (-1);
@@ -199,7 +197,6 @@ __bit_ffs(uint8_t *bitf, uint64_t nbits, uint64_t *retp)
uint8_t lb;
uint64_t byte, stopbyte, value;
- value = 0;
if (nbits == 0)
return (-1);
diff --git a/src/include/btmem.h b/src/include/btmem.h
index b8447984b49..01a9179aedc 100644
--- a/src/include/btmem.h
+++ b/src/include/btmem.h
@@ -915,14 +915,6 @@ struct __wt_update {
* the semantics we want.
*/
uint8_t data[]; /* start of the data */
-
- /*
- * The memory size of an update: include some padding because this is
- * such a common case that overhead of tiny allocations can swamp our
- * cache overhead calculation.
- */
-#define WT_UPDATE_MEMSIZE(upd) \
- WT_ALIGN(WT_UPDATE_SIZE + (upd)->size, 32)
};
/*
@@ -932,6 +924,14 @@ struct __wt_update {
#define WT_UPDATE_SIZE (21 + WT_TIMESTAMP_SIZE)
/*
+ * The memory size of an update: include some padding because this is such a
+ * common case that overhead of tiny allocations can swamp our cache overhead
+ * calculation.
+ */
+#define WT_UPDATE_MEMSIZE(upd) \
+ WT_ALIGN(WT_UPDATE_SIZE + (upd)->size, 32)
+
+/*
* WT_MAX_MODIFY_UPDATE --
* Limit update chains to a small value to avoid penalizing reads and
* permit truncation.
diff --git a/src/include/buf.i b/src/include/buf.i
index 17f67afefce..8ff52f86ced 100644
--- a/src/include/buf.i
+++ b/src/include/buf.i
@@ -116,18 +116,18 @@ __wt_scr_free(WT_SESSION_IMPL *session, WT_ITEM **bufp)
{
WT_ITEM *buf;
- if ((buf = *bufp) != NULL) {
- *bufp = NULL;
+ if ((buf = *bufp) == NULL)
+ return;
+ *bufp = NULL;
- if (session->scratch_cached + buf->memsize >=
- S2C(session)->session_scratch_max) {
- __wt_free(session, buf->mem);
- buf->memsize = 0;
- } else
- session->scratch_cached += buf->memsize;
+ if (session->scratch_cached + buf->memsize >=
+ S2C(session)->session_scratch_max) {
+ __wt_free(session, buf->mem);
+ buf->memsize = 0;
+ } else
+ session->scratch_cached += buf->memsize;
- buf->data = NULL;
- buf->size = 0;
- F_CLR(buf, WT_ITEM_INUSE);
- }
+ buf->data = NULL;
+ buf->size = 0;
+ F_CLR(buf, WT_ITEM_INUSE);
}
diff --git a/src/include/serial.i b/src/include/serial.i
index 15d159192f9..d9c72cd2bad 100644
--- a/src/include/serial.i
+++ b/src/include/serial.i
@@ -259,8 +259,7 @@ __wt_insert_serial(WT_SESSION_IMPL *session, WT_PAGE *page,
*/
static inline int
__wt_update_serial(WT_SESSION_IMPL *session, WT_PAGE *page,
- WT_UPDATE **srch_upd, WT_UPDATE **updp, size_t upd_size,
- bool exclusive)
+ WT_UPDATE **srch_upd, WT_UPDATE **updp, size_t upd_size, bool exclusive)
{
WT_DECL_RET;
WT_UPDATE *obsolete, *upd = *updp;
@@ -290,19 +289,17 @@ __wt_update_serial(WT_SESSION_IMPL *session, WT_PAGE *page,
}
/*
- * Increment in-memory footprint after releasing the mutex: that's safe
- * because the structures we added cannot be discarded while visible to
- * any running transaction, and we're a running transaction, which means
- * there can be no corresponding delete until we complete.
+ * Increment in-memory footprint after swapping the update into place.
+ * Safe because the structures we added cannot be discarded while
+ * visible to any running transaction, and we're a running transaction,
+ * which means there can be no corresponding delete until we complete.
*/
__wt_cache_page_inmem_incr(session, page, upd_size);
/* Mark the page dirty after updating the footprint. */
__wt_page_modify_set(session, page);
- /*
- * If there are no subsequent WT_UPDATE structures we are done here.
- */
+ /* If there are no subsequent WT_UPDATE structures we are done here. */
if (upd->next == NULL || exclusive)
return (0);
diff --git a/src/log/log.c b/src/log/log.c
index 1460687d5af..3929938618e 100644
--- a/src/log/log.c
+++ b/src/log/log.c
@@ -54,10 +54,7 @@ __log_checksum_match(WT_SESSION_IMPL *session, WT_ITEM *buf, uint32_t reclen)
checksum_calculate = __wt_bswap32(checksum_calculate);
#endif
logrec->checksum = checksum_tmp;
- if (logrec->checksum != checksum_calculate)
- return (false);
- else
- return (true);
+ return (logrec->checksum == checksum_calculate);
}
/*
@@ -1214,8 +1211,8 @@ __log_set_version(WT_SESSION_IMPL *session, uint16_t version,
F_SET(log, WT_LOG_FORCE_NEWFILE);
if (!F_ISSET(conn, WT_CONN_READONLY))
return (__log_prealloc_remove(session));
- else
- return (0);
+
+ return (0);
}
/*
diff --git a/src/session/session_api.c b/src/session/session_api.c
index f7d6ce5e7e7..599d2ced103 100644
--- a/src/session/session_api.c
+++ b/src/session/session_api.c
@@ -1163,11 +1163,11 @@ __wt_session_range_truncate(WT_SESSION_IMPL *session,
*
* Rather happily, the compare routine will also confirm the cursors
* reference the same object and the keys are set.
+ *
+ * The test for a NULL start comparison function isn't necessary (we
+ * checked it above), but it quiets clang static analysis complaints.
*/
- if (start != NULL && stop != NULL) {
- /* quiet clang scan-build */
- WT_ASSERT(session, start->compare != NULL);
-
+ if (start != NULL && stop != NULL && start->compare != NULL) {
WT_ERR(start->compare(start, stop, &cmp));
if (cmp > 0)
WT_ERR_MSG(session, EINVAL,
@@ -1574,7 +1574,6 @@ __session_transaction_sync(WT_SESSION *wt_session, const char *config)
WT_ERR_MSG(session, EINVAL, "logging not enabled");
log = conn->log;
- timeout_ms = waited_ms = 0;
/*
* If there is no background sync LSN in this session, there
diff --git a/src/support/time.c b/src/support/time.c
index 0e4562c0234..233bc871e06 100644
--- a/src/support/time.c
+++ b/src/support/time.c
@@ -1,29 +1,9 @@
/*-
- * Public Domain 2014-2017 MongoDB, Inc.
- * Public Domain 2008-2014 WiredTiger, Inc.
+ * Copyright (c) 2014-2017 MongoDB, Inc.
+ * Copyright (c) 2008-2014 WiredTiger, Inc.
+ * All rights reserved.
*
- * This is free and unencumbered software released into the public domain.
- *
- * Anyone is free to copy, modify, publish, use, compile, sell, or
- * distribute this software, either in source code form or as a compiled
- * binary, for any purpose, commercial or non-commercial, and by any
- * means.
- *
- * In jurisdictions that recognize copyright laws, the author or authors
- * of this software dedicate any and all copyright interest in the
- * software to the public domain. We make this dedication for the benefit
- * of the public at large and to the detriment of our heirs and
- * successors. We intend this dedication to be an overt act of
- * relinquishment in perpetuity of all present and future rights to this
- * software under copyright law.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
+ * See the file LICENSE for redistribution information.
*/
#include "wt_internal.h"