WL#2269 Enable query cache for NDB part 2

-This is mostly fixes for correct behaviour when using query cache + transactions + the thread that
fetches commit count from NDB at regular intervals. The major fix is to add a
list in thd_ndb, that keeps a list of NDB_SHARE's that were modified by
transaction and then "clearing" them in ndbcluster_commit.
parent 19cc4026
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -60,6 +60,7 @@ typedef struct st_ndbcluster_share { ...@@ -60,6 +60,7 @@ typedef struct st_ndbcluster_share {
pthread_mutex_t mutex; pthread_mutex_t mutex;
char *table_name; char *table_name;
uint table_name_length,use_count; uint table_name_length,use_count;
uint commit_count_lock;
ulonglong commit_count; ulonglong commit_count;
} NDB_SHARE; } NDB_SHARE;
...@@ -77,6 +78,7 @@ class Thd_ndb { ...@@ -77,6 +78,7 @@ class Thd_ndb {
NdbTransaction *all; NdbTransaction *all;
NdbTransaction *stmt; NdbTransaction *stmt;
int error; int error;
List<NDB_SHARE> changed_tables;
}; };
class ha_ndbcluster: public handler class ha_ndbcluster: public handler
...@@ -226,7 +228,7 @@ class ha_ndbcluster: public handler ...@@ -226,7 +228,7 @@ class ha_ndbcluster: public handler
char *update_table_comment(const char * comment); char *update_table_comment(const char * comment);
private: private:
int check_ndb_connection(); int check_ndb_connection(THD* thd= current_thd);
NdbTransaction *m_active_trans; NdbTransaction *m_active_trans;
NdbScanOperation *m_active_cursor; NdbScanOperation *m_active_cursor;
...@@ -250,6 +252,7 @@ class ha_ndbcluster: public handler ...@@ -250,6 +252,7 @@ class ha_ndbcluster: public handler
ha_rows m_rows_to_insert; ha_rows m_rows_to_insert;
ha_rows m_rows_inserted; ha_rows m_rows_inserted;
ha_rows m_bulk_insert_rows; ha_rows m_bulk_insert_rows;
ha_rows m_rows_changed;
bool m_bulk_insert_not_flushed; bool m_bulk_insert_not_flushed;
ha_rows m_ops_pending; ha_rows m_ops_pending;
bool m_skip_auto_increment; bool m_skip_auto_increment;
......
...@@ -413,7 +413,8 @@ sys_var_thd_bool ...@@ -413,7 +413,8 @@ sys_var_thd_bool
sys_ndb_use_exact_count("ndb_use_exact_count", &SV::ndb_use_exact_count); sys_ndb_use_exact_count("ndb_use_exact_count", &SV::ndb_use_exact_count);
sys_var_thd_bool sys_var_thd_bool
sys_ndb_use_transactions("ndb_use_transactions", &SV::ndb_use_transactions); sys_ndb_use_transactions("ndb_use_transactions", &SV::ndb_use_transactions);
sys_var_long_ptr sys_ndb_cache_check_time("ndb_cache_check_time", &ndb_cache_check_time); sys_var_long_ptr
sys_ndb_cache_check_time("ndb_cache_check_time", &ndb_cache_check_time);
#endif #endif
/* Time/date/datetime formats */ /* Time/date/datetime formats */
...@@ -686,10 +687,10 @@ sys_var *sys_variables[]= ...@@ -686,10 +687,10 @@ sys_var *sys_variables[]=
#endif #endif
#ifdef HAVE_NDBCLUSTER_DB #ifdef HAVE_NDBCLUSTER_DB
&sys_ndb_autoincrement_prefetch_sz, &sys_ndb_autoincrement_prefetch_sz,
&sys_ndb_cache_check_time,
&sys_ndb_force_send, &sys_ndb_force_send,
&sys_ndb_use_exact_count, &sys_ndb_use_exact_count,
&sys_ndb_use_transactions, &sys_ndb_use_transactions,
&sys_ndb_cache_check_time,
#endif #endif
&sys_unique_checks, &sys_unique_checks,
&sys_updatable_views_with_limit, &sys_updatable_views_with_limit,
...@@ -1276,7 +1277,6 @@ static int check_max_delayed_threads(THD *thd, set_var *var) ...@@ -1276,7 +1277,6 @@ static int check_max_delayed_threads(THD *thd, set_var *var)
return 0; return 0;
} }
static void fix_max_connections(THD *thd, enum_var_type type) static void fix_max_connections(THD *thd, enum_var_type type)
{ {
#ifndef EMBEDDED_LIBRARY #ifndef EMBEDDED_LIBRARY
......
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