From: Rusty Russell Date: Fri, 25 Sep 2009 03:16:08 +0000 (+0930) Subject: tdb: allow reads after prepare commit X-Git-Url: https://git.ozlabs.org/?p=ccan;a=commitdiff_plain;h=088b2a9f4a7dedf357d90e5e420062461f78a13b tdb: allow reads after prepare commit (Imported from SAMBA commit 46c99ec2a3781d53138245182345c6c2ddd9a258: From: Andrew Tridgell Date: Tue, 15 Sep 2009 14:04:22 -0700 We previously only allowed a commit to happen after a prepare commit. It is in fact safe to allow reads between a prepare and a commit, and the s4 replication code can make use of that, so allow it. --- diff --git a/ccan/tdb/transaction.c b/ccan/tdb/transaction.c index 98829637..4a49cc7b 100644 --- a/ccan/tdb/transaction.c +++ b/ccan/tdb/transaction.c @@ -144,14 +144,6 @@ static int transaction_read(struct tdb_context *tdb, tdb_off_t off, void *buf, { uint32_t blk; - /* Only a commit is allowed on a prepared transaction */ - if (tdb->transaction->prepared) { - tdb->ecode = TDB_ERR_EINVAL; - TDB_LOG((tdb, TDB_DEBUG_FATAL, "transaction_read: transaction already prepared, read not allowed\n")); - tdb->transaction->transaction_error = 1; - return -1; - } - /* break it down into block sized ops */ while (len + (off % tdb->transaction->block_size) > tdb->transaction->block_size) { tdb_len_t len2 = tdb->transaction->block_size - (off % tdb->transaction->block_size);