summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKeith Bostic <keith@wiredtiger.com>2013-05-02 11:47:05 -0400
committerKeith Bostic <keith@wiredtiger.com>2013-05-02 11:47:05 -0400
commit9d758a319d51849e8ccfd28dbac34af8a7bea210 (patch)
tree1ab54630a05ddb407687df50ac09fcffde79ece9 /src
parent8c41e1c42e1d928019f8f31a4977edc42a650481 (diff)
parent175a1df994a984faf233803859f5e6661c37884d (diff)
downloadmongo-9d758a319d51849e8ccfd28dbac34af8a7bea210.tar.gz
Merge branch 'develop' into hot-backup-race
Diffstat (limited to 'src')
-rw-r--r--src/btree/bt_evict.c12
-rw-r--r--src/btree/rec_merge.c11
-rw-r--r--src/config/config.c3
-rw-r--r--src/conn/conn_dhandle.c14
-rw-r--r--src/docs/config-strings.dox42
-rw-r--r--src/docs/spell.ok1
-rw-r--r--src/include/btmem.h5
-rw-r--r--src/include/cell.i2
8 files changed, 60 insertions, 30 deletions
diff --git a/src/btree/bt_evict.c b/src/btree/bt_evict.c
index e966ea01ef2..14e4e66add3 100644
--- a/src/btree/bt_evict.c
+++ b/src/btree/bt_evict.c
@@ -1048,11 +1048,17 @@ __evict_walk_file(WT_SESSION_IMPL *session, u_int *slotp, int clean)
/*
* If the oldest transaction hasn't changed since the
- * last time this page was written, there's no chance
- * to make progress...
+ * last time this page was written, it's unlikely that
+ * we can make progress. This is a heuristic that
+ * saves repeated attempts to evict the same page.
+ *
+ * That said, if eviction is stuck, try anyway: maybe a
+ * transaction that were running last time we wrote the
+ * page has since rolled back.
*/
if (modified &&
- TXNID_LE(oldest_txn, page->modify->disk_txn))
+ TXNID_LE(oldest_txn, page->modify->disk_txn) &&
+ !F_ISSET(cache, WT_EVICT_STUCK))
continue;
}
diff --git a/src/btree/rec_merge.c b/src/btree/rec_merge.c
index caac7c77215..79deeb2dfae 100644
--- a/src/btree/rec_merge.c
+++ b/src/btree/rec_merge.c
@@ -340,9 +340,14 @@ __wt_merge_tree(WT_SESSION_IMPL *session, WT_PAGE *top)
if (visit_state.maxdepth < WT_MERGE_STACK_MIN)
return (EBUSY);
- /* Pages cannot grow larger than 2**32, but that should never happen. */
- if (visit_state.refcnt > UINT32_MAX)
- return (ENOMEM);
+ /*
+ * Don't allow split merges to generate arbitrarily large pages.
+ * Ideally we would choose a size based on the internal_page_max
+ * setting for the btree, but we don't have the correct btree handle
+ * available.
+ */
+ if (visit_state.refcnt > WT_MERGE_MAX_REFS)
+ return (EBUSY);
/* Make sure the top page isn't queued for eviction. */
__wt_evict_list_clr_page(session, top);
diff --git a/src/config/config.c b/src/config/config.c
index 0cb7da9ab8a..e28817b89e2 100644
--- a/src/config/config.c
+++ b/src/config/config.c
@@ -109,6 +109,7 @@ typedef enum {
* ['0' ... '9'] = &&l_numbare,
* ['_'] = &&l_bare,
* ['A' ... 'Z'] = &&l_bare, ['a' ... 'z'] = &&l_bare,
+ * ['/'] = &&l_bare,
* };
*/
static const int8_t gostruct[256] = {
@@ -117,7 +118,7 @@ static const int8_t gostruct[256] = {
A_BAD, A_BAD, A_BAD, A_BAD, A_BAD, A_BAD, A_BAD, A_BAD, A_BAD,
A_BAD, A_BAD, A_BAD, A_BAD, A_BAD, A_BAD, A_LOOP, A_BAD, A_QUP,
A_BAD, A_BAD, A_BAD, A_BAD, A_BAD, A_UP, A_DOWN, A_BAD, A_BAD,
- A_NEXT, A_NUMBARE, A_BAD, A_BAD, A_NUMBARE, A_NUMBARE,
+ A_NEXT, A_NUMBARE, A_BAD, A_BARE, A_NUMBARE, A_NUMBARE,
A_NUMBARE, A_NUMBARE, A_NUMBARE, A_NUMBARE, A_NUMBARE,
A_NUMBARE, A_NUMBARE, A_NUMBARE, A_VALUE, A_BAD, A_BAD,
A_VALUE, A_BAD, A_BAD, A_BAD, A_BARE, A_BARE, A_BARE, A_BARE,
diff --git a/src/conn/conn_dhandle.c b/src/conn/conn_dhandle.c
index 54da1f9ed89..b9ab3b65f48 100644
--- a/src/conn/conn_dhandle.c
+++ b/src/conn/conn_dhandle.c
@@ -125,9 +125,15 @@ __conn_dhandle_get(WT_SESSION_IMPL *session,
(ret = __wt_writelock(session, dhandle->rwlock)) == 0) {
F_SET(dhandle, WT_DHANDLE_EXCLUSIVE);
- /* Add to the connection list. */
+ /*
+ * Add the handle to the connection list.
+ *
+ * Put it at the beginning on the basis that we're likely to
+ * need new files again soon until they are cached by all
+ * sessions.
+ */
dhandle->refcnt = 1;
- TAILQ_INSERT_TAIL(&conn->dhqh, dhandle, q);
+ TAILQ_INSERT_HEAD(&conn->dhqh, dhandle, q);
}
if (ret == 0)
@@ -433,12 +439,10 @@ err: session->dhandle = saved_dhandle;
int
__wt_conn_btree_close(WT_SESSION_IMPL *session, int locked)
{
- WT_BTREE *btree;
WT_DATA_HANDLE *dhandle;
WT_DECL_RET;
int inuse;
- btree = S2BT(session);
dhandle = session->dhandle;
WT_ASSERT(session, F_ISSET(session, WT_SESSION_SCHEMA_LOCKED));
@@ -465,7 +469,7 @@ __wt_conn_btree_close(WT_SESSION_IMPL *session, int locked)
* last session (i.e., the default session for the connection).
*/
WT_ASSERT(session,
- btree != session->metafile ||
+ S2BT(session) != session->metafile ||
session == S2C(session)->default_session);
if (F_ISSET(dhandle, WT_DHANDLE_OPEN))
diff --git a/src/docs/config-strings.dox b/src/docs/config-strings.dox
index f31708de93e..542e86f620d 100644
--- a/src/docs/config-strings.dox
+++ b/src/docs/config-strings.dox
@@ -11,6 +11,17 @@ all have the same format:
[key['='value]][','[key['='value]]]*
</pre>
+Keys and values and values that consist of alphanumeric characters can be
+specified directly. More precisely, keys or values that match this regular
+expression do not require quotes:
+
+<pre>
+ [-_0-9A-Za-z/][^\\t\\r\\n :=,\\])}]*
+</pre>
+
+More complex keys and values can be specified by quoting them with double
+quotes.
+
For example, a configuration string is used when opening a connection
to a database to specify if the database should be created and to set
the cache size:
@@ -28,29 +39,24 @@ columns in a table, values are nested using parentheses. For example:
@snippet ex_all.c Create a table with columns
-Values may of type "integer" may have multiplier characters appended to
-them, as follows:
+All types of parentheses are treated equivalently by the parser.
+
+When an integer values is expected, the value may have multiplier characters
+appended, as follows:
<table>
@hrow{Character, Meaning, Change to value}
-@row{\c B, byte, no change}
-@row{\c b, byte, no change}
-@row{\c K, kilobyte, multiply by 2^10}
-@row{\c k, kilobyte, multiply by 2^10}
-@row{\c M, megabyte, multiply by 2^20}
-@row{\c m, megabyte, multiply by 2^20}
-@row{\c G, gigabyte, multiply by 2^30}
-@row{\c g, gigabyte, multiply by 2^30}
-@row{\c T, terabyte, multiply by 2^40}
-@row{\c t, terabyte, multiply by 2^40}
-@row{\c P, petabyte, multiply by 2^50}
-@row{\c p, petabyte, multiply by 2^50}
+@row{\c B or \c b, byte, no change}
+@row{\c K or \c k, kilobyte, multiply by 2^10}
+@row{\c M or \c m, megabyte, multiply by 2^20}
+@row{\c G or \c g, gigabyte, multiply by 2^30}
+@row{\c T or \c t, terabyte, multiply by 2^40}
+@row{\c P or \c p, petabyte, multiply by 2^50}
</table>
-For example, the configuration string \c 500B is the same as entering the
-number \c 500, the string \c 500K is the same as entering the number \c 512000,
-the string \c 500G is the same as entering the number \c 536870912000 and the
-string \c 500T is the same as entering the number \c 549755813888000.
+For example, the value \c 500B is the same as entering the number \c 500, the
+value \c 500K is the same as \c 512000 and the string \c 500GB is the same as
+\c 536870912000.
Values of type of "boolean" can be set to any of \c false, \c true, \c 0 or
\c 1. If no value is specified for a key, the value \c 1 is implied. For
diff --git a/src/docs/spell.ok b/src/docs/spell.ok
index c96f721a892..53ae036d830 100644
--- a/src/docs/spell.ok
+++ b/src/docs/spell.ok
@@ -38,6 +38,7 @@ Vv
WiredTiger
WiredTiger's
WiredTigerCheckpoint
+Za
aR
ack'ed
alloc
diff --git a/src/include/btmem.h b/src/include/btmem.h
index d6b2deb6255..40d1c14ea16 100644
--- a/src/include/btmem.h
+++ b/src/include/btmem.h
@@ -456,9 +456,14 @@ struct __wt_ref {
* WT_MERGE_FULL_PAGE --
* When the result of a merge contains more than this number of keys, it is
* considered "done" and will not be merged again.
+ *
+ * WT_MERGE_MAX_REFS --
+ * Don't complete merges that contain more than this number of keys, they tend
+ * to generate pathological trees.
*/
#define WT_MERGE_STACK_MIN 3
#define WT_MERGE_FULL_PAGE 100
+#define WT_MERGE_MAX_REFS 1000
/*
* WT_ROW --
diff --git a/src/include/cell.i b/src/include/cell.i
index 09c35c4199b..a16db71819d 100644
--- a/src/include/cell.i
+++ b/src/include/cell.i
@@ -455,6 +455,8 @@ __wt_cell_unpack_safe(WT_CELL *cell, WT_CELL_UNPACK *unpack, uint8_t *end)
int copied;
copied = 0;
+ saved_len = 0;
+ saved_v = 0;
/*
* The verification code specifies an end argument, a pointer to 1 past