diff options
author | Alex Gorrod <alexg@wiredtiger.com> | 2014-03-20 00:54:07 +0000 |
---|---|---|
committer | Alex Gorrod <alexg@wiredtiger.com> | 2014-03-20 00:54:07 +0000 |
commit | 50f5921425afbc5edb9a296343706ac260ce6a86 (patch) | |
tree | c9d91df0bab14df2c72f0300e90e81015428eda2 | |
parent | 95ed7768881ac77d177f3917f21efe67f31c7461 (diff) | |
download | mongo-50f5921425afbc5edb9a296343706ac260ce6a86.tar.gz |
Short circuit cleaning up reconciliation boundary structures.
The list of structures can grow very large, and cleaning up on each
reconciliation is a performance bottle neck.
-rw-r--r-- | src/btree/rec_write.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/btree/rec_write.c b/src/btree/rec_write.c index 45b64cf1029..7b2e819da0a 100644 --- a/src/btree/rec_write.c +++ b/src/btree/rec_write.c @@ -487,12 +487,14 @@ __rec_write_init( } /* - * Clean up any pre-existing boundary structures: almost none of this - * should be necessary (already_compressed is the notable exception), - * but it's cheap. + * Clean up any used boundary structures. It is worth short-circuiting + * the traversal because sometimes the boundary list can grow to over + * a million entries. The only field we really need to clear is + * already_compressed, but let's be paranoid. */ if (r->bnd != NULL) - for (bnd = r->bnd, i = 0; i < r->bnd_entries; ++bnd, ++i) { + for (bnd = r->bnd, i = 0; + i < r->bnd_entries && bnd->entries > 0; ++bnd, ++i) { bnd->start = NULL; bnd->recno = 0; bnd->entries = 0; |