Commit b51118aa authored by unknown's avatar unknown
Browse files

Merge tulin@bk-internal.mysql.com:/home/bk/mysql-4.1

into poseidon.(none):/home/tomas/mysql-4.1-ndb-merge

parents 37125a77 86dc9605
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -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
@@ -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
@@ -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
+2 −2
Original line number Diff line number Diff line
@@ -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
@@ -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)
+3 −0
Original line number Diff line number Diff line
@@ -1066,6 +1066,9 @@ public:
    Dictionary(NdbDictionaryImpl&);
    const Table * getIndexTable(const char * indexName, 
				const char * tableName);
  public:
    const Table * getTable(const char * name, void **data);
    void set_local_table_data_size(unsigned sz);
  };
};

+35 −31
Original line number Diff line number Diff line
@@ -33,6 +33,10 @@
 * Section names
 ****************************************************************************/

#define DB_TOKEN_PRINT  "ndbd(DB)"
#define MGM_TOKEN_PRINT "ndb_mgmd(MGM)"
#define API_TOKEN_PRINT "mysqld(API)"

#define DB_TOKEN "DB"
#define MGM_TOKEN "MGM"
#define API_TOKEN "API"
@@ -327,7 +331,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
    CFG_SYS_PRIMARY_MGM_NODE,
    "PrimaryMGMNode",
    "SYSTEM",
    "Node id of Primary "MGM_TOKEN" node",
    "Node id of Primary "MGM_TOKEN_PRINT" node",
    ConfigInfo::USED,
    false,
    ConfigInfo::INT,
@@ -388,7 +392,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
    CFG_NODE_ID,
    "Id",
    DB_TOKEN,
    "Number identifying the database node ("DB_TOKEN")",
    "Number identifying the database node ("DB_TOKEN_PRINT")",
    ConfigInfo::USED,
    false,
    ConfigInfo::INT,
@@ -484,7 +488,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
    CFG_DB_NO_INDEX_OPS,
    "MaxNoOfConcurrentIndexOperations",
    DB_TOKEN,
    "Total number of index operations that can execute simultaneously on one "DB_TOKEN" node",
    "Total number of index operations that can execute simultaneously on one "DB_TOKEN_PRINT" node",
    ConfigInfo::USED,
    false,
    ConfigInfo::INT,
@@ -509,7 +513,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
    CFG_DB_NO_TRIGGER_OPS,
    "MaxNoOfFiredTriggers",
    DB_TOKEN,
    "Total number of triggers that can fire simultaneously in one "DB_TOKEN" node",
    "Total number of triggers that can fire simultaneously in one "DB_TOKEN_PRINT" node",
    ConfigInfo::USED,
    false,
    ConfigInfo::INT,
@@ -568,7 +572,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
    CFG_DB_STOP_ON_ERROR,
    "StopOnError",
    DB_TOKEN,
    "If set to N, "DB_TOKEN" automatically restarts/recovers in case of node failure",
    "If set to N, "DB_TOKEN_PRINT" automatically restarts/recovers in case of node failure",
    ConfigInfo::USED,
    true,
    ConfigInfo::BOOL,
@@ -640,7 +644,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
    CFG_DB_NO_TRANSACTIONS,
    "MaxNoOfConcurrentTransactions",
    DB_TOKEN,
    "Max number of transaction executing concurrently on the "DB_TOKEN" node",
    "Max number of transaction executing concurrently on the "DB_TOKEN_PRINT" node",
    ConfigInfo::USED,
    false,
    ConfigInfo::INT,
@@ -652,7 +656,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
    CFG_DB_NO_SCANS,
    "MaxNoOfConcurrentScans",
    DB_TOKEN,
    "Max number of scans executing concurrently on the "DB_TOKEN" node",
    "Max number of scans executing concurrently on the "DB_TOKEN_PRINT" node",
    ConfigInfo::USED,
    false,
    ConfigInfo::INT,
