summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKeith Bostic <keith@wiredtiger.com>2015-03-20 13:34:35 -0400
committerKeith Bostic <keith@wiredtiger.com>2015-03-20 13:34:35 -0400
commite492e12bb55a5f3878b20df0bb3a92aeb842bfd4 (patch)
tree198cf32d8c6bef190f309f32ca8598116818595e /src
parent377f9e593f74a11b649e072f52035e0cf842248e (diff)
downloadmongo-e492e12bb55a5f3878b20df0bb3a92aeb842bfd4.tar.gz
Check for empty or "none" collator, compressor and extractor values in
the bottom-level configuration checking routines; this duplicates some work in the upper levels, but ensures it always gets done. Minor cleanup in btree collator code, don't retrieve the app_metadata value if there's no collator value.
Diffstat (limited to 'src')
-rw-r--r--src/btree/bt_handle.c11
-rw-r--r--src/conn/conn_api.c14
-rw-r--r--src/conn/conn_log.c4
3 files changed, 20 insertions, 9 deletions
diff --git a/src/btree/bt_handle.c b/src/btree/bt_handle.c
index f8667e4d9cc..1e0f95d3131 100644
--- a/src/btree/bt_handle.c
+++ b/src/btree/bt_handle.c
@@ -222,13 +222,14 @@ __btree_conf(WT_SESSION_IMPL *session, WT_CKPT *ckpt)
/* Row-store key comparison and key gap for prefix compression. */
if (btree->type == BTREE_ROW) {
- WT_RET(
- __wt_config_gets(session, cfg, "app_metadata", &metadata));
WT_RET(__wt_config_gets_none(session, cfg, "collator", &cval));
- if (cval.len != 0)
+ if (cval.len != 0) {
+ WT_RET(__wt_config_gets(
+ session, cfg, "app_metadata", &metadata));
WT_RET(__wt_collator_config(
session, btree->dhandle->name, &cval, &metadata,
&btree->collator, &btree->collator_owned));
+ }
WT_RET(__wt_config_gets(session, cfg, "key_gap", &cval));
btree->key_gap = (uint32_t)cval.val;
@@ -304,9 +305,7 @@ __btree_conf(WT_SESSION_IMPL *session, WT_CKPT *ckpt)
}
WT_RET(__wt_config_gets_none(session, cfg, "block_compressor", &cval));
- if (cval.len > 0)
- WT_RET(
- __wt_compressor_config(session, &cval, &btree->compressor));
+ WT_RET(__wt_compressor_config(session, &cval, &btree->compressor));
/* Initialize locks. */
WT_RET(__wt_rwlock_alloc(
diff --git a/src/conn/conn_api.c b/src/conn/conn_api.c
index 8aff2b2d4ae..73d0836a3b1 100644
--- a/src/conn/conn_api.c
+++ b/src/conn/conn_api.c
@@ -78,6 +78,9 @@ __collator_confchk(
if (collatorp != NULL)
*collatorp = NULL;
+ if (cname->len == 0 || WT_STRING_MATCH("none", cname->str, cname->len))
+ return (0);
+
conn = S2C(session);
TAILQ_FOREACH(ncoll, &conn->collqh, q)
if (WT_STRING_MATCH(ncoll->name, cname->str, cname->len)) {
@@ -114,6 +117,8 @@ __wt_collator_config(WT_SESSION_IMPL *session, const char *uri,
*ownp = 0;
WT_RET(__collator_confchk(session, cname, &collator));
+ if (collator == NULL)
+ return (0);
if (collator->customize != NULL)
WT_RET(collator->customize(collator,
@@ -383,6 +388,9 @@ __compressor_confchk(
if (compressorp != NULL)
*compressorp = NULL;
+ if (cval->len == 0 || WT_STRING_MATCH("none", cval->str, cval->len))
+ return (0);
+
conn = S2C(session);
TAILQ_FOREACH(ncomp, &conn->compqh, q)
if (WT_STRING_MATCH(ncomp->name, cval->str, cval->len)) {
@@ -605,6 +613,9 @@ __extractor_confchk(
if (extractorp != NULL)
*extractorp = NULL;
+ if (cname->len == 0 || WT_STRING_MATCH("none", cname->str, cname->len))
+ return (0);
+
conn = S2C(session);
TAILQ_FOREACH(nextractor, &conn->extractorqh, q)
if (WT_STRING_MATCH(nextractor->name, cname->str, cname->len)) {
@@ -646,6 +657,9 @@ __wt_extractor_config(WT_SESSION_IMPL *session,
return (0);
WT_RET(__extractor_confchk(session, &cname, &extractor));
+ if (extractor == NULL)
+ return (0);
+
if (extractor->customize != NULL) {
WT_RET(__wt_config_getones(session,
config, "app_metadata", &cname));
diff --git a/src/conn/conn_log.c b/src/conn/conn_log.c
index 9b366ae463a..156c4aa225f 100644
--- a/src/conn/conn_log.c
+++ b/src/conn/conn_log.c
@@ -61,9 +61,7 @@ __logmgr_config(WT_SESSION_IMPL *session, const char **cfg, int *runp)
*/
conn->log_compressor = NULL;
WT_RET(__wt_config_gets_none(session, cfg, "log.compressor", &cval));
- if (cval.len > 0)
- WT_RET(__wt_compressor_config(
- session, &cval, &conn->log_compressor));
+ WT_RET(__wt_compressor_config(session, &cval, &conn->log_compressor));
WT_RET(__wt_config_gets(session, cfg, "log.path", &cval));
WT_RET(__wt_strndup(session, cval.str, cval.len, &conn->log_path));