diff options
author | Michael Cahill <michael.cahill@mongodb.com> | 2016-02-17 16:58:39 +1100 |
---|---|---|
committer | Michael Cahill <michael.cahill@mongodb.com> | 2016-02-17 16:58:39 +1100 |
commit | 98d6ce255d8c0e0724beaddf8f591f2c4b8c96a4 (patch) | |
tree | 01ab9da33fd5d723ed5a61a19f42046afeab00c1 | |
parent | d915631b2536c71ea68d6ac7db2bfcb5bd5294cc (diff) | |
parent | 52a2084358e2cc7303bcee7b8a75ca66aac231d2 (diff) | |
download | mongo-98d6ce255d8c0e0724beaddf8f591f2c4b8c96a4.tar.gz |
Merge pull request #2498 from wiredtiger/server-22676
SERVER-22676 Don't check duplicated create calls for matching configurations
-rw-r--r-- | src/schema/schema_create.c | 61 | ||||
-rw-r--r-- | test/suite/test_index01.py | 4 | ||||
-rw-r--r-- | test/suite/test_schema02.py | 4 |
3 files changed, 26 insertions, 43 deletions
diff --git a/src/schema/schema_create.c b/src/schema/schema_create.c index 25bbd496798..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,20 +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) { + WT_ERR(__wt_metadata_insert(session, name, idxconf)); - /* If there is data in the table, fill the index. */ - WT_ERR(__fill_index(session, table, idx)); + /* 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); @@ -612,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/test/suite/test_index01.py b/test/suite/test_index01.py index bebeb191ef0..5dfa5506277 100644 --- a/test/suite/test_index01.py +++ b/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/test/suite/test_schema02.py b/test/suite/test_schema02.py index 6895e947efe..b404261c066 100644 --- a/test/suite/test_schema02.py +++ b/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" |