My Project
|
00001 /* 00002 Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 00003 00004 This program is free software; you can redistribute it and/or modify 00005 it under the terms of the GNU General Public License as published by 00006 the Free Software Foundation; version 2 of the License. 00007 00008 This program is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00011 GNU General Public License for more details. 00012 00013 You should have received a copy of the GNU General Public License 00014 along with this program; if not, write to the Free Software 00015 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00016 */ 00017 00018 #ifndef NDB_THD_NDB_H 00019 #define NDB_THD_NDB_H 00020 00021 #include <my_global.h> 00022 #include <my_base.h> // ha_rows 00023 #include <sql_list.h> // List<> 00024 #include <hash.h> // HASH 00025 00026 #include "ndb_share.h" 00027 00028 #include <kernel/ndb_limits.h> // MAX_NDB_NODES 00029 00030 /* 00031 Place holder for ha_ndbcluster thread specific data 00032 */ 00033 00034 enum THD_NDB_OPTIONS 00035 { 00036 TNO_NO_LOG_SCHEMA_OP= 1 << 0, 00037 /* 00038 In participating mysqld, do not try to acquire global schema 00039 lock, as one other mysqld already has the lock. 00040 */ 00041 TNO_NO_LOCK_SCHEMA_OP= 1 << 1 00042 /* 00043 Skip drop of ndb table in delete_table. Used when calling 00044 mysql_rm_table_part2 in "show tables", as we do not want to 00045 remove ndb tables "by mistake". The table should not exist 00046 in ndb in the first place. 00047 */ 00048 ,TNO_NO_NDB_DROP_TABLE= 1 << 2 00049 }; 00050 00051 enum THD_NDB_TRANS_OPTIONS 00052 { 00053 TNTO_INJECTED_APPLY_STATUS= 1 << 0 00054 ,TNTO_NO_LOGGING= 1 << 1 00055 ,TNTO_TRANSACTIONS_OFF= 1 << 2 00056 }; 00057 00058 class Thd_ndb 00059 { 00060 THD* m_thd; 00061 00062 Thd_ndb(THD*); 00063 ~Thd_ndb(); 00064 public: 00065 static Thd_ndb* seize(THD*); 00066 static void release(Thd_ndb* thd_ndb); 00067 00068 void init_open_tables(); 00069 00070 class Ndb_cluster_connection *connection; 00071 class Ndb *ndb; 00072 class ha_ndbcluster *m_handler; 00073 ulong count; 00074 uint lock_count; 00075 uint start_stmt_count; 00076 uint save_point_count; 00077 class NdbTransaction *trans; 00078 bool m_error; 00079 bool m_slow_path; 00080 bool m_force_send; 00081 00082 uint32 options; 00083 uint32 trans_options; 00084 List<NDB_SHARE> changed_tables; 00085 HASH open_tables; 00086 /* 00087 This is a memroot used to buffer rows for batched execution. 00088 It is reset after every execute(). 00089 */ 00090 MEM_ROOT m_batch_mem_root; 00091 /* 00092 Estimated pending batched execution bytes, once this is > BATCH_FLUSH_SIZE 00093 we execute() to flush the rows buffered in m_batch_mem_root. 00094 */ 00095 uint m_unsent_bytes; 00096 uint m_batch_size; 00097 00098 uint m_execute_count; 00099 00100 uint m_scan_count; 00101 uint m_pruned_scan_count; 00102 00104 uint m_sorted_scan_count; 00105 00107 uint m_pushed_queries_defined; 00114 uint m_pushed_queries_dropped; 00120 uint m_pushed_queries_executed; 00126 uint m_pushed_reads; 00127 00128 uint m_transaction_no_hint_count[MAX_NDB_NODES]; 00129 uint m_transaction_hint_count[MAX_NDB_NODES]; 00130 00131 NdbTransaction *global_schema_lock_trans; 00132 uint global_schema_lock_count; 00133 uint global_schema_lock_error; 00134 uint schema_locks_count; // Number of global schema locks taken by thread 00135 bool has_required_global_schema_lock(const char* func); 00136 00137 unsigned m_connect_count; 00138 bool valid_ndb(void); 00139 bool recycle_ndb(THD* thd); 00140 }; 00141 00142 #endif