@@ -664,7 +668,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
    CFG_DB_TRANS_BUFFER_MEM,
    "TransactionBufferMemory",
    DB_TOKEN,
    "Dynamic buffer space (in bytes) for key and attribute data allocated for each "DB_TOKEN" node",
    "Dynamic buffer space (in bytes) for key and attribute data allocated for each "DB_TOKEN_PRINT" node",
    ConfigInfo::USED,
    false,
    ConfigInfo::INT,
@@ -676,7 +680,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
    CFG_DB_INDEX_MEM,
    "IndexMemory",
    DB_TOKEN,
    "Number bytes on each "DB_TOKEN" node allocated for storing indexes",
    "Number bytes on each "DB_TOKEN_PRINT" node allocated for storing indexes",
    ConfigInfo::USED,
    false,
    ConfigInfo::INT64,
@@ -688,7 +692,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
    CFG_DB_DATA_MEM,
    "DataMemory",
    DB_TOKEN,
    "Number bytes on each "DB_TOKEN" node allocated for storing data",
    "Number bytes on each "DB_TOKEN_PRINT" node allocated for storing data",
    ConfigInfo::USED,
    false,
    ConfigInfo::INT64,
@@ -700,7 +704,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
    CFG_DB_UNDO_INDEX_BUFFER,
    "UndoIndexBuffer",
    DB_TOKEN,
    "Number bytes on each "DB_TOKEN" node allocated for writing UNDO logs for index part",
    "Number bytes on each "DB_TOKEN_PRINT" node allocated for writing UNDO logs for index part",
    ConfigInfo::USED,
    false,
    ConfigInfo::INT,
@@ -712,7 +716,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
    CFG_DB_UNDO_DATA_BUFFER,
    "UndoDataBuffer",
    DB_TOKEN,
    "Number bytes on each "DB_TOKEN" node allocated for writing UNDO logs for data part",
    "Number bytes on each "DB_TOKEN_PRINT" node allocated for writing UNDO logs for data part",
    ConfigInfo::USED,
    false,
    ConfigInfo::INT,
@@ -724,7 +728,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
    CFG_DB_REDO_BUFFER,
    "RedoBuffer",
    DB_TOKEN,
    "Number bytes on each "DB_TOKEN" node allocated for writing REDO logs",
    "Number bytes on each "DB_TOKEN_PRINT" node allocated for writing REDO logs",
    ConfigInfo::USED,
    false,
    ConfigInfo::INT,
@@ -736,7 +740,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
    CFG_DB_LONG_SIGNAL_BUFFER,
    "LongMessageBuffer",
    DB_TOKEN,
    "Number bytes on each "DB_TOKEN" node allocated for internal long messages",
    "Number bytes on each "DB_TOKEN_PRINT" node allocated for internal long messages",
    ConfigInfo::USED,
    false,
    ConfigInfo::INT,
@@ -784,7 +788,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
    CFG_DB_HEARTBEAT_INTERVAL,
    "HeartbeatIntervalDbDb",
    DB_TOKEN,
    "Time between "DB_TOKEN"-"DB_TOKEN" heartbeats. "DB_TOKEN" considered dead after 3 missed HBs",
    "Time between "DB_TOKEN_PRINT"-"DB_TOKEN_PRINT" heartbeats. "DB_TOKEN_PRINT" considered dead after 3 missed HBs",
    ConfigInfo::USED,
    true,
    ConfigInfo::INT,
@@ -796,7 +800,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
    CFG_DB_API_HEARTBEAT_INTERVAL,
    "HeartbeatIntervalDbApi",
    DB_TOKEN,
    "Time between "API_TOKEN"-"DB_TOKEN" heartbeats. "API_TOKEN" connection closed after 3 missed HBs",
    "Time between "API_TOKEN_PRINT"-"DB_TOKEN_PRINT" heartbeats. "API_TOKEN_PRINT" connection closed after 3 missed HBs",
    ConfigInfo::USED,
    true,
    ConfigInfo::INT,
