null+****@clear*****
null+****@clear*****
2012年 2月 22日 (水) 02:01:03 JST
Kentoku 2012-02-22 02:01:03 +0900 (Wed, 22 Feb 2012) New Revision: 3bd1c26d84e0ec55f682cb6720f1f3f60968fadb Log: Fix endless loop using wrapper mode at updating by PK. refs #1195 Modified files: ha_mroonga.cc ha_mroonga.h Modified: ha_mroonga.cc (+94 -0) =================================================================== --- ha_mroonga.cc 2012-02-21 09:38:13 +0900 (d243f4d) +++ ha_mroonga.cc 2012-02-22 02:01:03 +0900 (7aa0798) @@ -2895,6 +2895,7 @@ int ha_mroonga::wrapper_open(const char *name, int mode, uint test_if_locked) } } ref_length = wrap_handler->ref_length; + key_used_on_scan = wrap_handler->key_used_on_scan; MRN_SET_BASE_SHARE_KEY(share, table->s); MRN_SET_BASE_TABLE_KEY(this, table); init(); @@ -11057,6 +11058,99 @@ void ha_mroonga::set_pk_bitmap() DBUG_VOID_RETURN; } +bool ha_mroonga::wrapper_was_semi_consistent_read() +{ + bool res; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + res = wrap_handler->was_semi_consistent_read(); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(res); +} + +bool ha_mroonga::storage_was_semi_consistent_read() +{ + bool res; + MRN_DBUG_ENTER_METHOD(); + res = handler::was_semi_consistent_read(); + DBUG_RETURN(res); +} + +bool ha_mroonga::was_semi_consistent_read() +{ + bool res; + MRN_DBUG_ENTER_METHOD(); + if (share->wrapper_mode) + { + res = wrapper_was_semi_consistent_read(); + } else { + res = storage_was_semi_consistent_read(); + } + DBUG_RETURN(res); +} + +void ha_mroonga::wrapper_try_semi_consistent_read(bool yes) +{ + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + wrap_handler->try_semi_consistent_read(yes); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_VOID_RETURN; +} + +void ha_mroonga::storage_try_semi_consistent_read(bool yes) +{ + MRN_DBUG_ENTER_METHOD(); + handler::try_semi_consistent_read(yes); + DBUG_VOID_RETURN; +} + +void ha_mroonga::try_semi_consistent_read(bool yes) +{ + MRN_DBUG_ENTER_METHOD(); + if (share->wrapper_mode) + { + wrapper_try_semi_consistent_read(yes); + } else { + storage_try_semi_consistent_read(yes); + } + DBUG_VOID_RETURN; +} + +void ha_mroonga::wrapper_unlock_row() +{ + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + wrap_handler->unlock_row(); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_VOID_RETURN; +} + +void ha_mroonga::storage_unlock_row() +{ + MRN_DBUG_ENTER_METHOD(); + handler::unlock_row(); + DBUG_VOID_RETURN; +} + +void ha_mroonga::unlock_row() +{ + MRN_DBUG_ENTER_METHOD(); + if (share->wrapper_mode) + { + wrapper_unlock_row(); + } else { + storage_unlock_row(); + } + DBUG_VOID_RETURN; +} + int ha_mroonga::wrapper_start_stmt(THD *thd, thr_lock_type lock_type) { int res; Modified: ha_mroonga.h (+9 -0) =================================================================== --- ha_mroonga.h 2012-02-21 09:38:13 +0900 (dec972f) +++ ha_mroonga.h 2012-02-22 02:01:03 +0900 (b820f26) @@ -373,6 +373,9 @@ public: void restore_auto_increment(ulonglong prev_insert_id); void release_auto_increment(); int reset_auto_increment(ulonglong value); + bool was_semi_consistent_read(); + void try_semi_consistent_read(bool yes); + void unlock_row(); int start_stmt(THD *thd, thr_lock_type lock_type); protected: @@ -833,6 +836,12 @@ private: void storage_release_auto_increment(); int wrapper_reset_auto_increment(ulonglong value); int storage_reset_auto_increment(ulonglong value); + bool wrapper_was_semi_consistent_read(); + bool storage_was_semi_consistent_read(); + void wrapper_try_semi_consistent_read(bool yes); + void storage_try_semi_consistent_read(bool yes); + void wrapper_unlock_row(); + void storage_unlock_row(); int wrapper_start_stmt(THD *thd, thr_lock_type lock_type); int storage_start_stmt(THD *thd, thr_lock_type lock_type); void wrapper_change_table_ptr(TABLE *table_arg, TABLE_SHARE *share_arg);