Compare commits

..

12 Commits
1.2.0 ... 1.2.1

Author SHA1 Message Date
Michael Cahill
110ba1f941 Bump version to 1.2.1. 2012-06-15 17:34:30 +10:00
Michael Cahill
eb06033573 Allocate "desc" buffers in heap memory so that they are correctly aligned. 2011-12-23 10:57:57 +11:00
Michael Cahill
97fd6ca26e Avoid a deadlock between eviction and checkpoint on the connection spinlock. 2012-06-08 13:56:24 +10:00
Keith Bostic
c6103a38b1 Initialize the snapshot-avail list after cleaning it out, else we'll try and
print a NULL pointer in VERBOSE mode.
2012-06-06 11:26:09 -04:00
Keith Bostic
a6883cdb29 The nlpo2 and ispo2 functions came from net postings, put the files into
the public domain so nobody complains.
2012-06-05 10:41:29 +00:00
Keith Bostic
f48952d2bd Add an upgrading page.
Make the main page capitalization consistent
2012-06-05 10:02:44 +00:00
Keith Bostic
697f5c48b4 lint (unused variable) 2012-06-05 09:46:05 +00:00
Keith Bostic
18bf130f25 __wt_block_off_remove_overlap() allocates memory and so can fail in
"interesting" ways, don't ignore its error return.
2012-06-05 09:13:58 -04:00
Keith Bostic
f5910ecb2f fix comment typo 2012-06-05 09:04:42 -04:00
Keith Bostic
6564203c37 Minor re-work of extent lists (no real change, just associate better
logical names with them); write explicit init/free functions for the
extent lists.

Fix bug where snapshot_avail extent list didn't have a name at all,
we attempted to print a NULL in VERBOSE mode.
2012-06-05 09:01:28 -04:00
Keith Bostic
b5ea6f767f Merge the verbose write-offset/cksum information with the page-type
information.
2012-06-05 09:01:28 -04:00
Michael Cahill
97cb94c0cc Added tag 1.2.0 for changeset 12cf1d5546df 2012-06-04 17:02:49 +10:00
19 changed files with 192 additions and 85 deletions

View File

@@ -7,3 +7,4 @@
a792d468bedd7b37be9cfff545582ae8ff54ff6f 1.1.3
8054de4cb42988cd54b395cc834a6f8ab25298f7 1.1.4
ef844093bec2ac38945fd04487dc3a051f4b9136 1.1.5
12cf1d5546df25ac323f0400d4764e67ad5802e2 1.2.0

14
NEWS
View File

@@ -1,3 +1,17 @@
WiredTiger release 1.2.1, 2012-06-15
------------------------------------
This is a bugfix release. The changes are as follows:
* Avoid a deadlock between eviction and checkpoint on the connection spinlock.
* Allocate "desc" buffers in heap memory so that they are correctly aligned
(fixes direct_io support on Linux).
* Initialize the snapshot-avail list after cleaning it out, else we'll try and
print a NULL pointer in VERBOSE mode.
WiredTiger release 1.2.0, 2012-06-04
------------------------------------

4
README
View File

@@ -1,6 +1,6 @@
WiredTiger 1.2.0: (June 4, 2012)
WiredTiger 1.2.1: (June 15, 2012)
This is version 1.2.0 of WiredTiger.
This is version 1.2.1 of WiredTiger.
WiredTiger documentation can be found at:

View File

@@ -2,8 +2,8 @@ dnl build by dist/s_version
VERSION_MAJOR=1
VERSION_MINOR=2
VERSION_PATCH=0
VERSION_STRING='"WiredTiger 1.2.0: (June 4, 2012)"'
VERSION_PATCH=1
VERSION_STRING='"WiredTiger 1.2.1: (June 15, 2012)"'
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
1.2.0
1.2.1

2
dist/RELEASE vendored
View File

@@ -1,6 +1,6 @@
WIREDTIGER_VERSION_MAJOR=1
WIREDTIGER_VERSION_MINOR=2
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