@@ -832,7 +836,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
    CFG_DB_NO_REDOLOG_FILES,
    "NoOfFragmentLogFiles",
    DB_TOKEN,
    "No of 16 Mbyte Redo log files in each of 4 file sets belonging to "DB_TOKEN" node",
    "No of 16 Mbyte Redo log files in each of 4 file sets belonging to "DB_TOKEN_PRINT" node",
    ConfigInfo::USED,
    false,
    ConfigInfo::INT,
@@ -844,7 +848,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
    KEY_INTERNAL,
    "MaxNoOfOpenFiles",
    DB_TOKEN,
    "Max number of files open per "DB_TOKEN" node.(One thread is created per file)",
    "Max number of files open per "DB_TOKEN_PRINT" node.(One thread is created per file)",
    ConfigInfo::USED,
    false,
    ConfigInfo::INT,
@@ -998,7 +1002,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
    CFG_DB_FILESYSTEM_PATH,
    "FileSystemPath",
    DB_TOKEN,
    "Path to directory where the "DB_TOKEN" node stores its data (directory must exist)",
    "Path to directory where the "DB_TOKEN_PRINT" node stores its data (directory must exist)",
    ConfigInfo::USED,
    false,
    ConfigInfo::STRING,
@@ -1288,7 +1292,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
    CFG_NODE_ID,
    "Id",
    API_TOKEN,
    "Number identifying application node ("API_TOKEN")",
    "Number identifying application node ("API_TOKEN_PRINT")",
    ConfigInfo::USED,
    false,
    ConfigInfo::INT,
@@ -1311,7 +1315,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
    CFG_NODE_ARBIT_RANK,
    "ArbitrationRank",
    API_TOKEN,
    "If 0, then "API_TOKEN" is not arbitrator. Kernel selects arbitrators in order 1, 2",
    "If 0, then "API_TOKEN_PRINT" is not arbitrator. Kernel selects arbitrators in order 1, 2",
    ConfigInfo::USED,
    false,
    ConfigInfo::INT,
@@ -1419,7 +1423,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
    CFG_NODE_ID,
    "Id",
    MGM_TOKEN,
    "Number identifying the management server node ("MGM_TOKEN")",
    "Number identifying the management server node ("MGM_TOKEN_PRINT")",
    ConfigInfo::USED,
    false,
    ConfigInfo::INT,
@@ -1489,7 +1493,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
    CFG_NODE_ARBIT_RANK,
    "ArbitrationRank",
    MGM_TOKEN,
    "If 0, then "MGM_TOKEN" is not arbitrator. Kernel selects arbitrators in order 1, 2",
    "If 0, then "MGM_TOKEN_PRINT" is not arbitrator. Kernel selects arbitrators in order 1, 2",
    ConfigInfo::USED,
    false,
    ConfigInfo::INT,
@@ -1550,7 +1554,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
    CFG_CONNECTION_NODE_1,
    "NodeId1",
    "TCP",
    "Id of node ("DB_TOKEN", "API_TOKEN" or "MGM_TOKEN") on one side of the connection",
    "Id of node ("DB_TOKEN_PRINT", "API_TOKEN_PRINT" or "MGM_TOKEN_PRINT") on one side of the connection",
    ConfigInfo::USED,
    false,
    ConfigInfo::STRING,
@@ -1561,7 +1565,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
    CFG_CONNECTION_NODE_2,
    "NodeId2",
    "TCP",
    "Id of node ("DB_TOKEN", "API_TOKEN" or "MGM_TOKEN") on one side of the connection",
    "Id of node ("DB_TOKEN_PRINT", "API_TOKEN_PRINT" or "MGM_TOKEN_PRINT") on one side of the connection",
    ConfigInfo::USED,
    false,
    ConfigInfo::STRING,
