summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Cahill <michael.cahill@mongodb.com>2016-02-17 16:58:39 +1100
committerRamon Fernandez <ramon@mongodb.com>2016-02-17 11:53:24 -0500
commit726c889abf68c0541229bf5c8e314a91f7348f67 (patch)
treec08ad04f258f5d4045cff9ec01f57ad923b2d071
parent6e71d0d568e134c029203593b00a0103e7cdf30b (diff)
downloadmongo-726c889abf68c0541229bf5c8e314a91f7348f67.tar.gz
SERVER-22676 Don't check duplicated create calls for matching configurations
(cherry picked from commit 98d6ce255d8c0e0724beaddf8f591f2c4b8c96a4) (cherry picked from commit 5e3a56f0abb433a23e0b8cb8f9a0c86c2d6ad80f)
-rw-r--r--src/third_party/wiredtiger/src/schema/schema_create.c60
-rw-r--r--src/third_party/wiredtiger/test/suite/test_index01.py4
-rw-r--r--src/third_party/wiredtiger/test/suite/test_schema02.py4
3 files changed, 26 insertions, 42 deletions
diff --git a/src/third_party/wiredtiger/src/schema/schema_create.c b/src/third_party/wiredtiger/src/schema/schema_create.c
index 8cdcbbcad54..9b3b76b62de 100644
--- a/src/third_party/wiredtiger/src/schema/schema_create.c
+++ b/src/third_party/wiredtiger/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) {
diff --git a/src/third_party/wiredtiger/test/suite/test_index01.py b/src/third_party/wiredtiger/test/suite/test_index01.py
index bebeb191ef0..5dfa5506277 100644
--- a/src/third_party/wiredtiger/test/suite/test_index01.py
+++ b/src/third_party/wiredtiger/test/suite/test_index01.py
@@ -226,10 +226,6 @@ class test_index01(wttest.WiredTigerTestCase):
self.assertRaises(wiredtiger.WiredTigerError,
lambda: self.session.create(self.index[0],
'columns=(dept),exclusive'))
- # non-exclusive create with differing configuration
- self.assertRaisesWithMessage(wiredtiger.WiredTigerError,
- lambda: self.session.create(self.index[0],
- 'columns=(salary)'), '/does not match existing configuration/')
self.drop_table()
if __name__ == '__main__':
diff --git a/src/third_party/wiredtiger/test/suite/test_schema02.py b/src/third_party/wiredtiger/test/suite/test_schema02.py
index 6895e947efe..b404261c066 100644
--- a/src/third_party/wiredtiger/test/suite/test_schema02.py
+++ b/src/third_party/wiredtiger/test/suite/test_schema02.py
@@ -103,10 +103,6 @@ class test_schema02(wttest.WiredTigerTestCase):
self.expect_failure_colgroup("main:c1", "columns=(S1,i2),exclusive",
"")
- # exists with different config
- self.expect_failure_colgroup("main:c1", "columns=(S1,i4)",
- "/does not match existing configuration/")
-
# colgroup not declared in initial create
self.expect_failure_colgroup("main:c3", "columns=(S3,i4)",
"/Column group 'c3' not found in"