Compare commits

..

9 Commits
2.0.0 ... 2.0.1

Author SHA1 Message Date
Alex Gorrod
01043c7f01 Cut WiredTiger release 2.0.1 2013-12-12 14:37:23 +11:00
Michael Cahill
ad9a551aec Merge pull request #806 from wiredtiger/lsm-chunk-flags-atomic
Switch to atomic flags for LSM chunks, to avoid racing when setting merge flags
2013-12-11 17:50:58 -08:00
Michael Cahill
405d7e6238 Switch to atomic flags for LSM chunks, to avoid racing when setting merge flags. 2013-12-12 11:50:41 +11:00
Michael Cahill
b7a31c4930 spelling 2013-12-12 11:46:50 +11:00
Alex Gorrod
036f3e17f0 Add recurse to spelling list. 2013-12-12 10:17:07 +11:00
Alex Gorrod
ddcda5fb5d Merge pull request #803 from wiredtiger/lint
Coverity + lint
2013-12-11 14:45:06 -08:00
Alex Gorrod
ea8aa18acf Merge pull request #804 from wiredtiger/lsm-compact-fix
Fix LSM compact so it doesn't try to compact the file inside an LSM tree
2013-12-11 14:39:13 -08:00
Michael Cahill
becd14f46d Fix LSM compact so it doesn't try to compact the file inside an LSM tree. 2013-12-12 08:46:44 +11:00
Keith Bostic
ef1d97df86 lint + Coverity 2013-12-11 08:06:40 -05:00
20 changed files with 148 additions and 98 deletions

4
NEWS
View File

@@ -1,7 +1,7 @@
WiredTiger release 2.0.0, 2013-12-11
WiredTiger release 2.0.1, 2013-12-12
------------------------------------
The WiredTiger 2.0.0 release contains major new features, numerous performance
The WiredTiger 2.0.1 release contains major new features, numerous performance
enhancements and bug fixes.
Significant changes include:

6
README
View File

@@ -1,6 +1,6 @@
WiredTiger 2.0.0: (December 11, 2013)
WiredTiger 2.0.1: (December 12, 2013)
This is version 2.0.0 of WiredTiger.
This is version 2.0.1 of WiredTiger.
WiredTiger release packages and documentation can be found at:
@@ -9,7 +9,7 @@ WiredTiger release packages and documentation can be found at:
Information on configuring, building and installing WiredTiger can be
found at:
http://source.wiredtiger.com/2.0.0/install.html
http://source.wiredtiger.com/2.0.1/install.html
WiredTiger licensing information can be found at:

View File

@@ -1,6 +1,6 @@
WIREDTIGER_VERSION_MAJOR=2
WIREDTIGER_VERSION_MINOR=0
WIREDTIGER_VERSION_PATCH=0
WIREDTIGER_VERSION_PATCH=1
WIREDTIGER_VERSION="$WIREDTIGER_VERSION_MAJOR.$WIREDTIGER_VERSION_MINOR.$WIREDTIGER_VERSION_PATCH"
WIREDTIGER_RELEASE_DATE=`date "+%B %e, %Y"`

View File

@@ -823,10 +823,16 @@ execute_populate(CONFIG *cfg)
return (ret);
}
lprintf(cfg, 0, 1, "Compact after populate");
ret = session->compact(session, cfg->uri, NULL);
session->close(session, NULL);
if (ret != 0)
if ((ret = session->compact(session, cfg->uri, NULL)) != 0) {
lprintf(cfg, ret, 0,
"execute_populate: WT_SESSION.compact");
return (ret);
}
if ((ret = session->close(session, NULL)) != 0) {
lprintf(cfg, ret, 0,
"execute_populate: WT_SESSION.close");
return (ret);
}
}
/*

View File

@@ -2,8 +2,8 @@ dnl build by dist/s_version
VERSION_MAJOR=2
VERSION_MINOR=0
VERSION_PATCH=0
VERSION_STRING='"WiredTiger 2.0.0: (December 11, 2013)"'
VERSION_PATCH=1
VERSION_STRING='"WiredTiger 2.0.1: (December 12, 2013)"'
AC_SUBST(VERSION_MAJOR)
AC_SUBST(VERSION_MINOR)

View File

@@ -1,2 +1,2 @@
dnl WiredTiger product version for AC_INIT. Maintained by dist/s_version
2.0.0
2.0.1

1
dist/s_string.ok vendored
View File

@@ -719,6 +719,7 @@ realloc
recno
recnos
recsize
recurse
reinitialization
req
rescan

View File

@@ -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));

View File

@@ -6,9 +6,9 @@ WiredTiger is an high performance, scalable, production quality, NoSQL,
@section releases Releases
<table>
@row{<b>WiredTiger 2.0.0</b> (current),
<a href="releases/wiredtiger-2.0.0.tar.bz2"><b>[Release package]</b></a>,
<a href="2.0.0/index.html"><b>[Documentation]</b></a>}
@row{<b>WiredTiger 2.0.1</b> (current),
<a href="releases/wiredtiger-2.0.1.tar.bz2"><b>[Release package]</b></a>,
<a href="2.0.1/index.html"><b>[Documentation]</b></a>}
@row{<b>WiredTiger 1.6.6</b> (previous),
<a href="releases/wiredtiger-1.6.6.tar.bz2"><b>[Release package]</b></a>,
<a href="1.6.6/index.html"><b>[Documentation]</b></a>}

View File

@@ -1,16 +1,16 @@
/*! @page upgrading Upgrading WiredTiger applications
@section version_200 Upgrading to Version 2.0.0
@section version_20 Upgrading to Version 2.0
<dl>
<dt>File format changes</dt>
<dd>
The underlying file format is unchanged in 2.0.0
The underlying file format is unchanged in 2.0
</dd>
<dt>WT_SESSION::create LSM configuration options</dt>
<dd>
In the 2.0.0 release of WiredTiger the LSM configuration options have been
In the 2.0 release of WiredTiger the LSM configuration options have been
collected into a configuration option subgroup. All configuration options
to WT_SESSION::create that previously had a prefix of \c lsm_ now belong to
the \c lsm configuration group. If you are explicitly configuring any of the

View File

@@ -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);

View File

@@ -65,7 +65,7 @@ struct __wt_lsm_chunk {
#define WT_LSM_CHUNK_MERGING 0x08
#define WT_LSM_CHUNK_ONDISK 0x10
#define WT_LSM_CHUNK_STABLE 0x20
uint32_t flags;
uint32_t flags_atomic;
} WT_GCC_ATTRIBUTE((aligned(WT_CACHE_LINE_ALIGNMENT)));
/*

View File

@@ -258,8 +258,8 @@ __clsm_open_cursors(
* metadata inconsistent.
*/
if (update && (lsm_tree->nchunks == 0 ||
F_ISSET(lsm_tree->chunk[lsm_tree->nchunks - 1],
WT_LSM_CHUNK_ONDISK))) {
(chunk = lsm_tree->chunk[lsm_tree->nchunks - 1]) == NULL ||
F_ISSET_ATOMIC(chunk, WT_LSM_CHUNK_ONDISK))) {
/* Release our lock because switch will get a write lock. */
locked = 0;
WT_ERR(__wt_lsm_tree_unlock(session, lsm_tree));
@@ -342,13 +342,13 @@ retry: if (F_ISSET(clsm, WT_CLSM_MERGE)) {
checkpoint = ((WT_CURSOR_BTREE *)*cp)->
btree->dhandle->checkpoint;
if (checkpoint == NULL &&
F_ISSET(chunk, WT_LSM_CHUNK_ONDISK) &&
!F_ISSET(chunk, WT_LSM_CHUNK_EMPTY))
F_ISSET_ATOMIC(chunk, WT_LSM_CHUNK_ONDISK) &&
!F_ISSET_ATOMIC(chunk, WT_LSM_CHUNK_EMPTY))
break;
/* Make sure the Bloom config matches. */
if (clsm->blooms[ngood] == NULL &&
F_ISSET(chunk, WT_LSM_CHUNK_BLOOM))
F_ISSET_ATOMIC(chunk, WT_LSM_CHUNK_BLOOM))
break;
}
@@ -406,23 +406,25 @@ retry: if (F_ISSET(clsm, WT_CLSM_MERGE)) {
*/
WT_ASSERT(session, *cp == NULL);
ret = __wt_open_cursor(session, chunk->uri, c,
(F_ISSET(chunk, WT_LSM_CHUNK_ONDISK) &&
!F_ISSET(chunk, WT_LSM_CHUNK_EMPTY)) ? ckpt_cfg : NULL, cp);
(F_ISSET_ATOMIC(chunk, WT_LSM_CHUNK_ONDISK) &&
!F_ISSET_ATOMIC(chunk, WT_LSM_CHUNK_EMPTY)) ?
ckpt_cfg : NULL, cp);
/*
* XXX kludge: we may have an empty chunk where no checkpoint
* was written. If so, try to open the ordinary handle on that
* chunk instead.
*/
if (ret == WT_NOTFOUND && F_ISSET(chunk, WT_LSM_CHUNK_ONDISK)) {
if (ret == WT_NOTFOUND &&
F_ISSET_ATOMIC(chunk, WT_LSM_CHUNK_ONDISK)) {
ret = __wt_open_cursor(
session, chunk->uri, c, NULL, cp);
if (ret == 0)
F_SET(chunk, WT_LSM_CHUNK_EMPTY);
F_SET_ATOMIC(chunk, WT_LSM_CHUNK_EMPTY);
}
WT_ERR(ret);
if (F_ISSET(chunk, WT_LSM_CHUNK_BLOOM) &&
if (F_ISSET_ATOMIC(chunk, WT_LSM_CHUNK_BLOOM) &&
!F_ISSET(clsm, WT_CLSM_MERGE))
WT_ERR(__wt_bloom_open(session, chunk->bloom_uri,
lsm_tree->bloom_bit_count,
@@ -434,7 +436,7 @@ retry: if (F_ISSET(clsm, WT_CLSM_MERGE)) {
}
/* The last chunk is our new primary. */
if (chunk != NULL && !F_ISSET(chunk, WT_LSM_CHUNK_ONDISK)) {
if (chunk != NULL && !F_ISSET_ATOMIC(chunk, WT_LSM_CHUNK_ONDISK)) {
clsm->primary_chunk = chunk;
primary = clsm->cursors[clsm->nchunks - 1];
WT_WITH_BTREE(session, ((WT_CURSOR_BTREE *)(primary))->btree,
@@ -459,13 +461,13 @@ err: F_CLR(session, WT_SESSION_NO_CACHE_CHECK);
checkpoint = ((WT_CURSOR_BTREE *)*cp)->
btree->dhandle->checkpoint;
WT_ASSERT(session,
(F_ISSET(chunk, WT_LSM_CHUNK_ONDISK) &&
!F_ISSET(chunk, WT_LSM_CHUNK_EMPTY)) ?
(F_ISSET_ATOMIC(chunk, WT_LSM_CHUNK_ONDISK) &&
!F_ISSET_ATOMIC(chunk, WT_LSM_CHUNK_EMPTY)) ?
checkpoint != NULL : checkpoint == NULL);
/* Make sure the Bloom config matches. */
WT_ASSERT(session,
(F_ISSET(chunk, WT_LSM_CHUNK_BLOOM) &&
(F_ISSET_ATOMIC(chunk, WT_LSM_CHUNK_BLOOM) &&
!F_ISSET(clsm, WT_CLSM_MERGE)) ?
clsm->blooms[i] != NULL : clsm->blooms[i] == NULL);
}
@@ -1079,9 +1081,9 @@ __clsm_put(WT_SESSION_IMPL *session,
lsm_tree = clsm->lsm_tree;
WT_ASSERT(session, clsm->primary_chunk != NULL);
WT_ASSERT(session, !F_ISSET(clsm->primary_chunk, WT_LSM_CHUNK_ONDISK));
WT_ASSERT(session,
clsm->primary_chunk != NULL &&
!F_ISSET_ATOMIC(clsm->primary_chunk, WT_LSM_CHUNK_ONDISK) &&
TXNID_LE(session->txn.id, clsm->primary_chunk->txnid_max));
/*

View File

@@ -106,8 +106,9 @@ __wt_lsm_merge(
*/
end_chunk = lsm_tree->nchunks - 1;
while (end_chunk > 0 &&
(!F_ISSET(lsm_tree->chunk[end_chunk], WT_LSM_CHUNK_BLOOM) ||
F_ISSET(lsm_tree->chunk[end_chunk], WT_LSM_CHUNK_MERGING)))
((chunk = lsm_tree->chunk[end_chunk]) == NULL ||
!F_ISSET_ATOMIC(chunk, WT_LSM_CHUNK_BLOOM) ||
F_ISSET_ATOMIC(chunk, WT_LSM_CHUNK_MERGING)))
--end_chunk;
/*
@@ -140,7 +141,7 @@ __wt_lsm_merge(
nchunks = (end_chunk + 1) - start_chunk;
/* If the chunk is already involved in a merge, stop. */
if (F_ISSET(chunk, WT_LSM_CHUNK_MERGING))
if (F_ISSET_ATOMIC(chunk, WT_LSM_CHUNK_MERGING))
break;
/*
@@ -171,12 +172,12 @@ __wt_lsm_merge(
break;
}
F_SET(chunk, WT_LSM_CHUNK_MERGING);
F_SET_ATOMIC(chunk, WT_LSM_CHUNK_MERGING);
record_count += chunk->count;
--start_chunk;
if (nchunks == lsm_tree->merge_max) {
F_CLR(youngest, WT_LSM_CHUNK_MERGING);
F_CLR_ATOMIC(youngest, WT_LSM_CHUNK_MERGING);
record_count -= youngest->count;
chunk_size -= youngest->size;
--end_chunk;
@@ -199,7 +200,7 @@ __wt_lsm_merge(
chunk->generation >
youngest->generation + max_generation_gap) {
for (i = 0; i < nchunks; i++)
F_CLR(lsm_tree->chunk[start_chunk + i],
F_CLR_ATOMIC(lsm_tree->chunk[start_chunk + i],
WT_LSM_CHUNK_MERGING);
nchunks = 0;
}
@@ -353,10 +354,10 @@ __wt_lsm_merge(
session, lsm_tree, start_chunk, nchunks, chunk);
if (create_bloom)
F_SET(chunk, WT_LSM_CHUNK_BLOOM);
F_SET_ATOMIC(chunk, WT_LSM_CHUNK_BLOOM);
chunk->count = insert_count;
chunk->generation = generation;
F_SET(chunk, WT_LSM_CHUNK_ONDISK);
F_SET_ATOMIC(chunk, WT_LSM_CHUNK_ONDISK);
ret = __wt_lsm_meta_write(session, lsm_tree);
lsm_tree->dsk_gen++;

View File

@@ -100,7 +100,8 @@ __wt_lsm_meta_read(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree)
lsm_tree, chunk->id, &buf));
chunk->uri =
__wt_buf_steal(session, &buf, NULL);
F_SET(chunk, WT_LSM_CHUNK_EVICTED |
F_SET_ATOMIC(chunk,
WT_LSM_CHUNK_EVICTED |
WT_LSM_CHUNK_ONDISK |
WT_LSM_CHUNK_STABLE);
} else if (WT_STRING_MATCH(
@@ -109,7 +110,7 @@ __wt_lsm_meta_read(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree)
lsm_tree, chunk->id, &buf));
chunk->bloom_uri =
__wt_buf_steal(session, &buf, NULL);
F_SET(chunk, WT_LSM_CHUNK_BLOOM);
F_SET_ATOMIC(chunk, WT_LSM_CHUNK_BLOOM);
continue;
} else if (WT_STRING_MATCH(
"chunk_size", lk.str, lk.len)) {
@@ -134,7 +135,7 @@ __wt_lsm_meta_read(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree)
if (WT_STRING_MATCH("bloom", lk.str, lk.len)) {
WT_ERR(__wt_strndup(session,
lv.str, lv.len, &chunk->bloom_uri));
F_SET(chunk, WT_LSM_CHUNK_BLOOM);
F_SET_ATOMIC(chunk, WT_LSM_CHUNK_BLOOM);
continue;
}
WT_ERR(__wt_realloc_def(session,
@@ -144,7 +145,7 @@ __wt_lsm_meta_read(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree)
lsm_tree->old_chunks[nchunks++] = chunk;
WT_ERR(__wt_strndup(session,
lk.str, lk.len, &chunk->uri));
F_SET(chunk, WT_LSM_CHUNK_ONDISK);
F_SET_ATOMIC(chunk, WT_LSM_CHUNK_ONDISK);
}
WT_ERR_NOTFOUND_OK(ret);
lsm_tree->nold_chunks = nchunks;
@@ -199,7 +200,7 @@ __wt_lsm_meta_write(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree)
if (i > 0)
WT_ERR(__wt_buf_catfmt(session, buf, ","));
WT_ERR(__wt_buf_catfmt(session, buf, "id=%" PRIu32, chunk->id));
if (F_ISSET(chunk, WT_LSM_CHUNK_BLOOM))
if (F_ISSET_ATOMIC(chunk, WT_LSM_CHUNK_BLOOM))
WT_ERR(__wt_buf_catfmt(session, buf, ",bloom"));
if (chunk->size != 0)
WT_ERR(__wt_buf_catfmt(session, buf,
@@ -221,7 +222,7 @@ __wt_lsm_meta_write(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree)
else
WT_ERR(__wt_buf_catfmt(session, buf, ","));
WT_ERR(__wt_buf_catfmt(session, buf, "\"%s\"", chunk->uri));
if (F_ISSET(chunk, WT_LSM_CHUNK_BLOOM))
if (F_ISSET_ATOMIC(chunk, WT_LSM_CHUNK_BLOOM))
WT_ERR(__wt_buf_catfmt(
session, buf, ",bloom=\"%s\"", chunk->bloom_uri));
}

View File

@@ -71,9 +71,10 @@ __lsm_stat_init(WT_SESSION_IMPL *session, const char *uri, WT_CURSOR_STAT *cst)
WT_ERR(__wt_buf_fmt(
session, uribuf, "statistics:%s", chunk->uri));
ret = __wt_curstat_open(session, uribuf->data,
F_ISSET(chunk, WT_LSM_CHUNK_ONDISK) ? disk_cfg : cfg,
F_ISSET_ATOMIC(chunk, WT_LSM_CHUNK_ONDISK) ? disk_cfg : cfg,
&stat_cursor);
if (ret == WT_NOTFOUND && F_ISSET(chunk, WT_LSM_CHUNK_ONDISK))
if (ret == WT_NOTFOUND &&
F_ISSET_ATOMIC(chunk, WT_LSM_CHUNK_ONDISK))
ret = __wt_curstat_open(
session, uribuf->data, cfg, &stat_cursor);
WT_ERR(ret);
@@ -97,7 +98,7 @@ __lsm_stat_init(WT_SESSION_IMPL *session, const char *uri, WT_CURSOR_STAT *cst)
__wt_stat_aggregate_dsrc_stats(new, stats);
WT_ERR(stat_cursor->close(stat_cursor));
if (!F_ISSET(chunk, WT_LSM_CHUNK_BLOOM))
if (!F_ISSET_ATOMIC(chunk, WT_LSM_CHUNK_BLOOM))
continue;
/* Maintain a count of bloom filters. */

View File

@@ -587,11 +587,11 @@ __wt_lsm_tree_throttle(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree)
for (i = in_memory = 0, cp = lsm_tree->chunk + lsm_tree->nchunks - 1;
i < lsm_tree->nchunks;
++i, --cp)
if (!F_ISSET(*cp, WT_LSM_CHUNK_ONDISK)) {
if (!F_ISSET_ATOMIC(*cp, WT_LSM_CHUNK_ONDISK)) {
record_count += (*cp)->count;
++in_memory;
} else if ((*cp)->generation == 0 ||
F_ISSET(*cp, WT_LSM_CHUNK_STABLE))
F_ISSET_ATOMIC(*cp, WT_LSM_CHUNK_STABLE))
break;
chunk = lsm_tree->chunk[lsm_tree->nchunks - 1];
@@ -599,7 +599,7 @@ __wt_lsm_tree_throttle(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree)
if (!F_ISSET(lsm_tree, WT_LSM_TREE_THROTTLE) || in_memory <= 3)
lsm_tree->throttle_sleep = 0;
else if (i == lsm_tree->nchunks ||
F_ISSET(*cp, WT_LSM_CHUNK_STABLE)) {
F_ISSET_ATOMIC(*cp, WT_LSM_CHUNK_STABLE)) {
/*
* No checkpoint has completed this run. Keep slowing down
* inserts until one does.
@@ -635,7 +635,8 @@ __wt_lsm_tree_throttle(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree)
* period, we can calculate a crazy value.
*/
if (in_memory > 1 &&
i != lsm_tree->nchunks && !F_ISSET(*cp, WT_LSM_CHUNK_STABLE)) {
i != lsm_tree->nchunks &&
!F_ISSET_ATOMIC(*cp, WT_LSM_CHUNK_STABLE)) {
prev_chunk = lsm_tree->chunk[lsm_tree->nchunks - 2];
WT_ASSERT(session, prev_chunk->generation == 0);
WT_ASSERT(session,
@@ -669,7 +670,8 @@ __wt_lsm_tree_switch(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree)
* for a lock.
*/
if ((nchunks = lsm_tree->nchunks) != 0 &&
!F_ISSET(lsm_tree->chunk[nchunks - 1], WT_LSM_CHUNK_ONDISK) &&
(chunk = lsm_tree->chunk[nchunks - 1]) != NULL &&
!F_ISSET_ATOMIC(chunk, WT_LSM_CHUNK_ONDISK) &&
!F_ISSET(lsm_tree, WT_LSM_TREE_NEED_SWITCH))
goto err;
@@ -732,7 +734,7 @@ __wt_lsm_tree_drop(
for (i = 0; i < lsm_tree->nchunks; i++) {
chunk = lsm_tree->chunk[i];
WT_ERR(__wt_schema_drop(session, chunk->uri, cfg));
if (F_ISSET(chunk, WT_LSM_CHUNK_BLOOM))
if (F_ISSET_ATOMIC(chunk, WT_LSM_CHUNK_BLOOM))
WT_ERR(
__wt_schema_drop(session, chunk->bloom_uri, cfg));
}
@@ -742,7 +744,7 @@ __wt_lsm_tree_drop(
if ((chunk = lsm_tree->old_chunks[i]) == NULL)
continue;
WT_ERR(__wt_schema_drop(session, chunk->uri, cfg));
if (F_ISSET(chunk, WT_LSM_CHUNK_BLOOM))
if (F_ISSET_ATOMIC(chunk, WT_LSM_CHUNK_BLOOM))
WT_ERR(
__wt_schema_drop(session, chunk->bloom_uri, cfg));
}
@@ -802,13 +804,13 @@ __wt_lsm_tree_rename(WT_SESSION_IMPL *session,
WT_ERR(__wt_schema_rename(session, old, chunk->uri, cfg));
__wt_free(session, old);
if (F_ISSET(chunk, WT_LSM_CHUNK_BLOOM)) {
if (F_ISSET_ATOMIC(chunk, WT_LSM_CHUNK_BLOOM)) {
old = chunk->bloom_uri;
chunk->bloom_uri = NULL;
WT_ERR(__wt_lsm_tree_bloom_name(
session, lsm_tree, chunk->id, &buf));
chunk->bloom_uri = __wt_buf_steal(session, &buf, NULL);
F_SET(chunk, WT_LSM_CHUNK_BLOOM);
F_SET_ATOMIC(chunk, WT_LSM_CHUNK_BLOOM);
WT_ERR(__wt_schema_rename(
session, old, chunk->uri, cfg));
__wt_free(session, old);
@@ -931,17 +933,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 +988,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 +998,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
@@ -999,12 +1008,12 @@ __wt_lsm_tree_worker(WT_SESSION_IMPL *session,
for (i = 0; i < lsm_tree->nchunks; i++) {
chunk = lsm_tree->chunk[i];
if (file_func == __wt_checkpoint &&
F_ISSET(chunk, WT_LSM_CHUNK_ONDISK))
F_ISSET_ATOMIC(chunk, WT_LSM_CHUNK_ONDISK))
continue;
WT_ERR(__wt_schema_worker(session, chunk->uri,
file_func, name_func, cfg, open_flags));
if (name_func == __wt_backup_list_uri_append &&
F_ISSET(chunk, WT_LSM_CHUNK_BLOOM))
F_ISSET_ATOMIC(chunk, WT_LSM_CHUNK_BLOOM))
WT_ERR(__wt_schema_worker(session, chunk->bloom_uri,
file_func, name_func, cfg, open_flags));
}

View File

@@ -204,8 +204,9 @@ __lsm_bloom_work(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree)
* Skip if a thread is still active in the chunk or it
* isn't suitable.
*/
if (!F_ISSET(chunk, WT_LSM_CHUNK_ONDISK) ||
F_ISSET(chunk, WT_LSM_CHUNK_BLOOM | WT_LSM_CHUNK_MERGING) ||
if (!F_ISSET_ATOMIC(chunk, WT_LSM_CHUNK_ONDISK) ||
F_ISSET_ATOMIC(chunk,
WT_LSM_CHUNK_BLOOM | WT_LSM_CHUNK_MERGING) ||
chunk->generation > 0 ||
chunk->count == 0)
continue;
@@ -275,13 +276,14 @@ __wt_lsm_checkpoint_worker(void *arg)
* is also evicted. Either way, there is no point
* trying to checkpoint it again.
*/
if (F_ISSET(chunk, WT_LSM_CHUNK_ONDISK)) {
if (F_ISSET(chunk, WT_LSM_CHUNK_EVICTED))
if (F_ISSET_ATOMIC(chunk, WT_LSM_CHUNK_ONDISK)) {
if (F_ISSET_ATOMIC(chunk, WT_LSM_CHUNK_EVICTED))
continue;
if ((ret = __lsm_discard_handle(
session, chunk->uri, NULL)) == 0)
F_SET(chunk, WT_LSM_CHUNK_EVICTED);
F_SET_ATOMIC(
chunk, WT_LSM_CHUNK_EVICTED);
else if (ret == EBUSY)
ret = 0;
else
@@ -367,7 +369,7 @@ __wt_lsm_checkpoint_worker(void *arg)
++j;
WT_ERR(__wt_lsm_tree_lock(session, lsm_tree, 1));
F_SET(chunk, WT_LSM_CHUNK_ONDISK);
F_SET_ATOMIC(chunk, WT_LSM_CHUNK_ONDISK);
ret = __wt_lsm_meta_write(session, lsm_tree);
++lsm_tree->dsk_gen;
@@ -483,7 +485,7 @@ __lsm_bloom_create(WT_SESSION_IMPL *session,
/* Ensure the bloom filter is in the metadata. */
WT_ERR(__wt_lsm_tree_lock(session, lsm_tree, 1));
F_SET(chunk, WT_LSM_CHUNK_BLOOM);
F_SET_ATOMIC(chunk, WT_LSM_CHUNK_BLOOM);
ret = __wt_lsm_meta_write(session, lsm_tree);
++lsm_tree->dsk_gen;
WT_TRET(__wt_lsm_tree_unlock(session, lsm_tree));
@@ -606,7 +608,7 @@ __lsm_free_chunks(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree)
continue;
}
if (F_ISSET(chunk, WT_LSM_CHUNK_BLOOM)) {
if (F_ISSET_ATOMIC(chunk, WT_LSM_CHUNK_BLOOM)) {
/*
* An EBUSY return is acceptable - a cursor may still
* be positioned on this old chunk.
@@ -621,7 +623,7 @@ __lsm_free_chunks(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree)
} else
WT_ERR(ret);
F_CLR(chunk, WT_LSM_CHUNK_BLOOM);
F_CLR_ATOMIC(chunk, WT_LSM_CHUNK_BLOOM);
}
if (chunk->uri != NULL) {
/*

View File

@@ -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;

View File

@@ -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. Skip over 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);
@@ -232,5 +234,4 @@ __wt_session_compact(
err: session->compact = NULL;
API_END_NOTFOUND_MAP(session, ret);
return (ret);
}