if (recovery_head != 0) {
tdb->stats.frees++;
ecode = add_free_record(tdb, recovery_head,
- sizeof(rec) + rec.max_len);
+ sizeof(rec) + rec.max_len,
+ TDB_LOCK_WAIT);
if (ecode != TDB_SUCCESS) {
return tdb_logerr(tdb, ecode, TDB_LOG_ERROR,
"tdb_recovery_allocate:"
/* the tdb_free() call might have increased the recovery size */
*recovery_size = tdb_recovery_size(tdb);
- /* round up to a multiple of page size */
+ /* round up to a multiple of page size. Overallocate, since each
+ * such allocation forces us to expand the file. */
*recovery_max_size
- = (((sizeof(rec) + *recovery_size) + PAGESIZE-1)
- & ~(PAGESIZE-1))
+ = (((sizeof(rec) + *recovery_size + *recovery_size / 2)
+ + PAGESIZE-1) & ~(PAGESIZE-1))
- sizeof(rec);
*recovery_offset = tdb->file->map_size;
recovery_head = *recovery_offset;