Commit b786a3e4 authored by Zardosht Kasheff's avatar Zardosht Kasheff Committed by Yoni Fogel

addresses 962

grab table locks when doing a scan of a secondary index

git-svn-id: file:///svn/mysql/tokudb-engine/src@4792 c7de825b-a66e-492c-adef-691d508d4ae1
parent f2caf9db
...@@ -2194,6 +2194,31 @@ int ha_tokudb::delete_row(const uchar * record) { ...@@ -2194,6 +2194,31 @@ int ha_tokudb::delete_row(const uchar * record) {
TOKUDB_DBUG_RETURN(error); TOKUDB_DBUG_RETURN(error);
} }
//
// Notification that a scan of entire secondary table is about
// to take place. Will pre acquire table read lock
// Returns:
// 0 on success
// error otherwise
//
int ha_tokudb::prepare_index_scan() {
int error;
DB* db = share->key_file[active_index];
error = db->pre_acquire_read_lock(
db,
transaction,
db->dbt_neg_infty(), db->dbt_neg_infty(),
db->dbt_pos_infty(), db->dbt_pos_infty()
);
if (error) { last_cursor_error = error; goto cleanup; }
range_lock_grabbed = true;
error = 0;
cleanup:
return error;
}
// //
// Initializes local cursor on DB with index keynr // Initializes local cursor on DB with index keynr
// Parameters: // Parameters:
......
...@@ -227,6 +227,7 @@ public: ...@@ -227,6 +227,7 @@ public:
int update_row(const uchar * old_data, uchar * new_data); int update_row(const uchar * old_data, uchar * new_data);
int delete_row(const uchar * buf); int delete_row(const uchar * buf);
int prepare_index_scan();
int index_init(uint index, bool sorted); int index_init(uint index, bool sorted);
int index_end(); int index_end();
int index_read(uchar * buf, const uchar * key, uint key_len, enum ha_rkey_function find_flag); int index_read(uchar * buf, const uchar * key, uint key_len, enum ha_rkey_function find_flag);
......
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