@@ -397,8 +397,8 @@ __wt_block_extend(
fh = block->fh;
/*
* Callers of this function are expected to be holding any locks
* required to extend the file.
* Callers of this function are expected to have already acquired any
* locks required to extend the file.
*
* We should never be allocating from an empty file.
*/
@@ -464,24 +464,26 @@ int
__wt_block_off_free(
WT_SESSION_IMPL *session, WT_BLOCK *block, off_t off, off_t size)
{
WT_EXTLIST *el;
WT_DECL_RET;
/*
* Callers of this function are expected to be holding any locks
* required to manipulate the extent lists.
* Callers of this function are expected to have already acquired any
* locks required to manipulate the extent lists.
*
* We can reuse this extent immediately if it was allocated during this
* snapshot, merge it into the avail list (which slows file growth in
* snapshot, merge it into the avail list (which slows file growth in
* workloads including repeated overflow record modification). If this
* extent is referenced in a previous snapshot, merge into the discard
* list.
*/
el = __wt_block_off_remove_overlap(
session, &block->live.alloc, off, size) == 0 ?
&block->live.avail : &block->live.discard;
WT_RET(__block_merge(session, el, off, (off_t)size));
return (0);
if ((ret = __wt_block_off_remove_overlap(
session, &block->live.alloc, off, size)) == 0)
ret = __block_merge(
session, &block->live.avail, off, (off_t)size);
else if (ret == WT_NOTFOUND)
ret = __block_merge(
session, &block->live.discard, off, (off_t)size);
return (ret);
}
#ifdef HAVE_DIAGNOSTIC
@@ -771,15 +773,15 @@ __wt_block_insert_ext(
WT_SESSION_IMPL *session, WT_EXTLIST *el, off_t off, off_t size)
{
/*
* There are currently two copies of this function (this code is a
* one-liner that calls the internal version of the function, which
* means the compiler should compress out the function call). It's
* that way because the interface is still fluid, I'm not convinced
* there won't be a need for a functional split between the internal
* and external versions in the future.
* There are currently two copies of this function (this code is a one-
* liner that calls the internal version of the function, which means
* the compiler should compress out the function call). It's that way
* because the interface is still fluid, I'm not convinced there won't
* be a need for a functional split between the internal and external
* versions in the future.
*
* Callers of this function are expected to be holding any locks
* required to manipulate the extent list.
* Callers of this function are expected to have already acquired any
* locks required to manipulate the extent list.
*/
return (__block_merge(session, el, off, size));
}
@@ -1052,6 +1054,25 @@ __wt_block_extlist_truncate(
return (0);
}
/*
* __wt_block_extlist_init --
* Initialize an extent list.
*/
int
__wt_block_extlist_init(WT_SESSION_IMPL *session,
WT_EXTLIST *el, const char *name, const char *extname)
{
char buf[128];
(void)snprintf(buf, sizeof(buf), "%s.%s",
name == NULL ? "" : name, extname == NULL ? "" : extname);
WT_RET(__wt_strdup(session, buf, &el->name));
el->offset = WT_BLOCK_INVALID_OFFSET;
return (0);
}
/*
* __wt_block_extlist_free --
* Discard an extent list.
@@ -1062,19 +1083,19 @@ __wt_block_extlist_free(WT_SESSION_IMPL *session, WT_EXTLIST *el)
WT_EXT *ext, *next;
WT_SIZE *szp, *nszp;
__wt_free(session, el->name);
for (ext = el->off[0]; ext != NULL; ext = next) {
next = ext->next[0];
__wt_free(session, ext);
}
memset(el->off, 0, sizeof(el->off));
for (szp = el->sz[0]; szp != NULL; szp = nszp) {
nszp = szp->next[0];
__wt_free(session, szp);
}
memset(el->sz, 0, sizeof(el->sz));
el->bytes = 0;
el->entries = 0;
/* Extent lists are re-used, clear them. */
memset(el, 0, sizeof(*el));
}
#ifdef HAVE_VERBOSE

View File

