txn_commit must abort txn before returning errors

Fix for failure when committing a txn that is a child of
some parent txn.
vmware
Howard Chu 13 years ago
parent 1c8de1883c
commit 3d6b924c25
  1. 4
      libraries/libmdb/mdb.c
  2. 1
      libraries/libmdb/mdb.h

@ -1737,8 +1737,10 @@ mdb_txn_commit(MDB_txn *txn)
} }
x = dst[0].mid; x = dst[0].mid;
for (; y<=src[0].mid; y++) { for (; y<=src[0].mid; y++) {
if (++x >= MDB_IDL_UM_MAX) if (++x >= MDB_IDL_UM_MAX) {
mdb_txn_abort(txn);
return ENOMEM; return ENOMEM;
}
dst[x] = src[y]; dst[x] = src[y];
} }
dst[0].mid = x; dst[0].mid = x;

@ -530,6 +530,7 @@ int mdb_txn_begin(MDB_env *env, MDB_txn *parent, unsigned int flags, MDB_txn **
* <li>EINVAL - an invalid parameter was specified. * <li>EINVAL - an invalid parameter was specified.
* <li>ENOSPC - no more disk space. * <li>ENOSPC - no more disk space.
* <li>EIO - a low-level I/O error occurred while writing. * <li>EIO - a low-level I/O error occurred while writing.
* <li>ENOMEM - the transaction is nested and could not be merged into its parent.
* </ul> * </ul>
*/ */
int mdb_txn_commit(MDB_txn *txn); int mdb_txn_commit(MDB_txn *txn);

Loading…
Cancel
Save