/* Lock hashes, gradually. */
ecode = tdb_lock_gradual(tdb, ltype, flags, TDB_HASH_LOCK_START,
TDB_HASH_LOCK_RANGE);
- if (ecode != TDB_SUCCESS) {
- if (!(flags & TDB_LOCK_PROBE)) {
- tdb_logerr(tdb, ecode, TDB_LOG_ERROR,
- "tdb_allrecord_lock hashes failed");
- }
+ if (ecode != TDB_SUCCESS)
return ecode;
- }
/* Lock free tables: there to end of file. */
ecode = tdb_brlock(tdb, ltype,
TDB_HASH_LOCK_START + TDB_HASH_LOCK_RANGE,
0, flags);
if (ecode != TDB_SUCCESS) {
- if (!(flags & TDB_LOCK_PROBE)) {
- tdb_logerr(tdb, ecode, TDB_LOG_ERROR,
- "tdb_allrecord_lock freetables failed");
- }
tdb_brunlock(tdb, ltype, TDB_HASH_LOCK_START,
TDB_HASH_LOCK_RANGE);
return ecode;
/* upgrade the main transaction lock region to a write lock */
ecode = tdb_allrecord_upgrade(tdb);
if (ecode != TDB_SUCCESS) {
- tdb_logerr(tdb, ecode, TDB_LOG_ERROR,
- "tdb_transaction_prepare_commit:"
- " failed to upgrade hash locks");
- _tdb_transaction_cancel(tdb);
return ecode;
}
during the commit */
ecode = tdb_lock_open(tdb, TDB_LOCK_WAIT|TDB_LOCK_NOCHECK);
if (ecode != TDB_SUCCESS) {
- tdb_logerr(tdb, ecode, TDB_LOG_ERROR,
- "tdb_transaction_prepare_commit:"
- " failed to get open lock");
- _tdb_transaction_cancel(tdb);
return ecode;
}
&tdb->transaction
->magic_offset);
if (ecode != TDB_SUCCESS) {
- tdb_logerr(tdb, ecode, TDB_LOG_ERROR,
- "tdb_transaction_prepare_commit:"
- " failed to setup recovery data");
- _tdb_transaction_cancel(tdb);
return ecode;
}
}
tdb->file->map_size = tdb->transaction->old_map_size;
ecode = methods->expand_file(tdb, add);
if (ecode != TDB_SUCCESS) {
- tdb_logerr(tdb, ecode, TDB_LOG_ERROR,
- "tdb_transaction_prepare_commit:"
- " expansion failed");
- _tdb_transaction_cancel(tdb);
return ecode;
}
}
if (!tdb->transaction->prepared) {
ecode = _tdb_transaction_prepare_commit(tdb);
- if (ecode != TDB_SUCCESS)
+ if (ecode != TDB_SUCCESS) {
+ _tdb_transaction_cancel(tdb);
return tdb->last_error = ecode;
+ }
}
methods = tdb->transaction->io_methods;
ecode = methods->twrite(tdb, offset,
tdb->transaction->blocks[i], length);
if (ecode != TDB_SUCCESS) {
- tdb_logerr(tdb, ecode, TDB_LOG_ERROR,
- "tdb_transaction_commit:"
- " write failed during commit");
-
/* we've overwritten part of the data and
possibly expanded the file, so we need to
run the crash recovery code */