Compare commits

...

58 Commits

Author SHA1 Message Date
Michael Cahill
5cdd3e320c Merge branch 'mongodb-3.2.3' into mongodb-3.2 2016-02-18 14:00:00 +11:00
Michael Cahill
563b7823f7 Merge pull request #2495 from wiredtiger/wt-2397
WT-2397: Cursor traversal from end of the tree skips records.
(cherry picked from commit d915631b)

Manually resolved conflicts from pull request 2478.
2016-02-17 17:30:39 +11:00
Michael Cahill
5e3a56f0ab Merge pull request #2498 from wiredtiger/server-22676
SERVER-22676 Don't check duplicated create calls for matching configurations
(cherry picked from commit 98d6ce255d)
2016-02-17 17:17:20 +11:00
Michael Cahill
bc929dbcf1 Merge branch 'mongodb-3.4' into mongodb-3.2 2016-02-11 12:05:59 +11:00
Michael Cahill
07966a492a Fixup for merge vs backport. 2016-01-28 12:18:13 +11:00
Michael Cahill
67e412d4c5 Merge branch 'develop' into mongodb-3.2 2016-01-28 09:30:32 +11:00
Alex Gorrod
3c2ad56b50 Merge pull request #2415 from wiredtiger/wt-2307-fix
(cherry picked from commit 12aaeb6)

WT-2307: Fix for cursor iteration bug when pages are splitting
2015-12-29 05:42:26 +11:00
Alex Gorrod
b1768d0d9f Revert "Merge pull request #2394 from wiredtiger/SERVER-21887-sample"
The change wasn't ready for back port into 3.2.1

This reverts commit 21b5f9951e.
2015-12-22 08:15:10 +00:00
Alex Gorrod
2893117baa Revert "WT-2291: error: comparison of array 'ins->next' not equal to a null"
The change isn't ready for back port into 3.2.1

This reverts commit 4380cec93d.
2015-12-22 08:14:38 +00:00
Keith Bostic
4380cec93d WT-2291: error: comparison of array 'ins->next' not equal to a null
pointer is always true [-Werror,-Wtautological-pointer-compare]
2015-12-17 10:48:19 +11:00
Alex Gorrod
21b5f9951e Merge pull request #2394 from wiredtiger/SERVER-21887-sample
WT-2291: fix for sampling in newly created trees.
2015-12-17 10:47:55 +11:00
Keith Bostic
decd9166cc __wt_ref_info() and __ref_is_lef() no longer need a WT_SESSION_IMPL
argument, remove it.
2015-12-16 15:54:52 +11:00
Keith Bostic
d835a0c0a8 gcc47 with [-Werror=maybe-uninitialized] reports we can end up with type
uninitialized in __ref_is_leaf() (based on a call to __wt_ref_info()).
It's not really possible because the path where type isn't set is a path
where we panic because the WT_ADDR structure has an impossible type.

