Commit 9d2d9c77 authored by Vincenzo Liberatore's avatar Vincenzo Liberatore

#Addresses 311.

git-svn-id: file:///svn/tokudb@1997 c7de825b-a66e-492c-adef-691d508d4ae1
parent 85308551
...@@ -204,53 +204,56 @@ int toku_lt_acquire_read_lock(toku_lock_tree* tree, DB_TXN* txn, ...@@ -204,53 +204,56 @@ int toku_lt_acquire_read_lock(toku_lock_tree* tree, DB_TXN* txn,
const DBT* key, const DBT* data); const DBT* key, const DBT* data);
/* /*
* Acquires a read lock on a key range (or key/data range). (Closed range). Acquires a read lock on a key range (or key/data range). (Closed range).
* Params:
* tree: The lock tree for the db. \param tree: The lock tree for the db.
* txn: The TOKU Transaction this lock is for. \param txn: The TOKU Transaction this lock is for.
* key_left: The left end key of the range. \param key_left: The left end key of the range.
* data_left: The left end data of the range. \param data_left: The left end data of the range.
* key_right: The right end key of the range. \param key_right: The right end key of the range.
* data_right: The right end data of the range. \param data_right: The right end data of the range.
* Returns:
* 0: Success. \return
* DB_LOCK_NOTGRANTED: If there is a conflict in getting the lock. - 0: Success.
* This can only happen if some other transaction has - DB_LOCK_NOTGRANTED: If there is a conflict in getting the lock.
* a write lock that overlaps this range. This can only happen if some other transaction has
* EINVAL: If (tree == NULL || txn == NULL || a write lock that overlaps this range.
* key_left == NULL || key_right == NULL) or - EDOM: In a DB_DUPSORT db:
* (tree->db is dupsort && If (key_left, data_left) > (key_right, data_right) or
* (data_left == NULL || data_right == NULL)) or In a nodup db: if (key_left) > (key_right)
* (tree->db is nodup && (According to the db's comparison functions.)
* (data_left != NULL || data_right != NULL)) or - ENOMEM: If adding the lock would exceed the maximum
* (tree->db is dupsort && key_left != data_left && memory allowed for payloads.
* (key_left == toku_lt_infinity ||
* key_left == toku_lt_neg_infinity)) or The following is asserted, but if this library is ever exported to users,
* (tree->db is dupsort && key_right != data_right && EINVAL should be used instead:
* (key_right == toku_lt_infinity || If (tree == NULL || txn == NULL ||
* key_right == toku_lt_neg_infinity)) key_left == NULL || key_right == NULL) or
* EDOM: In a DB_DUPSORT db: (tree->db is dupsort &&
* If (key_left, data_left) > (key_right, data_right) or (data_left == NULL || data_right == NULL)) or
* In a nodup db: if (key_left) > (key_right) (tree->db is nodup &&
* (According to the db's comparison functions. (data_left != NULL || data_right != NULL)) or
* ENOMEM: If adding the lock would exceed the maximum (tree->db is dupsort && key_left != data_left &&
* memory allowed for payloads. (key_left == toku_lt_infinity ||
* Asserts: key_left == toku_lt_neg_infinity)) or
* The EINVAL and ERANGE cases described will use assert to abort instead of returning errors. (tree->db is dupsort && key_right != data_right &&
* If this library is ever exported to users, we will use error datas instead. (key_right == toku_lt_infinity ||
* Memory: key_right == toku_lt_neg_infinity))
* It is safe to free keys and datas after this call.
* If the lock tree needs to hold onto the key or data, it will make copies Memory: It is safe to free keys and datas after this call.
* to its local memory. If the lock tree needs to hold onto the key or data, it will make copies
* *** Note that txn == NULL is not supported at this time. to its local memory.
Note that txn == NULL is not supported at this time.
In BDB, txn can actually be NULL (mixed operations with transactions and
no transactions). This can cause conflicts, nobody was unable (so far)
to verify that MySQL does or does not use this.
*/ */
int toku_lt_acquire_range_read_lock(toku_lock_tree* tree, DB_TXN* txn, int toku_lt_acquire_range_read_lock(toku_lock_tree* tree, DB_TXN* txn,
const DBT* key_left, const DBT* data_left, const DBT* key_left, const DBT* data_left,
const DBT* key_right, const DBT* data_right); const DBT* key_right, const DBT* data_right);
//In BDB, txn can actually be NULL (mixed operations with transactions and no transactions).
//This can cause conflicts, I was unable (so far) to verify that MySQL does or does not use
//this.
/* /*
* Acquires a write lock on a single key (or key/data). * Acquires a write lock on a single key (or key/data).
* Params: * Params:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment