diff options
author | Don Anderson <dda@ddanderson.com> | 2014-12-09 16:04:48 -0500 |
---|---|---|
committer | Don Anderson <dda@ddanderson.com> | 2014-12-09 16:04:48 -0500 |
commit | 7e0f7d7b803f9af04ad10b2bec6ef5073aa79248 (patch) | |
tree | c78c4f58bb09c148c274c3d96f539655cd7af29f /src/schema | |
parent | 4b38d7775febc169da0fc8e8ace302a21447853f (diff) | |
download | mongo-7e0f7d7b803f9af04ad10b2bec6ef5073aa79248.tar.gz |
SESSION->drop with "force" of nonexistant index/colgroup should be silent.
Refs #1436.
Diffstat (limited to 'src/schema')
-rw-r--r-- | src/schema/schema_drop.c | 5 | ||||
-rw-r--r-- | src/schema/schema_open.c | 8 | ||||
-rw-r--r-- | src/schema/schema_stat.c | 4 | ||||
-rw-r--r-- | src/schema/schema_worker.c | 5 |
4 files changed, 14 insertions, 8 deletions
diff --git a/src/schema/schema_drop.c b/src/schema/schema_drop.c index 6752b602890..53b33bde5cb 100644 --- a/src/schema/schema_drop.c +++ b/src/schema/schema_drop.c @@ -70,7 +70,7 @@ __drop_colgroup( /* If we can get the colgroup, detach it from the table. */ if ((ret = __wt_schema_get_colgroup( - session, uri, &table, &colgroup)) == 0) { + session, uri, force, &table, &colgroup)) == 0) { table->cg_complete = 0; WT_TRET(__wt_schema_drop(session, colgroup->source, cfg)); } @@ -95,7 +95,8 @@ __drop_index( WT_TABLE *table; /* If we can get the colgroup, detach it from the table. */ - if ((ret = __wt_schema_get_index(session, uri, &table, &idx)) == 0) { + if ((ret = __wt_schema_get_index(session, uri, force, &table, + &idx)) == 0) { table->idx_complete = 0; WT_TRET(__wt_schema_drop(session, idx->source, cfg)); } diff --git a/src/schema/schema_open.c b/src/schema/schema_open.c index cee51af5742..3ae15973d96 100644 --- a/src/schema/schema_open.c +++ b/src/schema/schema_open.c @@ -471,7 +471,7 @@ err: if (table != NULL) */ int __wt_schema_get_colgroup(WT_SESSION_IMPL *session, - const char *uri, WT_TABLE **tablep, WT_COLGROUP **colgroupp) + const char *uri, int quiet, WT_TABLE **tablep, WT_COLGROUP **colgroupp) { WT_COLGROUP *colgroup; WT_TABLE *table; @@ -503,6 +503,8 @@ __wt_schema_get_colgroup(WT_SESSION_IMPL *session, } __wt_schema_release_table(session, table); + if (quiet) + WT_RET(ENOENT); WT_RET_MSG(session, ENOENT, "%s not found in table", uri); } @@ -512,7 +514,7 @@ __wt_schema_get_colgroup(WT_SESSION_IMPL *session, */ int __wt_schema_get_index(WT_SESSION_IMPL *session, - const char *uri, WT_TABLE **tablep, WT_INDEX **indexp) + const char *uri, int quiet, WT_TABLE **tablep, WT_INDEX **indexp) { WT_DECL_RET; WT_INDEX *idx; @@ -553,5 +555,7 @@ err: __wt_schema_release_table(session, table); if (*indexp != NULL) return (0); + if (quiet) + WT_RET(ENOENT); WT_RET_MSG(session, ENOENT, "%s not found in table", uri); } diff --git a/src/schema/schema_stat.c b/src/schema/schema_stat.c index cb8e7f6c418..06b3ac5ca6e 100644 --- a/src/schema/schema_stat.c +++ b/src/schema/schema_stat.c @@ -19,7 +19,7 @@ __wt_curstat_colgroup_init(WT_SESSION_IMPL *session, WT_DECL_ITEM(buf); WT_DECL_RET; - WT_RET(__wt_schema_get_colgroup(session, uri, NULL, &colgroup)); + WT_RET(__wt_schema_get_colgroup(session, uri, 0, NULL, &colgroup)); WT_RET(__wt_scr_alloc(session, 0, &buf)); WT_ERR(__wt_buf_fmt(session, buf, "statistics:%s", colgroup->source)); @@ -41,7 +41,7 @@ __wt_curstat_index_init(WT_SESSION_IMPL *session, WT_DECL_RET; WT_INDEX *idx; - WT_RET(__wt_schema_get_index(session, uri, NULL, &idx)); + WT_RET(__wt_schema_get_index(session, uri, 0, NULL, &idx)); WT_RET(__wt_scr_alloc(session, 0, &buf)); WT_ERR(__wt_buf_fmt(session, buf, "statistics:%s", idx->source)); diff --git a/src/schema/schema_worker.c b/src/schema/schema_worker.c index 9895246685f..667943956f6 100644 --- a/src/schema/schema_worker.c +++ b/src/schema/schema_worker.c @@ -60,12 +60,13 @@ __wt_schema_worker(WT_SESSION_IMPL *session, WT_TRET(__wt_session_release_btree(session)); } } else if (WT_PREFIX_MATCH(uri, "colgroup:")) { - WT_ERR(__wt_schema_get_colgroup(session, uri, NULL, &colgroup)); + WT_ERR(__wt_schema_get_colgroup(session, uri, 0, NULL, + &colgroup)); WT_ERR(__wt_schema_worker(session, colgroup->source, file_func, name_func, cfg, open_flags)); } else if (WT_PREFIX_SKIP(tablename, "index:")) { idx = NULL; - WT_ERR(__wt_schema_get_index(session, uri, NULL, &idx)); + WT_ERR(__wt_schema_get_index(session, uri, 0, NULL, &idx)); WT_ERR(__wt_schema_worker(session, idx->source, file_func, name_func, cfg, open_flags)); } else if (WT_PREFIX_MATCH(uri, "lsm:")) { |