@@ -1681,7 +1685,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
    CFG_CONNECTION_NODE_1,
    "NodeId1",
    "SHM",
    "Id of node ("DB_TOKEN", "API_TOKEN" or "MGM_TOKEN") on one side of the connection",
    "Id of node ("DB_TOKEN_PRINT", "API_TOKEN_PRINT" or "MGM_TOKEN_PRINT") on one side of the connection",
    ConfigInfo::USED,
    false,
    ConfigInfo::STRING,
@@ -1704,7 +1708,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
    CFG_CONNECTION_NODE_2,
    "NodeId2",
    "SHM",
    "Id of node ("DB_TOKEN", "API_TOKEN" or "MGM_TOKEN") on one side of the connection",
    "Id of node ("DB_TOKEN_PRINT", "API_TOKEN_PRINT" or "MGM_TOKEN_PRINT") on one side of the connection",
    ConfigInfo::USED,
    false,
    ConfigInfo::STRING,
@@ -1801,7 +1805,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
    CFG_CONNECTION_NODE_1,
    "NodeId1",
    "SCI",
    "Id of node ("DB_TOKEN", "API_TOKEN" or "MGM_TOKEN") on one side of the connection",
    "Id of node ("DB_TOKEN_PRINT", "API_TOKEN_PRINT" or "MGM_TOKEN_PRINT") on one side of the connection",
    ConfigInfo::USED,
    false,
    ConfigInfo::INT,
@@ -1813,7 +1817,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
    CFG_CONNECTION_NODE_2,
    "NodeId2",
    "SCI",
    "Id of node ("DB_TOKEN", "API_TOKEN" or "MGM_TOKEN") on one side of the connection",
    "Id of node ("DB_TOKEN_PRINT", "API_TOKEN_PRINT" or "MGM_TOKEN_PRINT") on one side of the connection",
    ConfigInfo::USED,
    false,
    ConfigInfo::INT,
@@ -1956,7 +1960,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
    CFG_CONNECTION_NODE_1,
    "NodeId1",
    "OSE",
    "Id of node ("DB_TOKEN", "API_TOKEN" or "MGM_TOKEN") on one side of the connection",
    "Id of node ("DB_TOKEN_PRINT", "API_TOKEN_PRINT" or "MGM_TOKEN_PRINT") on one side of the connection",
    ConfigInfo::USED,
    false,
    ConfigInfo::INT,
@@ -1968,7 +1972,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
    CFG_CONNECTION_NODE_2,
    "NodeId2",
    "OSE",
    "Id of node ("DB_TOKEN", "API_TOKEN" or "MGM_TOKEN") on one side of the connection",
    "Id of node ("DB_TOKEN_PRINT", "API_TOKEN_PRINT" or "MGM_TOKEN_PRINT") on one side of the connection",
    ConfigInfo::USED,
    false,
    ConfigInfo::INT,
+32 −5
Original line number Diff line number Diff line
@@ -21,6 +21,31 @@
#include <NdbCondition.h>
#include <NdbSleep.h>

Ndb_local_table_info *
Ndb_local_table_info::create(NdbTableImpl *table_impl, Uint32 sz)
{
  void *data= malloc(sizeof(NdbTableImpl)+sz-1);
  if (data == 0)
    return 0;
  memset(data,0,sizeof(NdbTableImpl)+sz-1);
  new (data) Ndb_local_table_info(table_impl);
  return (Ndb_local_table_info *) data;
}

void Ndb_local_table_info::destroy(Ndb_local_table_info *info)
{
  free((void *)info);
}

Ndb_local_table_info::Ndb_local_table_info(NdbTableImpl *table_impl)
{
  m_table_impl= table_impl;
}

Ndb_local_table_info::~Ndb_local_table_info()
{
}

LocalDictCache::LocalDictCache(){
  m_tableHash.createHashTable();
}
@@ -29,22 +54,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);
  Ndb_local_table_info::destroy(info);
}

/*****************************************************************
Loading