From 83fd01094f575fb887c0d3ee8bb81a497bfa628c Mon Sep 17 00:00:00 2001 From: Zardosht Kasheff Date: Wed, 17 Apr 2013 00:01:55 -0400 Subject: [PATCH] [t:1979], remove old hack git-svn-id: file:///svn/mysql/tokudb-engine/src@16249 c7de825b-a66e-492c-adef-691d508d4ae1 --- storage/tokudb/ha_tokudb.cc | 18 +++++++++--------- storage/tokudb/ha_tokudb.h | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/storage/tokudb/ha_tokudb.cc b/storage/tokudb/ha_tokudb.cc index 4eab511f87f..77a1eafa471 100644 --- a/storage/tokudb/ha_tokudb.cc +++ b/storage/tokudb/ha_tokudb.cc @@ -1062,10 +1062,10 @@ cleanup: return error; } -int ha_tokudb::open_main_dictionary(const char* name, int mode, DB_TXN* txn) { +int ha_tokudb::open_main_dictionary(const char* name, bool is_read_only, DB_TXN* txn) { int error; char* newname = NULL; - uint open_flags = (mode == O_RDONLY ? DB_RDONLY : 0) | DB_THREAD; + uint open_flags = (is_read_only ? DB_RDONLY : 0) | DB_THREAD; open_flags += DB_AUTO_COMMIT; assert(share->file == NULL); @@ -1118,10 +1118,10 @@ exit: // // Open a secondary table, the key will be a secondary index, the data will be a primary key // -int ha_tokudb::open_secondary_dictionary(DB** ptr, KEY* key_info, const char* name, int mode, DB_TXN* txn) { +int ha_tokudb::open_secondary_dictionary(DB** ptr, KEY* key_info, const char* name, bool is_read_only, DB_TXN* txn) { int error = ENOSYS; char dict_name[MAX_DICT_NAME_LEN]; - uint open_flags = (mode == O_RDONLY ? DB_RDONLY : 0) | DB_THREAD; + uint open_flags = (is_read_only ? DB_RDONLY : 0) | DB_THREAD; char* newname = NULL; uint newname_len = 0; @@ -1335,7 +1335,7 @@ int ha_tokudb::initialize_share( } - error = open_main_dictionary(name, mode, NULL); + error = open_main_dictionary(name, mode == O_RDONLY, NULL); if (error) { goto exit; } /* Open other keys; These are part of the share structure */ @@ -1345,7 +1345,7 @@ int ha_tokudb::initialize_share( &share->key_file[i], &table_share->key_info[i], name, - mode, + mode == O_RDONLY, NULL ); if (error) { @@ -5676,7 +5676,7 @@ int ha_tokudb::add_index(TABLE *table_arg, KEY *key_info, uint num_of_keys) { &share->key_file[curr_index], &key_info[i], share->table_name, - 2, // TODO: This is a hack. Need to learn what should really be here. Need to ask Yoni + false, txn ); if (error) { goto cleanup; } @@ -6177,7 +6177,7 @@ To truncate the table, make sure no transactions touch the table.", share->table &share->key_file[i], &table_share->key_info[i], share->table_name, - 2, // TODO: This is a hack. Need to learn what should really be here. Need to ask Yoni + false, // NULL ); assert(!r); @@ -6185,7 +6185,7 @@ To truncate the table, make sure no transactions touch the table.", share->table else { r = open_main_dictionary( share->table_name, - 2, // TODO: This is a hack. Need to learn what should really be here. Need to ask Yoni + false, NULL ); assert(!r); diff --git a/storage/tokudb/ha_tokudb.h b/storage/tokudb/ha_tokudb.h index f60210ca19a..b6e84cd766b 100644 --- a/storage/tokudb/ha_tokudb.h +++ b/storage/tokudb/ha_tokudb.h @@ -259,8 +259,8 @@ private: int handle_cursor_error(int error, int err_to_return, uint keynr); DBT *get_pos(DBT * to, uchar * pos); - int open_main_dictionary(const char* name, int mode, DB_TXN* txn); - int open_secondary_dictionary(DB** ptr, KEY* key_info, const char* name, int mode, DB_TXN* txn); + int open_main_dictionary(const char* name, bool is_read_only, DB_TXN* txn); + int open_secondary_dictionary(DB** ptr, KEY* key_info, const char* name, bool is_read_only, DB_TXN* txn); int open_status_dictionary(DB** ptr, const char* name, DB_TXN* txn); int acquire_table_lock (DB_TXN* trans, TABLE_LOCK_TYPE lt); int estimate_num_rows(DB* db, u_int64_t* num_rows);