summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cursor/cur_backup.c4
-rw-r--r--src/include/extern.h19
-rw-r--r--src/lsm/lsm_tree.c13
-rw-r--r--src/schema/schema_worker.c39
-rw-r--r--src/session/session_compact.c10
5 files changed, 60 insertions, 25 deletions
diff --git a/src/cursor/cur_backup.c b/src/cursor/cur_backup.c
index 22ae7bf91ae..96c94748ce2 100644
--- a/src/cursor/cur_backup.c
+++ b/src/cursor/cur_backup.c
@@ -428,12 +428,14 @@ __backup_file_remove(WT_SESSION_IMPL *session)
* Called via the schema_worker function.
*/
int
-__wt_backup_list_uri_append(WT_SESSION_IMPL *session, const char *name)
+__wt_backup_list_uri_append(
+ WT_SESSION_IMPL *session, const char *name, int *skip)
{
WT_CURSOR_BACKUP *cb;
const char *value;
cb = session->bkp_cursor;
+ WT_UNUSED(skip);
/* Add the metadata entry to the backup file. */
WT_RET(__wt_metadata_search(session, name, &value));
diff --git a/src/include/extern.h b/src/include/extern.h
index 34cc0ae382b..2b93a3772d6 100644
--- a/src/include/extern.h
+++ b/src/include/extern.h
@@ -605,8 +605,9 @@ extern int __wt_curbackup_open(WT_SESSION_IMPL *session,
const char *uri,
const char *cfg[],
WT_CURSOR **cursorp);
-extern int __wt_backup_list_uri_append(WT_SESSION_IMPL *session,
- const char *name);
+extern int __wt_backup_list_uri_append( WT_SESSION_IMPL *session,
+ const char *name,
+ int *skip);
extern int __wt_curbulk_init(WT_CURSOR_BULK *cbulk, int bitmap);
extern int __wt_curconfig_open(WT_SESSION_IMPL *session,
const char *uri,
@@ -899,13 +900,16 @@ extern int __wt_lsm_tree_lock( WT_SESSION_IMPL *session,
int exclusive);
extern int __wt_lsm_tree_unlock( WT_SESSION_IMPL *session,
WT_LSM_TREE *lsm_tree);
-extern int __wt_lsm_compact(WT_SESSION_IMPL *session, const char *name);
+extern int __wt_lsm_compact(WT_SESSION_IMPL *session,
+ const char *name,
+ int *skip);
extern int __wt_lsm_tree_worker(WT_SESSION_IMPL *session,
const char *uri,
int (*file_func)(WT_SESSION_IMPL *,
const char *[]),
int (*name_func)(WT_SESSION_IMPL *,
- const char *),
+ const char *,
+ int *),
const char *cfg[],
uint32_t open_flags);
extern void *__wt_lsm_merge_worker(void *vargs);
@@ -1264,7 +1268,8 @@ extern int __wt_schema_worker(WT_SESSION_IMPL *session,
int (*file_func)(WT_SESSION_IMPL *,
const char *[]),
int (*name_func)(WT_SESSION_IMPL *,
- const char *),
+ const char *,
+ int *),
const char *cfg[],
uint32_t open_flags);
extern int __wt_open_cursor(WT_SESSION_IMPL *session,
@@ -1281,7 +1286,9 @@ extern int __wt_open_session(WT_CONNECTION_IMPL *conn,
WT_EVENT_HANDLER *event_handler,
const char *config,
WT_SESSION_IMPL **sessionp);
-extern int __wt_compact_uri_analyze(WT_SESSION_IMPL *session, const char *uri);
+extern int __wt_compact_uri_analyze(WT_SESSION_IMPL *session,
+ const char *uri,
+ int *skip);
extern int __wt_session_compact( WT_SESSION *wt_session,
const char *uri,
const char *config);
diff --git a/src/lsm/lsm_tree.c b/src/lsm/lsm_tree.c
index 135916afa3d..3502845ee48 100644
--- a/src/lsm/lsm_tree.c
+++ b/src/lsm/lsm_tree.c
@@ -931,17 +931,23 @@ __wt_lsm_tree_unlock(
* Compact an LSM tree called via __wt_schema_worker.
*/
int
-__wt_lsm_compact(WT_SESSION_IMPL *session, const char *name)
+__wt_lsm_compact(WT_SESSION_IMPL *session, const char *name, int *skip)
{
WT_DECL_RET;
WT_LSM_TREE *lsm_tree;
uint64_t last_merge_progressing;
time_t begin, end;
- /* Ignore non LSM names. */
+ /*
+ * This function is applied to all matching sources: ignore anything
+ * that is not an LSM tree.
+ */
if (!WT_PREFIX_MATCH(name, "lsm:"))
return (0);
+ /* Tell __wt_schema_worker not to look inside the LSM tree. */
+ *skip = 1;
+
WT_RET(__wt_lsm_tree_get(session, name, 0, &lsm_tree));
if (!F_ISSET(S2C(session), WT_CONN_LSM_MERGE) ||
@@ -980,7 +986,7 @@ int
__wt_lsm_tree_worker(WT_SESSION_IMPL *session,
const char *uri,
int (*file_func)(WT_SESSION_IMPL *, const char *[]),
- int (*name_func)(WT_SESSION_IMPL *, const char *),
+ int (*name_func)(WT_SESSION_IMPL *, const char *, int *),
const char *cfg[], uint32_t open_flags)
{
WT_DECL_RET;
@@ -990,6 +996,7 @@ __wt_lsm_tree_worker(WT_SESSION_IMPL *session,
WT_RET(__wt_lsm_tree_get(session, uri,
FLD_ISSET(open_flags, WT_DHANDLE_EXCLUSIVE) ? 1 : 0, &lsm_tree));
+
/*
* We mark that we're busy using the tree to coordinate
* with merges so that merging doesn't change the chunk
diff --git a/src/schema/schema_worker.c b/src/schema/schema_worker.c
index 60143f97f77..7e0f910c47c 100644
--- a/src/schema/schema_worker.c
+++ b/src/schema/schema_worker.c
@@ -10,13 +10,13 @@
/*
* __wt_schema_worker --
* Get Btree handles for the object and cycle through calls to an
- * underlying worker function with each handle.
+ * underlying worker function with each handle.
*/
int
__wt_schema_worker(WT_SESSION_IMPL *session,
const char *uri,
int (*file_func)(WT_SESSION_IMPL *, const char *[]),
- int (*name_func)(WT_SESSION_IMPL *, const char *),
+ int (*name_func)(WT_SESSION_IMPL *, const char *, int *),
const char *cfg[], uint32_t open_flags)
{
WT_COLGROUP *colgroup;
@@ -27,12 +27,18 @@ __wt_schema_worker(WT_SESSION_IMPL *session,
WT_TABLE *table;
const char *tablename;
u_int i;
+ int skip;
table = NULL;
tablename = uri;
+ skip = 0;
if (name_func != NULL)
- WT_ERR(name_func(session, uri));
+ WT_ERR(name_func(session, uri, &skip));
+
+ /* If the callback said to skip this object, we're done. */
+ if (skip)
+ return (0);
/* Get the btree handle(s) and call the underlying function. */
if (WT_PREFIX_MATCH(uri, "file:")) {
@@ -52,8 +58,13 @@ __wt_schema_worker(WT_SESSION_IMPL *session,
WT_ERR(__wt_schema_worker(session, idx->source,
file_func, name_func, cfg, open_flags));
} else if (WT_PREFIX_MATCH(uri, "lsm:")) {
- WT_ERR(__wt_lsm_tree_worker(session,
- uri, file_func, name_func, cfg, open_flags));
+ /*
+ * LSM compaction is handled elsewhere, but if we get here
+ * trying to compact files, don't descend into an LSM tree.
+ */
+ if (file_func != __wt_compact)
+ WT_ERR(__wt_lsm_tree_worker(session,
+ uri, file_func, name_func, cfg, open_flags));
} else if (WT_PREFIX_SKIP(tablename, "table:")) {
WT_ERR(__wt_schema_get_table(session,
tablename, strlen(tablename), 0, &table));
@@ -67,19 +78,25 @@ __wt_schema_worker(WT_SESSION_IMPL *session,
*/
for (i = 0; i < WT_COLGROUPS(table); i++) {
colgroup = table->cgroups[i];
+ skip = 0;
if (name_func != NULL)
- WT_ERR(name_func(session, colgroup->name));
- WT_ERR(__wt_schema_worker(session, colgroup->source,
- file_func, name_func, cfg, open_flags));
+ WT_ERR(name_func(
+ session, colgroup->name, &skip));
+ if (!skip)
+ WT_ERR(__wt_schema_worker(
+ session, colgroup->source,
+ file_func, name_func, cfg, open_flags));
}
WT_ERR(__wt_schema_open_indices(session, table));
for (i = 0; i < table->nindices; i++) {
idx = table->indices[i];
+ skip = 0;
if (name_func != NULL)
- WT_ERR(name_func(session, idx->name));
- WT_ERR(__wt_schema_worker(session, idx->source,
- file_func, name_func, cfg, open_flags));
+ WT_ERR(name_func(session, idx->name, &skip));
+ if (!skip)
+ WT_ERR(__wt_schema_worker(session, idx->source,
+ file_func, name_func, cfg, open_flags));
}
} else if ((dsrc = __wt_schema_get_source(session, uri)) != NULL) {
wt_session = (WT_SESSION *)session;
diff --git a/src/session/session_compact.c b/src/session/session_compact.c
index 66c770c9002..7a7121adc19 100644
--- a/src/session/session_compact.c
+++ b/src/session/session_compact.c
@@ -102,15 +102,17 @@
* Called via the schema_worker function.
*/
int
-__wt_compact_uri_analyze(WT_SESSION_IMPL *session, const char *uri)
+__wt_compact_uri_analyze(WT_SESSION_IMPL *session, const char *uri, int *skip)
{
/*
* Add references to schema URI objects to the list of objects to be
- * compacted.
+ * compacted. Don't recurse into LSM trees or we will get false
+ * positives on the "file:" URIs for the chunks.
*/
- if (WT_PREFIX_MATCH(uri, "lsm:"))
+ if (WT_PREFIX_MATCH(uri, "lsm:")) {
session->compact->lsm_count++;
- else if (WT_PREFIX_MATCH(uri, "file:"))
+ *skip = 1;
+ } else if (WT_PREFIX_MATCH(uri, "file:"))
session->compact->file_count++;
return (0);