Tokutek/ft-index — pull request #259 by esmet (2014-06-09 18:56:17+00:00)
Title: Variable key overwrite

Write a test that exposes a bug where variable length keys that compare equally put a basement node's mempool in a bad state
- Use a key format that is either packed as int (4 bytes) or double (8 bytes) with a 1 byte header
- Fill a db with integer (5 byte) keys
- Randomly overwrite every key with a double (9 byte) key that compares equally (ie: 0 == 0.0)
-- Abort every other overwrite to exercise rollback processing
-- Run the test using overwrite inserts, deletes, updates, update broadcasts to exercise various message application paths

Fix the issue by passing down the stored key length of a leafentry when we find it in a basement node's bn_data. Use this size for calculating how much memory should be freed from the mempool instead of relying on the message's keysize. Add stronger invariants to mempool_mfree() so that this issue is caught much deeper in the stack.