@@ -165,10 +165,14 @@ int
__wt_desc_init(WT_SESSION_IMPL *session, WT_FH *fh)
{
WT_BLOCK_DESC *desc;
uint8_t buf[WT_BLOCK_DESC_SECTOR];
WT_DECL_RET;
WT_ITEM *buf;
memset(buf, 0, sizeof(buf));
desc = (void *)buf;
/* Use a scratch buffer to get correct alignment for direct I/O. */
WT_RET(__wt_scr_alloc(session, WT_BLOCK_DESC_SECTOR, &buf));
memset(buf->mem, 0, WT_BLOCK_DESC_SECTOR);
desc = buf->mem;
desc->magic = WT_BLOCK_MAGIC;
desc->majorv = WT_BLOCK_MAJOR_VERSION;
desc->minorv = WT_BLOCK_MINOR_VERSION;
@@ -177,7 +181,10 @@ __wt_desc_init(WT_SESSION_IMPL *session, WT_FH *fh)
desc->cksum = 0;
desc->cksum = __wt_cksum(desc, WT_BLOCK_DESC_SECTOR);
return (__wt_write(session, fh, (off_t)0, WT_BLOCK_DESC_SECTOR, desc));
ret = __wt_write(session, fh, (off_t)0, WT_BLOCK_DESC_SECTOR, desc);
__wt_scr_free(&buf);
return (ret);
}
/*
@@ -188,16 +195,19 @@ static int
__desc_read(WT_SESSION_IMPL *session, WT_BLOCK *block)
{
WT_BLOCK_DESC *desc;
WT_DECL_RET;
WT_ITEM *buf;
uint32_t cksum;
uint8_t buf[WT_BLOCK_DESC_SECTOR];
/* Use a scratch buffer to get correct alignment for direct I/O. */
WT_RET(__wt_scr_alloc(session, WT_BLOCK_DESC_SECTOR, &buf));
/* Read the first sector and verify the file's format. */
memset(buf, 0, sizeof(buf));
WT_RET(__wt_read(
session, block->fh, (off_t)0, WT_BLOCK_DESC_SECTOR, buf));
WT_ERR(__wt_read(
session, block->fh, (off_t)0, WT_BLOCK_DESC_SECTOR, buf->mem));
desc = (void *)buf;
WT_VERBOSE_RET(session, block,
desc = buf->mem;
WT_VERBOSE_ERR(session, block,
"open: magic %" PRIu32
", major/minor: %" PRIu32 "/%" PRIu32
", checksum %#" PRIx32,
@@ -218,16 +228,17 @@ __desc_read(WT_SESSION_IMPL *session, WT_BLOCK *block)
desc->cksum = 0;
if (desc->magic != WT_BLOCK_MAGIC ||
cksum != __wt_cksum(desc, WT_BLOCK_DESC_SECTOR))
WT_RET_MSG(session, WT_ERROR,
WT_ERR_MSG(session, WT_ERROR,
"%s does not appear to be a WiredTiger file", block->name);
if (desc->majorv > WT_BLOCK_MAJOR_VERSION ||
(desc->majorv == WT_BLOCK_MAJOR_VERSION &&
desc->minorv > WT_BLOCK_MINOR_VERSION))
WT_RET_MSG(session, WT_ERROR,
WT_ERR_MSG(session, WT_ERROR,
"%s is an unsupported version of a WiredTiger file",
block->name);
err: __wt_scr_free(&buf);
return (0);
}

View File

@@ -24,7 +24,7 @@ __wt_block_salvage_start(WT_SESSION_IMPL *session, WT_BLOCK *block)
* Salvage creates a new snapshot when it's finished, set up for
* rolling an empty file forward.
*/
WT_RET(__wt_block_snap_init(session, block, &block->live, 1));
WT_RET(__wt_block_snap_init(session, block, &block->live, "live", 1));
/*
* Truncate the file to an initial sector plus N allocation size

View File

@@ -19,7 +19,7 @@ static int __snapshot_update(WT_SESSION_IMPL *,
*/
int
__wt_block_snap_init(WT_SESSION_IMPL *session,
WT_BLOCK *block, WT_BLOCK_SNAPSHOT *si, int is_live)
WT_BLOCK *block, WT_BLOCK_SNAPSHOT *si, const char *name, int is_live)
{
WT_DECL_RET;
@@ -43,16 +43,13 @@ __wt_block_snap_init(WT_SESSION_IMPL *session,
si->root_offset = WT_BLOCK_INVALID_OFFSET;
si->alloc.name = "alloc";
si->alloc.offset = WT_BLOCK_INVALID_OFFSET;
si->avail.name = "avail";
si->avail.offset = WT_BLOCK_INVALID_OFFSET;
si->discard.name = "discard";
si->discard.offset = WT_BLOCK_INVALID_OFFSET;
WT_RET(__wt_block_extlist_init(session, &si->alloc, name, "alloc"));
WT_RET(__wt_block_extlist_init(session, &si->avail, name, "avail"));
WT_RET(__wt_block_extlist_init(session, &si->discard, name, "discard"));
si->file_size = WT_BLOCK_DESC_SECTOR;
WT_RET(__wt_block_extlist_init(
session, &si->snapshot_avail, name, "snapshot_avail"));
return (0);
}
@@ -80,7 +77,7 @@ __wt_block_snapshot_load(WT_SESSION_IMPL *session,
dsk->size = 0;
si = &block->live;
WT_RET(__wt_block_snap_init(session, block, si, 1));
WT_RET(__wt_block_snap_init(session, block, si, "live", 1));
if (WT_VERBOSE_ISSET(session, snapshot)) {
if (addr != NULL) {
@@ -163,18 +160,27 @@ __wt_block_snapshot_unload(WT_SESSION_IMPL *session, WT_BLOCK *block)
if (block->verify)
WT_TRET(__wt_verify_snap_unload(session, block, si));
/* Discard the extent lists. */
__wt_block_extlist_free(session, &si->alloc);
__wt_block_extlist_free(session, &si->avail);
__wt_block_extlist_free(session, &si->discard);
__wt_block_extlist_free(session, &si->snapshot_avail);
__wt_block_snap_destroy(session, si);
block->live_load = 0;
return (ret);
}
/*
* __wt_block_snap_destroy --
* Clear a snapshot structure.
*/
void
__wt_block_snap_destroy(WT_SESSION_IMPL *session, WT_BLOCK_SNAPSHOT *si)
{
/* Discard the extent lists. */
__wt_block_extlist_free(session, &si->alloc);
__wt_block_extlist_free(session, &si->avail);
__wt_block_extlist_free(session, &si->discard);
__wt_block_extlist_free(session, &si->snapshot_avail);
}
/*
* __wt_block_snapshot --
* Create a new snapshot.
@@ -267,8 +273,15 @@ __snapshot_process(
* but there's no explicit "free the snapshot information" call into the
* block manager; if there was an error in an upper level resulting in
* the snapshot never being "resolved", the list might not be empty.
*
* XXX
* This isn't sufficient, actually: we're going to leak all the blocks
* that were written as part of the last snapshot because it was never
* resolved.
*/
__wt_block_extlist_free(session, &si->snapshot_avail);
WT_RET(__wt_block_extlist_init(
session, &si->snapshot_avail, "live", "snapshot_avail"));
/*
* To delete a snapshot, we'll need snapshot information for it, and we
@@ -309,7 +322,7 @@ __snapshot_process(
WT_ERR(__wt_calloc(
session, 1, sizeof(WT_BLOCK_SNAPSHOT), &snap->bpriv));
si = snap->bpriv;
WT_ERR(__wt_block_snap_init(session, block, si, 0));
WT_ERR(__wt_block_snap_init(session, block, si, snap->name, 0));
WT_ERR(__wt_block_buffer_to_snapshot(
session, block, snap->raw.data, si));
WT_ERR(__wt_block_extlist_read(session, block, &si->alloc));
@@ -467,11 +480,14 @@ live_update:
}
/*
* Discard the live system's alloc and discard extent lists, leave the
* Reset the live system's alloc and discard extent lists, leave the
* avail list alone.
*/
__wt_block_extlist_free(session, &si->alloc);
WT_ERR(__wt_block_extlist_init(session, &si->alloc, "live", "alloc"));
__wt_block_extlist_free(session, &si->discard);
WT_ERR(
__wt_block_extlist_init(session, &si->discard, "live", "discard"));
#ifdef HAVE_DIAGNOSTIC
/*
@@ -638,7 +654,7 @@ __snapshot_string(WT_SESSION_IMPL *session,
/* Initialize the snapshot, crack the cookie. */
si = &_si;
WT_RET(__wt_block_snap_init(session, block, si, 0));
WT_RET(__wt_block_snap_init(session, block, si, "string", 0));
WT_RET(__wt_block_buffer_to_snapshot(session, block, addr, si));
WT_RET(__wt_buf_fmt(session, buf,

View File

@@ -32,10 +32,6 @@ __wt_block_verify_start(
{
off_t file_size;
memset(&block->verify_alloc, 0, sizeof(block->verify_alloc));
block->verify_alloc.name = "verify_alloc";
block->verify_alloc.offset = WT_BLOCK_INVALID_OFFSET;
/*
* We're done if the file has no data pages (this happens if we verify
* a file immediately after creation).
@@ -80,6 +76,13 @@ __wt_block_verify_start(
block->frags = (uint32_t)(file_size / block->allocsize);
WT_RET(__bit_alloc(session, block->frags, &block->fragfile));
/*
* We maintain an allocation list that is rolled forward through the
* set of snapshots.
*/
WT_RET(__wt_block_extlist_init(
session, &block->verify_alloc, "verify", "alloc"));
/*
* The only snapshot avail list we care about is the last one written;
* get it now and initialize the list of file fragments.
@@ -160,20 +163,20 @@ __verify_start_avail(
--snap;
si = &_si;
WT_RET(__wt_block_snap_init(session, block, si, 0));
WT_RET(__wt_block_buffer_to_snapshot(
session, block, snap->raw.data, si));
WT_RET(__wt_block_snap_init(session, block, si, snap->name, 0));
WT_ERR(
__wt_block_buffer_to_snapshot(session, block, snap->raw.data, si));
el = &si->avail;
if (el->offset == WT_BLOCK_INVALID_OFFSET)
return (0);
if (el->offset != WT_BLOCK_INVALID_OFFSET) {
WT_ERR(__wt_block_extlist_read(session, block, el));
WT_EXT_FOREACH(ext, el->off)
if ((ret = __verify_filefrag_add(
session, block, ext->off, ext->size, 1)) != 0)
break;
}
WT_RET(__wt_block_extlist_read(session, block, el));
WT_EXT_FOREACH(ext, el->off)
if ((ret = __verify_filefrag_add(
session, block, ext->off, ext->size, 1)) != 0)
break;
__wt_block_extlist_free(session, el);
err: __wt_block_snap_destroy(session, si);
return (ret);
}

View File

@@ -254,7 +254,8 @@ not_compressed: /*
WT_CSTAT_INCR(session, block_write);
WT_VERBOSE_ERR(session, write,
"off %" PRIuMAX ", size %" PRIu32 ", cksum %" PRIu32,
"%s (off %" PRIuMAX ", size %" PRIu32 ", cksum %" PRIu32 ")",
__wt_page_type_string(dsk->type),
(uintmax_t)offset, align_size, blk->cksum);
*offsetp = offset;

View File

@@ -724,8 +724,12 @@ __evict_walk(WT_SESSION_IMPL *session)
* We hold a spinlock for the entire walk -- it's slow, but (1) how
* often do new files get added or removed to/from the system, and (2)
* it's all in-memory stuff, so it's not that slow.
*
* If the connection spinlock is not available, don't block: another
* thread may be holding it and waiting on eviction (e.g., checkpoint).
*/
__wt_spin_lock(session, &conn->spinlock);
if (__wt_spin_trylock(session, &conn->spinlock) != 0)
return (0);
/*
* Resize the array in which we're tracking pages, as necessary, then
@@ -734,8 +738,8 @@ __evict_walk(WT_SESSION_IMPL *session)
*/
elem = WT_EVICT_WALK_BASE + (conn->btqcnt * WT_EVICT_WALK_PER_TABLE);
if (elem > cache->evict_entries) {
/* Save the offset of the eviction point. */
__wt_spin_lock(session, &cache->evict_lock);
/* Save the offset of the eviction point. */
i = (u_int)(cache->evict_current - cache->evict);
WT_ERR(__wt_realloc(session, &cache->evict_allocated,
elem * sizeof(WT_EVICT_ENTRY), &cache->evict));

View File

@@ -968,7 +968,6 @@ __rec_split_write(
uint8_t addr[WT_BTREE_MAX_ADDR_COOKIE];
dsk = buf->mem;
WT_VERBOSE_RET(session, write, "%s", __wt_page_type_string(dsk->type));
/*
* We always write an additional byte on row-store leaf pages after the

View File

@@ -1,4 +1,4 @@
/*! @page admin Managing a WiredTiger Database
/*! @page admin Managing WiredTiger databases
- @subpage home
- @subpage security

View File

@@ -29,6 +29,8 @@ For more information about using WiredTiger, see:
- @subpage install\n
- @subpage upgrading\n
- @subpage programming\n
- @ref wt "WiredTiger API reference manual"

8
src/docs/upgrading.dox Normal file
View File

@@ -0,0 +1,8 @@
/*! @page upgrading Upgrading WiredTiger applications
@section version13 Version 1.3
- There were no API changes in release 1.3.
- There were no file format changes in release 1.3.
*/

View File

@@ -71,6 +71,10 @@ extern int __wt_block_extlist_write(WT_SESSION_IMPL *session,
extern int __wt_block_extlist_truncate( WT_SESSION_IMPL *session,
WT_BLOCK *block,
WT_EXTLIST *el);
extern int __wt_block_extlist_init(WT_SESSION_IMPL *session,
WT_EXTLIST *el,
const char *name,
const char *extname);
extern void __wt_block_extlist_free(WT_SESSION_IMPL *session, WT_EXTLIST *el);
extern int __wt_block_extlist_dump( WT_SESSION_IMPL *session,
const char *tag,
@@ -166,6 +170,7 @@ extern int __wt_block_salvage_next( WT_SESSION_IMPL *session,
extern int __wt_block_snap_init(WT_SESSION_IMPL *session,
WT_BLOCK *block,
WT_BLOCK_SNAPSHOT *si,
const char *name,
int is_live);
extern int __wt_block_snapshot_load(WT_SESSION_IMPL *session,
WT_BLOCK *block,
@@ -175,6 +180,8 @@ extern int __wt_block_snapshot_load(WT_SESSION_IMPL *session,
int readonly);
extern int __wt_block_snapshot_unload(WT_SESSION_IMPL *session,
WT_BLOCK *block);
extern void __wt_block_snap_destroy(WT_SESSION_IMPL *session,
WT_BLOCK_SNAPSHOT *si);
extern int __wt_block_snapshot(WT_SESSION_IMPL *session,
WT_BLOCK *block,
WT_ITEM *buf,

View File

@@ -1,8 +1,28 @@
/*-
* Copyright (c) 2008-2012 WiredTiger, Inc.
* All rights reserved.
*
* See the file LICENSE for redistribution information.
* This is free and unencumbered software released into the public domain.
*
* Anyone is free to copy, modify, publish, use, compile, sell, or
* distribute this software, either in source code form or as a compiled
* binary, for any purpose, commercial or non-commercial, and by any
* means.
*
* In jurisdictions that recognize copyright laws, the author or authors
* of this software dedicate any and all copyright interest in the
* software to the public domain. We make this dedication for the benefit
* of the public at large and to the detriment of our heirs and
* successors. We intend this dedication to be an overt act of
* relinquishment in perpetuity of all present and future rights to this
* software under copyright law.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
#include "wt_internal.h"