Loading mysql-test/r/ndb_alter_table.result +4 −4 Original line number Diff line number Diff line Loading @@ -18,12 +18,12 @@ col5 enum('PENDING', 'ACTIVE', 'DISABLED') not null, col6 int not null, to_be_deleted int) ENGINE=ndbcluster; show table status; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment t1 ndbcluster 9 Dynamic 100 0 0 NULL 0 0 1 NULL NULL NULL latin1_swedish_ci NULL t1 ndbcluster 9 Dynamic 0 0 0 NULL 0 0 1 NULL NULL NULL latin1_swedish_ci NULL insert into t1 values (0,4,3,5,"PENDING",1,7),(NULL,4,3,5,"PENDING",1,7),(31,4,3,5,"PENDING",1,7), (7,4,3,5,"PENDING",1,7), (NULL,4,3,5,"PENDING",1,7), (100,4,3,5,"PENDING",1,7), (99,4,3,5,"PENDING",1,7), (8,4,3,5,"PENDING",1,7), (NULL,4,3,5,"PENDING",1,7); show table status; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment t1 ndbcluster 9 Dynamic 100 0 0 NULL 0 0 102 NULL NULL NULL latin1_swedish_ci NULL t1 ndbcluster 9 Dynamic 9 0 0 NULL 0 0 102 NULL NULL NULL latin1_swedish_ci NULL select * from t1 order by col1; col1 col2 col3 col4 col5 col6 to_be_deleted 0 4 3 5 PENDING 1 7 Loading @@ -43,7 +43,7 @@ change column col2 fourth varchar(30) not null after col3, modify column col6 int not null first; show table status; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment t1 ndbcluster 9 Dynamic 100 0 0 NULL 0 0 102 NULL NULL NULL latin1_swedish_ci NULL t1 ndbcluster 9 Dynamic 9 0 0 NULL 0 0 102 NULL NULL NULL latin1_swedish_ci NULL select * from t1 order by col1; col6 col1 col3 fourth col4 col4_5 col5 col7 col8 1 0 3 4 5 PENDING 0000-00-00 00:00:00 Loading @@ -58,7 +58,7 @@ col6 col1 col3 fourth col4 col4_5 col5 col7 col8 insert into t1 values (2, NULL,4,3,5,99,"PENDING","EXTRA",'2004-01-01 00:00:00'); show table status; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment t1 ndbcluster 9 Dynamic 100 0 0 NULL 0 0 103 NULL NULL NULL latin1_swedish_ci NULL t1 ndbcluster 9 Dynamic 10 0 0 NULL 0 0 103 NULL NULL NULL latin1_swedish_ci NULL select * from t1 order by col1; col6 col1 col3 fourth col4 col4_5 col5 col7 col8 1 0 3 4 5 PENDING 0000-00-00 00:00:00 Loading mysql-test/r/ndb_blob.result +2 −2 Original line number Diff line number Diff line Loading @@ -150,7 +150,7 @@ insert into t1 values(9,'b9',999,'dd9'); commit; explain select * from t1; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 100 1 SIMPLE t1 ALL NULL NULL NULL NULL 9 select * from t1 order by a; a b c d 1 b1 111 dd1 Loading Loading @@ -185,7 +185,7 @@ insert into t1 values(2,@b2,222,@d2); commit; explain select * from t1; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 100 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 select a,length(b),substr(b,1+2*900,2),length(d),substr(d,1+3*900,3) from t1 order by a; a length(b) substr(b,1+2*900,2) length(d) substr(d,1+3*900,3) Loading ndb/include/ndbapi/NdbDictionary.hpp +2 −0 Original line number Diff line number Diff line Loading @@ -1066,6 +1066,8 @@ public: Dictionary(NdbDictionaryImpl&); const Table * getIndexTable(const char * indexName, const char * tableName); public: const Table * getTable(const char * name, void **data); }; }; Loading ndb/src/ndbapi/DictCache.cpp +22 −5 Original line number Diff line number Diff line Loading @@ -21,6 +21,21 @@ #include <NdbCondition.h> #include <NdbSleep.h> Ndb_local_table_info::Ndb_local_table_info(NdbTableImpl *table_impl, Uint32 sz) { m_table_impl= table_impl; if (sz) m_local_data= malloc(sz); else m_local_data= 0; } Ndb_local_table_info::~Ndb_local_table_info() { if (m_local_data) free(m_local_data); } LocalDictCache::LocalDictCache(){ m_tableHash.createHashTable(); } Loading @@ -29,22 +44,24 @@ LocalDictCache::~LocalDictCache(){ m_tableHash.releaseHashTable(); } NdbTableImpl * Ndb_local_table_info * LocalDictCache::get(const char * name){ const Uint32 len = strlen(name); return m_tableHash.getData(name, len); } void LocalDictCache::put(const char * name, NdbTableImpl * tab){ const Uint32 id = tab->m_tableId; LocalDictCache::put(const char * name, Ndb_local_table_info * tab_info){ const Uint32 id = tab_info->m_table_impl->m_tableId; m_tableHash.insertKey(name, strlen(name), id, tab); m_tableHash.insertKey(name, strlen(name), id, tab_info); } void LocalDictCache::drop(const char * name){ m_tableHash.deleteKey(name, strlen(name)); Ndb_local_table_info *info= m_tableHash.deleteKey(name, strlen(name)); DBUG_ASSERT(info != 0); delete info; } /***************************************************************** Loading ndb/src/ndbapi/DictCache.hpp +13 −3 Original line number Diff line number Diff line Loading @@ -27,6 +27,16 @@ #include <Ndb.hpp> #include "NdbLinHash.hpp" class Ndb_local_table_info { public: Ndb_local_table_info(NdbTableImpl *table_impl, Uint32 sz=0); ~Ndb_local_table_info(); NdbTableImpl *m_table_impl; Uint64 m_first_tuple_id; Uint64 m_last_tuple_id; void *m_local_data; }; /** * A non thread safe dict cache */ Loading @@ -35,12 +45,12 @@ public: LocalDictCache(); ~LocalDictCache(); NdbTableImpl * get(const char * name); Ndb_local_table_info * get(const char * name); void put(const char * name, NdbTableImpl *); void put(const char * name, Ndb_local_table_info *); void drop(const char * name); NdbLinHash<NdbTableImpl> m_tableHash; // On name NdbLinHash<Ndb_local_table_info> m_tableHash; // On name }; /** Loading Loading
mysql-test/r/ndb_alter_table.result +4 −4 Original line number Diff line number Diff line Loading @@ -18,12 +18,12 @@ col5 enum('PENDING', 'ACTIVE', 'DISABLED') not null, col6 int not null, to_be_deleted int) ENGINE=ndbcluster; show table status; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment t1 ndbcluster 9 Dynamic 100 0 0 NULL 0 0 1 NULL NULL NULL latin1_swedish_ci NULL t1 ndbcluster 9 Dynamic 0 0 0 NULL 0 0 1 NULL NULL NULL latin1_swedish_ci NULL insert into t1 values (0,4,3,5,"PENDING",1,7),(NULL,4,3,5,"PENDING",1,7),(31,4,3,5,"PENDING",1,7), (7,4,3,5,"PENDING",1,7), (NULL,4,3,5,"PENDING",1,7), (100,4,3,5,"PENDING",1,7), (99,4,3,5,"PENDING",1,7), (8,4,3,5,"PENDING",1,7), (NULL,4,3,5,"PENDING",1,7); show table status; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment t1 ndbcluster 9 Dynamic 100 0 0 NULL 0 0 102 NULL NULL NULL latin1_swedish_ci NULL t1 ndbcluster 9 Dynamic 9 0 0 NULL 0 0 102 NULL NULL NULL latin1_swedish_ci NULL select * from t1 order by col1; col1 col2 col3 col4 col5 col6 to_be_deleted 0 4 3 5 PENDING 1 7 Loading @@ -43,7 +43,7 @@ change column col2 fourth varchar(30) not null after col3, modify column col6 int not null first; show table status; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment t1 ndbcluster 9 Dynamic 100 0 0 NULL 0 0 102 NULL NULL NULL latin1_swedish_ci NULL t1 ndbcluster 9 Dynamic 9 0 0 NULL 0 0 102 NULL NULL NULL latin1_swedish_ci NULL select * from t1 order by col1; col6 col1 col3 fourth col4 col4_5 col5 col7 col8 1 0 3 4 5 PENDING 0000-00-00 00:00:00 Loading @@ -58,7 +58,7 @@ col6 col1 col3 fourth col4 col4_5 col5 col7 col8 insert into t1 values (2, NULL,4,3,5,99,"PENDING","EXTRA",'2004-01-01 00:00:00'); show table status; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment t1 ndbcluster 9 Dynamic 100 0 0 NULL 0 0 103 NULL NULL NULL latin1_swedish_ci NULL t1 ndbcluster 9 Dynamic 10 0 0 NULL 0 0 103 NULL NULL NULL latin1_swedish_ci NULL select * from t1 order by col1; col6 col1 col3 fourth col4 col4_5 col5 col7 col8 1 0 3 4 5 PENDING 0000-00-00 00:00:00 Loading
mysql-test/r/ndb_blob.result +2 −2 Original line number Diff line number Diff line Loading @@ -150,7 +150,7 @@ insert into t1 values(9,'b9',999,'dd9'); commit; explain select * from t1; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 100 1 SIMPLE t1 ALL NULL NULL NULL NULL 9 select * from t1 order by a; a b c d 1 b1 111 dd1 Loading Loading @@ -185,7 +185,7 @@ insert into t1 values(2,@b2,222,@d2); commit; explain select * from t1; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 100 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 select a,length(b),substr(b,1+2*900,2),length(d),substr(d,1+3*900,3) from t1 order by a; a length(b) substr(b,1+2*900,2) length(d) substr(d,1+3*900,3) Loading
ndb/include/ndbapi/NdbDictionary.hpp +2 −0 Original line number Diff line number Diff line Loading @@ -1066,6 +1066,8 @@ public: Dictionary(NdbDictionaryImpl&); const Table * getIndexTable(const char * indexName, const char * tableName); public: const Table * getTable(const char * name, void **data); }; }; Loading
ndb/src/ndbapi/DictCache.cpp +22 −5 Original line number Diff line number Diff line Loading @@ -21,6 +21,21 @@ #include <NdbCondition.h> #include <NdbSleep.h> Ndb_local_table_info::Ndb_local_table_info(NdbTableImpl *table_impl, Uint32 sz) { m_table_impl= table_impl; if (sz) m_local_data= malloc(sz); else m_local_data= 0; } Ndb_local_table_info::~Ndb_local_table_info() { if (m_local_data) free(m_local_data); } LocalDictCache::LocalDictCache(){ m_tableHash.createHashTable(); } Loading @@ -29,22 +44,24 @@ LocalDictCache::~LocalDictCache(){ m_tableHash.releaseHashTable(); } NdbTableImpl * Ndb_local_table_info * LocalDictCache::get(const char * name){ const Uint32 len = strlen(name); return m_tableHash.getData(name, len); } void LocalDictCache::put(const char * name, NdbTableImpl * tab){ const Uint32 id = tab->m_tableId; LocalDictCache::put(const char * name, Ndb_local_table_info * tab_info){ const Uint32 id = tab_info->m_table_impl->m_tableId; m_tableHash.insertKey(name, strlen(name), id, tab); m_tableHash.insertKey(name, strlen(name), id, tab_info); } void LocalDictCache::drop(const char * name){ m_tableHash.deleteKey(name, strlen(name)); Ndb_local_table_info *info= m_tableHash.deleteKey(name, strlen(name)); DBUG_ASSERT(info != 0); delete info; } /***************************************************************** Loading
ndb/src/ndbapi/DictCache.hpp +13 −3 Original line number Diff line number Diff line Loading @@ -27,6 +27,16 @@ #include <Ndb.hpp> #include "NdbLinHash.hpp" class Ndb_local_table_info { public: Ndb_local_table_info(NdbTableImpl *table_impl, Uint32 sz=0); ~Ndb_local_table_info(); NdbTableImpl *m_table_impl; Uint64 m_first_tuple_id; Uint64 m_last_tuple_id; void *m_local_data; }; /** * A non thread safe dict cache */ Loading @@ -35,12 +45,12 @@ public: LocalDictCache(); ~LocalDictCache(); NdbTableImpl * get(const char * name); Ndb_local_table_info * get(const char * name); void put(const char * name, NdbTableImpl *); void put(const char * name, Ndb_local_table_info *); void drop(const char * name); NdbLinHash<NdbTableImpl> m_tableHash; // On name NdbLinHash<Ndb_local_table_info> m_tableHash; // On name }; /** Loading