From 6d5a3e1602a1db8ca8e778f5e4f40bb623dff1e7 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Tue, 19 Jun 2012 12:39:33 +0930 Subject: ntdb: still prepare recovery area with NTDB_NOSYNC. NTDB_NOSYNC now just prevents the fsync/msync calls, which speeds testing while still providing full coverage. It also provides safety against processes dying during transaction commit (though obviously, not against the machine dying). Signed-off-by: Rusty Russell --- lib/ntdb/transaction.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'lib/ntdb') diff --git a/lib/ntdb/transaction.c b/lib/ntdb/transaction.c index 222aa1fdbc..b03bbbdb8a 100644 --- a/lib/ntdb/transaction.c +++ b/lib/ntdb/transaction.c @@ -85,8 +85,9 @@ intervention. - if NTDB_NOSYNC is passed to flags in ntdb_open then transactions are - still available, but no transaction recovery area is used and no - fsync/msync calls are made. + still available, but fsync/msync calls are made. This means we + still are safe against unexpected death during transaction commit, + but not against machine reboots. */ /* @@ -977,14 +978,11 @@ static enum NTDB_ERROR _ntdb_transaction_prepare_commit(struct ntdb_context *ntd return ecode; } - /* Since we have whole db locked, we don't need the expansion lock. */ - if (!(ntdb->flags & NTDB_NOSYNC)) { - /* Sets up ntdb->transaction->recovery and - * ntdb->transaction->magic_offset. */ - ecode = transaction_setup_recovery(ntdb); - if (ecode != NTDB_SUCCESS) { - return ecode; - } + /* Sets up ntdb->transaction->recovery and + * ntdb->transaction->magic_offset. */ + ecode = transaction_setup_recovery(ntdb); + if (ecode != NTDB_SUCCESS) { + return ecode; } ntdb->transaction->prepared = true; -- cgit