summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Cahill <michael.cahill@mongodb.com>2016-02-17 16:58:39 +1100
committerMichael Cahill <michael.cahill@mongodb.com>2016-02-17 17:17:20 +1100
commit5e3a56f0abb433a23e0b8cb8f9a0c86c2d6ad80f (patch)
tree18750c8420557a5e009f0ff3a9ceb140689c5208 /src
parent07966a492ada9b85cd45af9248abd85ca47f2ff2 (diff)
downloadmongo-5e3a56f0abb433a23e0b8cb8f9a0c86c2d6ad80f.tar.gz
Merge pull request #2498 from wiredtiger/server-22676
SERVER-22676 Don't check duplicated create calls for matching configurations (cherry picked from commit 98d6ce255d8c0e0724beaddf8f591f2c4b8c96a4)
Diffstat (limited to 'src')
-rw-r--r--src/schema/schema_create.c60
1 files changed, 26 insertions, 34 deletions
diff --git a/src/schema/schema_create.c b/src/schema/schema_create.c
index 8cdcbbcad54..9b3b76b62de 100644
--- a/src/schema/schema_create.c
+++ b/src/schema/schema_create.c
@@ -275,15 +275,11 @@ __create_colgroup(WT_SESSION_IMPL *session,
WT_ERR(__wt_schema_create(session, source, sourceconf));
WT_ERR(__wt_config_collapse(session, cfg, &cgconf));
- if (exists) {
- if (strcmp(cgconf, origconf) != 0)
- WT_ERR_MSG(session, EINVAL,
- "%s: does not match existing configuration", name);
- goto err;
- }
- WT_ERR(__wt_metadata_insert(session, name, cgconf));
- WT_ERR(__wt_schema_open_colgroups(session, table));
+ if (!exists) {
+ WT_ERR(__wt_metadata_insert(session, name, cgconf));
+ WT_ERR(__wt_schema_open_colgroups(session, table));
+ }
err: __wt_free(session, cgconf);
__wt_free(session, sourceconf);
@@ -539,19 +535,17 @@ __create_index(WT_SESSION_IMPL *session,
cfg[1] = sourceconf;
cfg[2] = confbuf.data;
WT_ERR(__wt_config_collapse(session, cfg, &idxconf));
- if (exists) {
- if (strcmp(idxconf, origconf) != 0)
- WT_ERR_MSG(session, EINVAL,
- "%s: does not match existing configuration", name);
- goto err;
- }
- WT_ERR(__wt_metadata_insert(session, name, idxconf));
- /* Make sure that the configuration is valid. */
- WT_ERR(__wt_schema_open_index(
- session, table, idxname, strlen(idxname), &idx));
- if (!exists)
+ if (!exists) {
+ WT_ERR(__wt_metadata_insert(session, name, idxconf));
+
+ /* Make sure that the configuration is valid. */
+ WT_ERR(__wt_schema_open_index(
+ session, table, idxname, strlen(idxname), &idx));
+
+ /* If there is data in the table, fill the index. */
WT_ERR(__fill_index(session, table, idx));
+ }
err: __wt_free(session, idxconf);
__wt_free(session, origconf);
@@ -611,23 +605,21 @@ __create_table(WT_SESSION_IMPL *session,
WT_ERR_NOTFOUND_OK(ret);
WT_ERR(__wt_config_collapse(session, cfg, &tableconf));
- if (exists) {
- if (strcmp(tableconf, table->config) != 0)
- WT_ERR_MSG(session, EINVAL,
- "%s: does not match existing configuration", name);
- goto err;
- }
- WT_ERR(__wt_metadata_insert(session, name, tableconf));
- /* Attempt to open the table now to catch any errors. */
- WT_ERR(__wt_schema_get_table(
- session, tablename, strlen(tablename), true, &table));
+ if (!exists) {
+ WT_ERR(__wt_metadata_insert(session, name, tableconf));
+
+ /* Attempt to open the table now to catch any errors. */
+ WT_ERR(__wt_schema_get_table(
+ session, tablename, strlen(tablename), true, &table));
- if (ncolgroups == 0) {
- cgsize = strlen("colgroup:") + strlen(tablename) + 1;
- WT_ERR(__wt_calloc_def(session, cgsize, &cgname));
- snprintf(cgname, cgsize, "colgroup:%s", tablename);
- WT_ERR(__create_colgroup(session, cgname, exclusive, config));
+ if (ncolgroups == 0) {
+ cgsize = strlen("colgroup:") + strlen(tablename) + 1;
+ WT_ERR(__wt_calloc_def(session, cgsize, &cgname));
+ snprintf(cgname, cgsize, "colgroup:%s", tablename);
+ WT_ERR(__create_colgroup(
+ session, cgname, exclusive, config));
+ }
}
if (0) {