summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Bostic <keith.bostic@mongodb.com>2015-05-13 12:00:42 -0400
committerKeith Bostic <keith.bostic@mongodb.com>2015-05-13 12:00:42 -0400
commitd3a4e1b24f610c37b99a6385e4dd6fefd040ce7c (patch)
tree19641a29ccc60ae4a957c1596da91ecab85b2dd4
parent0eb48092047dc16b4672356bceaf2076c0cdc0eb (diff)
parent1f050f5c38c49c4291eea9bc83ca0a58839fc8ac (diff)
downloadmongo-d3a4e1b24f610c37b99a6385e4dd6fefd040ce7c.tar.gz
Merge pull request #1964 from wiredtiger/ignore-extractor-on-create
Ignore unknown extractors during WT_SESSION.create.
-rw-r--r--src/conn/conn_api.c16
-rw-r--r--src/include/extern.h1
-rw-r--r--src/schema/schema_create.c8
-rw-r--r--src/schema/schema_open.c23
-rw-r--r--test/suite/test_bug012.py1
5 files changed, 28 insertions, 21 deletions
diff --git a/src/conn/conn_api.c b/src/conn/conn_api.c
index bd6071a345d..c57be1a9423 100644
--- a/src/conn/conn_api.c
+++ b/src/conn/conn_api.c
@@ -616,8 +616,7 @@ __extractor_confchk(
WT_CONNECTION_IMPL *conn;
WT_NAMED_EXTRACTOR *nextractor;
- if (extractorp != NULL)
- *extractorp = NULL;
+ *extractorp = NULL;
if (cname->len == 0 || WT_STRING_MATCH("none", cname->str, cname->len))
return (0);
@@ -625,8 +624,7 @@ __extractor_confchk(
conn = S2C(session);
TAILQ_FOREACH(nextractor, &conn->extractorqh, q)
if (WT_STRING_MATCH(nextractor->name, cname->str, cname->len)) {
- if (extractorp != NULL)
- *extractorp = nextractor->extractor;
+ *extractorp = nextractor->extractor;
return (0);
}
WT_RET_MSG(session, EINVAL,
@@ -634,16 +632,6 @@ __extractor_confchk(
}
/*
- * __wt_extractor_confchk --
- * Check for a valid custom extractor (public).
- */
-int
-__wt_extractor_confchk(WT_SESSION_IMPL *session, WT_CONFIG_ITEM *cname)
-{
- return (__extractor_confchk(session, cname, NULL));
-}
-
-/*
* __wt_extractor_config --
* Given a configuration, configure the extractor.
*/
diff --git a/src/include/extern.h b/src/include/extern.h
index 5e8c57b6eaf..404186ab215 100644
--- a/src/include/extern.h
+++ b/src/include/extern.h
@@ -210,7 +210,6 @@ extern int __wt_conn_remove_compressor(WT_SESSION_IMPL *session);
extern int __wt_conn_remove_data_source(WT_SESSION_IMPL *session);
extern int __wt_encryptor_config(WT_SESSION_IMPL *session, WT_CONFIG_ITEM *cval, WT_CONFIG_ITEM *keyid, WT_CONFIG_ARG *cfg_arg, WT_KEYED_ENCRYPTOR **kencryptorp);
extern int __wt_conn_remove_encryptor(WT_SESSION_IMPL *session);
-extern int __wt_extractor_confchk(WT_SESSION_IMPL *session, WT_CONFIG_ITEM *cname);
extern int __wt_extractor_config(WT_SESSION_IMPL *session, const char *config, WT_EXTRACTOR **extractorp, int *ownp);
extern int __wt_conn_remove_extractor(WT_SESSION_IMPL *session);
extern int __wt_verbose_config(WT_SESSION_IMPL *session, const char *cfg[]);
diff --git a/src/schema/schema_create.c b/src/schema/schema_create.c
index a1f5ddcc2e7..4624d82d727 100644
--- a/src/schema/schema_create.c
+++ b/src/schema/schema_create.c
@@ -373,10 +373,6 @@ __create_index(WT_SESSION_IMPL *session,
if (__wt_config_getones_none(
session, config, "extractor", &cval) == 0 && cval.len != 0) {
have_extractor = 1;
-
- /* Confirm the extractor exists. */
- WT_ERR(__wt_extractor_confchk(session, &cval));
-
/* Custom extractors must supply a key format. */
if ((ret = __wt_config_getones(
session, config, "key_format", &kval)) != 0)
@@ -481,6 +477,10 @@ __create_index(WT_SESSION_IMPL *session,
goto err;
}
+ /* Make sure that the configuration is valid. */
+ WT_ERR(__wt_schema_open_index(
+ session, table, idxname, strlen(idxname), NULL));
+
err: __wt_free(session, idxconf);
__wt_free(session, sourceconf);
__wt_buf_free(session, &confbuf);
diff --git a/src/schema/schema_open.c b/src/schema/schema_open.c
index 2b645d5c666..7470701e756 100644
--- a/src/schema/schema_open.c
+++ b/src/schema/schema_open.c
@@ -227,7 +227,14 @@ __open_index(WT_SESSION_IMPL *session, WT_TABLE *table, WT_INDEX *idx)
WT_ERR(__wt_buf_catfmt(
session, buf, "%.*s,", (int)ckey.len, ckey.str));
}
- if (ret != 0 && ret != WT_NOTFOUND)
+ WT_ERR_NOTFOUND_OK(ret);
+
+ /*
+ * If the table doesn't yet have its column groups, don't try to
+ * calculate a plan: we are just checking that the index creation is
+ * sane.
+ */
+ if (!table->cg_complete)
goto err;
WT_ERR(__wt_scr_alloc(session, 0, &plan));
@@ -341,6 +348,20 @@ __wt_schema_open_index(WT_SESSION_IMPL *session,
WT_ERR(__wt_strdup(session, idxconf, &idx->config));
WT_ERR(__open_index(session, table, idx));
+ /*
+ * If we're checking the creation of an index before a
+ * table is fully created, don't save the index: it
+ * will need to be reopened once the table is complete.
+ */
+ if (!table->cg_complete) {
+ ret = __wt_schema_destroy_index(session, idx);
+ idx = NULL;
+ WT_ERR(ret);
+ if (idxname != NULL)
+ break;
+ continue;
+ }
+
table->indices[i] = idx;
idx = NULL;
diff --git a/test/suite/test_bug012.py b/test/suite/test_bug012.py
index a3f79a6f9f9..921940df255 100644
--- a/test/suite/test_bug012.py
+++ b/test/suite/test_bug012.py
@@ -29,7 +29,6 @@
import wiredtiger, wttest
from helper import complex_populate
-
# test_bug012.py
class test_bug012(wttest.WiredTigerTestCase):