We already ignore the __wt_ref_info() error return in one path, and
there are only two paths that care about the returned type; remove the
error check from __wt_ref_info() and set type to 0 in the failing case
(the same value we use when there's no WT_REF addr to check), the code
that calls this function already checks addr on return.

This simplifies __ref_is_leaf() slightly, it now returns a boolean
instead of an error code with a boolean pointer argument.
2015-12-16 15:29:31 +11:00
Keith Bostic
48e1343e40 Merge pull request #2363 from wiredtiger/WT-2262
WT-2262 Have random sampling walk the tree so it isn't biased in skewed trees.
2015-12-16 15:29:13 +11:00
Michael Cahill
eb838c7f12 Merge pull request #2361 from wiredtiger/wt-2260-dont-evict-internal
WT-2260 Avoid adding internal pages to the eviction queue.
2015-12-16 15:28:52 +11:00
Alex Gorrod
a6957512a4 Merge pull request #2358 from wiredtiger/wt-2258-preload-directio 2015-12-16 15:28:11 +11:00
Michael Cahill
197eef00fd Merge branch 'develop' into mongodb-3.2 2015-12-02 22:58:11 +11:00
Michael Cahill
7a4f3259b4 Merge branch 'develop' into mongodb-3.2 2015-12-01 17:12:04 +11:00
Michael Cahill
8326df6b76 Merge branch 'develop' into mongodb-3.2 2015-11-30 15:02:38 +11:00
Keith Bostic
b65381f64c Merge branch 'develop' into mongodb-3.2 2015-11-24 11:29:41 -05:00
Michael Cahill
0019262fed Merge branch 'develop' into mongodb-3.2 2015-11-24 21:59:04 +11:00
Keith Bostic
4d72349b8a Merge branch 'develop' into mongodb-3.2 2015-11-23 09:00:49 -05:00
Michael Cahill
4898aa408f Merge branch 'develop' into mongodb-3.2 2015-11-20 16:58:33 +11:00
Michael Cahill
9d375e3416 Merge branch 'develop' into mongodb-3.2 2015-11-19 17:18:28 +11:00
Michael Cahill
d9ec1ff8ec Merge branch 'develop' into mongodb-3.2 2015-11-11 16:27:42 +11:00
Keith Bostic
465dca8b46 Merge branch 'develop' into mongodb-3.2 2015-11-03 10:33:14 -05:00
Alex Gorrod
f95877af13 Merge branch 'develop' into mongodb-3.2 2015-11-03 22:18:00 +11:00
Alex Gorrod
62c1a7aa36 Merge branch 'develop' into mongodb-3.2 2015-11-02 03:59:53 +00:00
Michael Cahill
0dc3f20df6 Merge branch 'develop' into mongodb-3.2 2015-11-02 11:43:14 +11:00
Michael Cahill
0537648e03 Merge branch 'develop' into mongodb-3.2 2015-10-09 17:07:24 +11:00
Alex Gorrod
3c856645c8 Merge branch 'develop' into mongodb-3.2 2015-09-30 15:01:57 +10:00
Michael Cahill
10208e8284 Merge branch 'develop' into mongodb-3.2 2015-09-25 15:00:04 +10:00
Michael Cahill
16e3e48d98 Merge branch 'develop' into mongodb-3.2 2015-09-18 12:56:14 +10:00
Michael Cahill
5205bb1f0f Merge branch 'develop' into mongodb-3.2 2015-09-11 16:23:01 +10:00
Michael Cahill
dca63120b7 Merge branch 'develop' into mongodb-3.2 2015-09-11 12:21:49 +10:00
sueloverso
0cccab30c0 WT-2064 Don't spin indefinitely waiting for the handle list lock in eviction
Merge pull request #2155 from wiredtiger/WT-2064

(cherry picked from commit 66757f7247)
2015-08-28 11:48:29 +10:00
Alex Gorrod
578a856c19 Merge pull request #2156 from wiredtiger/WT-2066
WT-2066 - Update the oldest transaction ID from eviction
(cherry picked from commit 8f42f02d3c)
2015-08-28 11:47:56 +10:00
Alex Gorrod
a85c5cda41 Merge pull request #2152 from wiredtiger/WT-2062
WT-2062 Try harder to make progress on in-memory splits
(cherry picked from commit 3e0c7bfa3a)
2015-08-28 11:47:30 +10:00
Michael Cahill
6da2dc175b Merge commit '12044d22cce1a79804254ac9c80b1120701bd7c8' into mongodb-3.2 2015-08-28 11:45:48 +10:00
Michael Cahill
7ffa315e39 Merge branch 'develop' into mongodb-3.2 2015-08-18 10:25:36 +10:00
Michael Cahill
26d1ad271f Merge branch 'develop' into mongodb-3.2 2015-08-12 20:36:04 +10:00
Alex Gorrod
fdedd3621c Merge branch 'develop' into mongodb-3.2 2015-07-23 15:53:52 +10:00
Alex Gorrod
4187f419f8 Merge branch 'develop' into mongodb-3.2 2015-07-23 15:50:57 +10:00
Michael Cahill
42823c9682 Merge branch 'develop' into mongodb-3.2 2015-07-17 22:19:04 +10:00
Alex Gorrod
fbaf1cf4f5 Merge branch 'develop' into mongodb-3.2 2015-06-26 05:09:48 +00:00
Alex Gorrod
3d845c98cb Merge branch 'develop' into mongodb-3.2 2015-06-10 18:54:48 +00:00
Michael Cahill
1d2fe8a145 Merge branch 'develop' into mongodb-3.2 2015-06-09 01:26:55 +10:00
Alex Gorrod
bdaaaec87d Merge branch 'develop' into mongodb-3.2 2015-05-29 00:19:26 +00:00
Michael Cahill
35cc116acd Merge branch 'develop' into mongodb-3.2 2015-05-18 15:02:56 +10:00
Alex Gorrod
cbe0fad3e9 Merge branch 'develop' into mongodb-3.2 2015-05-15 06:07:13 +00:00
Michael Cahill
4f9aa1c548 Merge branch 'develop' into mongodb-3.2 2015-05-08 14:19:20 +10:00
Michael Cahill
1f44c05f91 Merge branch 'develop' into mongodb-3.2 2015-04-27 17:43:11 +10:00
Michael Cahill
e31aa8cf29 Merge branch 'develop' into mongodb-3.2 2015-04-27 17:23:58 +10:00
Michael Cahill
c90bc747e1 Merge branch 'develop' into mongodb-3.2 2015-04-24 17:17:50 +10:00
Alex Gorrod
2c1b7aa80b Update MongoDB changelog with latest merge commits. 2015-04-23 17:28:27 +10:00
Alex Gorrod
41762ae13c Merge branch 'develop' into mongodb-3.2 2015-04-23 17:25:06 +10:00
Alex Gorrod
f7691f63a6 Add long version of commit log to NEWS.MONGODB 2015-04-23 17:21:01 +10:00
Alex Gorrod
9be5497753 Add in MongoDB changelog from 3.0 2015-04-23 11:43:19 +10:00
8 changed files with 2685 additions and 99 deletions

2523
NEWS.MONGODB Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -89,11 +89,11 @@ __ref_is_leaf(WT_REF *ref)
}
/*
* __page_ascend --
* __ref_ascend --
* Ascend the tree one level.
*/
static void
__page_ascend(WT_SESSION_IMPL *session,
static inline void
__ref_ascend(WT_SESSION_IMPL *session,
WT_REF **refp, WT_PAGE_INDEX **pindexp, uint32_t *slotp)
{
WT_REF *parent_ref, *ref;
@@ -163,12 +163,12 @@ __page_ascend(WT_SESSION_IMPL *session,
}
/*
* __page_descend --
* Descend the tree one level.
* __ref_descend_prev --
* Descend the tree one level, during a previous-cursor walk.
*/
static void
__page_descend(WT_SESSION_IMPL *session,
WT_PAGE *page, WT_PAGE_INDEX **pindexp, uint32_t *slotp, bool prev)
static inline void
__ref_descend_prev(
WT_SESSION_IMPL *session, WT_REF *ref, WT_PAGE_INDEX **pindexp)
{
WT_PAGE_INDEX *pindex;
@@ -177,9 +177,6 @@ __page_descend(WT_SESSION_IMPL *session,
* we have a hazard pointer.
*/
for (;; __wt_yield()) {
WT_INTL_INDEX_GET(session, page, pindex);
*slotp = prev ? pindex->entries - 1 : 0;
/*
* There's a split race when a cursor moving backwards through
* the tree descends the tree. If we're splitting an internal
@@ -233,20 +230,40 @@ __page_descend(WT_SESSION_IMPL *session,
* being split and part of its namespace moved. We have the
* correct page and we don't have to move, all we have to do is
* wait until the split page's page index is updated.
*
* No test is necessary for a next-cursor movement because we
* do right-hand splits on internal pages and the initial part
* of the page's namespace won't change as part of a split.
* Instead of testing the direction boolean, do the test the
* previous cursor movement requires in all cases, even though
* it will always succeed for a next-cursor movement.
*/
if (pindex->index[*slotp]->home == page)
WT_INTL_INDEX_GET(session, ref->page, pindex);
if (pindex->index[pindex->entries - 1]->home == ref->page)
break;
}
*pindexp = pindex;
}
/*
* __ref_initial_descent_prev --
* Descend the tree one level, when setting up the initial cursor position
* for a previous-cursor walk.
*/
static inline bool
__ref_initial_descent_prev(
WT_SESSION_IMPL *session, WT_REF *ref, WT_PAGE_INDEX **pindexp)
{
WT_PAGE_INDEX *pindex;
/*
* We're passed a child page into which we're descending, and on which
* we have a hazard pointer.
*
* Acquire a page index for the child page and then confirm we haven't
* raced with a parent split.
*/
WT_INTL_INDEX_GET(session, ref->page, pindex);
if (__wt_split_descent_race(session, ref, *pindexp))
return (false);
*pindexp = pindex;
return (true);
}
/*
* __tree_walk_internal --
* Move to the next/previous page in the tree.
@@ -259,11 +276,12 @@ __tree_walk_internal(WT_SESSION_IMPL *session,
WT_DECL_RET;
WT_PAGE_INDEX *pindex;
WT_REF *couple, *couple_orig, *ref;
bool empty_internal, prev, skip;
bool empty_internal, initial_descent, prev, skip;
uint32_t slot;
btree = S2BT(session);
empty_internal = false;
pindex = NULL;
empty_internal = initial_descent = false;
/*
* Tree walks are special: they look inside page structures that splits
@@ -323,22 +341,30 @@ __tree_walk_internal(WT_SESSION_IMPL *session,
couple = couple_orig = ref = *refp;
*refp = NULL;
/* If no page is active, begin a walk from the start of the tree. */
/* If no page is active, begin a walk from the start/end of the tree. */
if (ref == NULL) {
ref = &btree->root;
restart: /*
* We can reach here with a NULL or root reference; the release
* function handles them internally, don't complicate this code
* by calling them out.
*/
WT_ERR(__wt_page_release(session, couple, flags));
couple = couple_orig = ref = &btree->root;
if (ref->page == NULL)
goto done;
initial_descent = true;
goto descend;
}
/*
* If the active page was the root, we've reached the walk's end.
* Release any hazard-pointer we're holding.
* If the active page was the root, we've reached the walk's end; we
* only get here if we've returned the root to our caller, so we're
* holding no hazard pointers.
*/
if (__wt_ref_is_root(ref)) {
WT_ERR(__wt_page_release(session, couple, flags));
if (__wt_ref_is_root(ref))
goto done;
}
/* Figure out the current slot in the WT_REF array. */
__ref_index_slot(session, ref, &pindex, &slot);
@@ -352,7 +378,7 @@ __tree_walk_internal(WT_SESSION_IMPL *session,
while ((prev && slot == 0) ||
(!prev && slot == pindex->entries - 1)) {
/* Ascend to the parent. */
__page_ascend(session, &ref, &pindex, &slot);
__ref_ascend(session, &ref, &pindex, &slot);
/*
* If we got all the way through an internal page and
@@ -520,17 +546,22 @@ __tree_walk_internal(WT_SESSION_IMPL *session,
if (ret == WT_RESTART) {
ret = 0;
/*
* If a cursor is setting up at the end of the
* tree, we can't use our parent page's index,
* because it may have already split; restart
* the walk.
*/
if (prev && initial_descent)
goto restart;
/*
* If a new walk that never coupled from the
* root to a new saved position in the tree,
* restart the walk.
*/
if (couple == &btree->root) {
ref = &btree->root;
if (ref->page == NULL)
goto done;
goto descend;
}
if (couple == &btree->root)
goto restart;
/*
* If restarting from some original position,
@@ -561,9 +592,55 @@ __tree_walk_internal(WT_SESSION_IMPL *session,
descend: couple = ref;
empty_internal = true;
__page_descend(
session, ref->page, &pindex, &slot, prev);
/*
* There's a split race when a cursor is setting
* up at the end of the tree or moving backwards
* through the tree and descending a level. When
* splitting an internal page into its parent,
* we move the WT_REF structures and update the
* parent's page index before updating the split
* page's page index, and it's not an atomic
* update. A thread can read the parent page's
* replacement page index, then read the split
* page's original index, or the parent page's
* original and the split page's replacement.
*
* This isn't a problem for a cursor setting up
* at the start of the tree or moving forwards
* through the tree because we do right-hand
* splits on internal pages and the initial part
* of the split page's namespace won't change as
* part of a split. A thread reading the parent
* page's and split page's indexes will move to
* the same slot no matter what order of indexes
* are read.
*
* Handle a cursor setting up at the end of the
* tree or moving backwards through the tree.
*/
if (!prev) {
WT_INTL_INDEX_GET(
session, ref->page, pindex);
slot = 0;
} else if (initial_descent) {
if (!__ref_initial_descent_prev(
session, ref, &pindex))
goto restart;
slot = pindex->entries - 1;
} else {
__ref_descend_prev(
session, ref, &pindex);
slot = pindex->entries - 1;
}
} else {
/*
* At the lowest tree level (considering a leaf
* page), turn off the initial-descent state.
* Descent race tests are different when moving
* through the tree vs. the initial descent.
*/
initial_descent = false;
/*
* Optionally skip leaf pages, the second half.
* We didn't have an on-page cell to figure out
@@ -605,7 +682,7 @@ __wt_tree_walk(WT_SESSION_IMPL *session, WT_REF **refp, uint32_t flags)
/*
* __wt_tree_walk_count --
* Move to the next/previous page in the tree, tracking how many
* references were visited to get there.
* references were visited to get there.
*/
int
__wt_tree_walk_count(WT_SESSION_IMPL *session,

View File

@@ -137,12 +137,12 @@ restart_page: page = current->page;
* If on the last slot (the key is larger than any key
* on the page), check for an internal page split race.
*/
if (parent_pindex != NULL &&
__wt_split_intl_race(
session, current->home, parent_pindex)) {
if (__wt_split_descent_race(
session, current, parent_pindex)) {
WT_RET(__wt_page_release(session, current, 0));
goto restart_root;
}
goto descend;
}

View File

@@ -418,9 +418,8 @@ restart_page: page = current->page;
* page), check for an internal page split race.
*/
if (pindex->entries == base) {
append: if (parent_pindex != NULL &&
__wt_split_intl_race(
session, current->home, parent_pindex)) {
append: if (__wt_split_descent_race(
session, current, parent_pindex)) {
if ((ret = __wt_page_release(
session, current, 0)) != 0)
return (ret);

View File

@@ -1293,20 +1293,20 @@ __wt_page_swap_func(
WT_DECL_RET;
bool acquired;
/*
* In rare cases when walking the tree, we try to swap to the same
* page. Fast-path that to avoid thinking about error handling.
*/
if (held == want)
return (0);
/*
* This function is here to simplify the error handling during hazard
* pointer coupling so we never leave a hazard pointer dangling. The
* assumption is we're holding a hazard pointer on "held", and want to
* acquire a hazard pointer on "want", releasing the hazard pointer on
* "held" when we're done.
*
* When walking the tree, we sometimes swap to the same page. Fast-path
* that to avoid thinking about error handling.
*/
if (held == want)
return (0);
/* Get the wanted page. */
ret = __wt_page_in_func(session, want, flags
#ifdef HAVE_DIAGNOSTIC
, file, line
@@ -1446,15 +1446,19 @@ __wt_btree_lsm_over_size(WT_SESSION_IMPL *session, uint64_t maxsize)
}
/*
* __wt_split_intl_race --
* __wt_split_descent_race --
* Return if we raced with an internal page split when descending the tree.
*/
static inline bool
__wt_split_intl_race(
WT_SESSION_IMPL *session, WT_PAGE *parent, WT_PAGE_INDEX *saved_pindex)
__wt_split_descent_race(
WT_SESSION_IMPL *session, WT_REF *ref, WT_PAGE_INDEX *saved_pindex)
{
WT_PAGE_INDEX *pindex;
/* No test when starting the descent (there's no home to check). */
if (__wt_ref_is_root(ref))
return (false);
/*
* A place to hang this comment...
*
@@ -1509,6 +1513,6 @@ __wt_split_intl_race(
* content the split page retains after the split, and we ignore this
* race.
*/
WT_INTL_INDEX_GET(session, parent, pindex);
WT_INTL_INDEX_GET(session, ref->home, pindex);
return (pindex != saved_pindex);
}

View File

@@ -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;
if (!exists) {
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 there is data in the table, fill the index. */
WT_ERR(__fill_index(session, table, idx));
}
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 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));
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));
/* 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 (0) {

View File

@@ -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__':

View File

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