summaryrefslogtreecommitdiff
path: root/test/format/ops.c
diff options
context:
space:
mode:
authorKeith Bostic <keith.bostic@mongodb.com>2016-05-04 19:25:01 -0400
committerAlex Gorrod <alexander.gorrod@mongodb.com>2016-05-05 09:25:01 +1000
commit2437ec597dc0ba6669547c937bb2a89069824e4e (patch)
tree9f203dd83e2275c173733a6474c4ef42f5e229d8 /test/format/ops.c
parent7deb9c213ba5c866d26dd381e20b632f991eedc9 (diff)
downloadmongo-2437ec597dc0ba6669547c937bb2a89069824e4e.tar.gz
WT-2615 Enabling checkpoints in test/format leads to reduced concurrency (#2720)
Don't queue threads for checkpoint operations, just skip the scheduled checkpoint operation if a checkpoint is already in progress. Don't wait for backups to complete if scheduled to do a named checkpoint, do an unnamed checkpoint instead. Fix a bug: we were scheduling named checkpoints 80% of the time instead of the documented 20%; change that number to 5%, named checkpoints aren't worth testing that heavily. Don't bother avoiding scheduling two named checkpoints in a row, it's not worth the effort.
Diffstat (limited to 'test/format/ops.c')
-rw-r--r--test/format/ops.c32
1 files changed, 20 insertions, 12 deletions
diff --git a/test/format/ops.c b/test/format/ops.c
index a336b3c6d50..9275d7f3856 100644
--- a/test/format/ops.c
+++ b/test/format/ops.c
@@ -504,14 +504,25 @@ ops(void *arg)
/* Checkpoint the database. */
if (tinfo->ops == ckpt_op && g.c_checkpoints) {
/*
- * LSM and data-sources don't support named checkpoints,
+ * Checkpoints are single-threaded inside WiredTiger,
+ * skip our checkpoint if another thread is already
+ * doing one.
+ */
+ ret = pthread_rwlock_trywrlock(&g.checkpoint_lock);
+ if (ret == EBUSY)
+ goto skip_checkpoint;
+ testutil_check(ret);
+
+ /*
+ * LSM and data-sources don't support named checkpoints
* and we can't drop a named checkpoint while there's a
- * cursor open on it, otherwise 20% of the time name the
- * checkpoint.
+ * backup in progress, otherwise name the checkpoint 5%
+ * of the time.
*/
- if (DATASOURCE("helium") || DATASOURCE("kvsbdb") ||
- DATASOURCE("lsm") ||
- readonly || mmrand(&tinfo->rnd, 1, 5) == 1)
+ if (mmrand(&tinfo->rnd, 1, 20) != 1 ||
+ DATASOURCE("helium") ||
+ DATASOURCE("kvsbdb") || DATASOURCE("lsm") ||
+ pthread_rwlock_trywrlock(&g.backup_lock) == EBUSY)
ckpt_config = NULL;
else {
(void)snprintf(ckpt_name, sizeof(ckpt_name),
@@ -519,11 +530,6 @@ ops(void *arg)
ckpt_config = ckpt_name;
}
- /* Named checkpoints lock out backups */
- if (ckpt_config != NULL)
- testutil_check(
- pthread_rwlock_wrlock(&g.backup_lock));
-
testutil_checkfmt(
session->checkpoint(session, ckpt_config),
"%s", ckpt_config == NULL ? "" : ckpt_config);
@@ -531,6 +537,8 @@ ops(void *arg)
if (ckpt_config != NULL)
testutil_check(
pthread_rwlock_unlock(&g.backup_lock));
+ testutil_check(
+ pthread_rwlock_unlock(&g.checkpoint_lock));
/* Rephrase the checkpoint name for cursor open. */
if (ckpt_config == NULL)
@@ -541,7 +549,7 @@ ops(void *arg)
"checkpoint=thread-%d", tinfo->id);
ckpt_available = true;
- /* Pick the next checkpoint operation. */
+skip_checkpoint: /* Pick the next checkpoint operation. */
ckpt_op += mmrand(&tinfo->rnd, 5000, 20000);
}