Commit ba1cde5c authored by mskold@mysql.com's avatar mskold@mysql.com

Merge mskold@bk-internal.mysql.com:/home/bk/mysql-5.0

into mysql.com:/usr/local/home/marty/MySQL/mysql-5.0
parents 9cfa9b91 9626f021
......@@ -2201,7 +2201,8 @@ ulint
dict_foreign_add_to_cache(
/*======================*/
/* out: DB_SUCCESS or error code */
dict_foreign_t* foreign) /* in, own: foreign key constraint */
dict_foreign_t* foreign, /* in, own: foreign key constraint */
ibool check_types) /* in: TRUE=check type compatibility */
{
dict_table_t* for_table;
dict_table_t* ref_table;
......@@ -2237,10 +2238,16 @@ dict_foreign_add_to_cache(
}
if (for_in_cache->referenced_table == NULL && ref_table) {
dict_index_t* types_idx;
if (check_types) {
types_idx = for_in_cache->foreign_index;
} else {
types_idx = NULL;
}
index = dict_foreign_find_index(ref_table,
(const char**) for_in_cache->referenced_col_names,
for_in_cache->n_fields,
for_in_cache->foreign_index);
types_idx);
if (index == NULL) {
dict_foreign_error_report(ef, for_in_cache,
......@@ -2264,10 +2271,16 @@ dict_foreign_add_to_cache(
}
if (for_in_cache->foreign_table == NULL && for_table) {
dict_index_t* types_idx;
if (check_types) {
types_idx = for_in_cache->referenced_index;
} else {
types_idx = NULL;
}
index = dict_foreign_find_index(for_table,
(const char**) for_in_cache->foreign_col_names,
for_in_cache->n_fields,
for_in_cache->referenced_index);
types_idx);
if (index == NULL) {
dict_foreign_error_report(ef, for_in_cache,
......
......@@ -868,7 +868,7 @@ dict_load_table(
dict_load_indexes(table, heap);
err = dict_load_foreigns(table->name);
err = dict_load_foreigns(table->name, TRUE);
/*
if (err != DB_SUCCESS) {
......@@ -1089,8 +1089,9 @@ ulint
dict_load_foreign(
/*==============*/
/* out: DB_SUCCESS or error code */
const char* id) /* in: foreign constraint id as a
const char* id, /* in: foreign constraint id as a
null-terminated string */
ibool check_types)/* in: TRUE=check type compatibility */
{
dict_foreign_t* foreign;
dict_table_t* sys_foreign;
......@@ -1102,7 +1103,6 @@ dict_load_foreign(
rec_t* rec;
byte* field;
ulint len;
ulint err;
mtr_t mtr;
#ifdef UNIV_SYNC_DEBUG
......@@ -1204,9 +1204,7 @@ dict_load_foreign(
a new foreign key constraint but loading one from the data
dictionary. */
err = dict_foreign_add_to_cache(foreign);
return(err);
return(dict_foreign_add_to_cache(foreign, check_types));
}
/***************************************************************************
......@@ -1220,7 +1218,8 @@ ulint
dict_load_foreigns(
/*===============*/
/* out: DB_SUCCESS or error code */
const char* table_name) /* in: table name */
const char* table_name, /* in: table name */
ibool check_types) /* in: TRUE=check type compatibility */
{
btr_pcur_t pcur;
mem_heap_t* heap;
......@@ -1320,7 +1319,7 @@ dict_load_foreigns(
/* Load the foreign constraint definition to the dictionary cache */
err = dict_load_foreign(id);
err = dict_load_foreign(id, check_types);
if (err != DB_SUCCESS) {
btr_pcur_close(&pcur);
......
......@@ -189,7 +189,8 @@ ulint
dict_foreign_add_to_cache(
/*======================*/
/* out: DB_SUCCESS or error code */
dict_foreign_t* foreign); /* in, own: foreign key constraint */
dict_foreign_t* foreign, /* in, own: foreign key constraint */
ibool check_types); /* in: TRUE=check type compatibility */
/*************************************************************************
Checks if a table is referenced by foreign keys. */
......
......@@ -81,7 +81,8 @@ ulint
dict_load_foreigns(
/*===============*/
/* out: DB_SUCCESS or error code */
const char* table_name); /* in: table name */
const char* table_name, /* in: table name */
ibool check_types); /* in: TRUE=check type compatibility */
/************************************************************************
Prints to the standard output information on all tables found in the data
dictionary system table. */
......
......@@ -2075,7 +2075,7 @@ row_table_add_foreign_constraints(
if (err == DB_SUCCESS) {
/* Check that also referencing constraints are ok */
err = dict_load_foreigns(name);
err = dict_load_foreigns(name, trx->check_foreigns);
}
if (err != DB_SUCCESS) {
......@@ -3784,6 +3784,8 @@ row_rename_table_for_mysql(
goto funct_exit;
}
err = dict_load_foreigns(new_name, trx->check_foreigns);
if (row_is_mysql_tmp_table_name(old_name)) {
/* MySQL is doing an ALTER TABLE command and it
......@@ -3793,8 +3795,6 @@ row_rename_table_for_mysql(
table. But we want to load also the foreign key
constraint definitions for the original table name. */
err = dict_load_foreigns(new_name);
if (err != DB_SUCCESS) {
ut_print_timestamp(stderr);
fputs(" InnoDB: Error: in ALTER TABLE ",
......@@ -3813,8 +3813,6 @@ row_rename_table_for_mysql(
trx->error_state = DB_SUCCESS;
}
} else {
err = dict_load_foreigns(new_name);
if (err != DB_SUCCESS) {
ut_print_timestamp(stderr);
......
......@@ -972,7 +972,8 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend)
info->checksum=mi_checksum(info,record);
if (param->testflag & (T_EXTEND | T_MEDIUM | T_VERBOSE))
{
if (_mi_rec_check(info,record, info->rec_buff,block_info.rec_len))
if (_mi_rec_check(info,record, info->rec_buff,block_info.rec_len,
test(info->s->calc_checksum)))
{
mi_check_print_error(param,"Found wrong packed record at %s",
llstr(start_recpos,llbuff));
......@@ -3025,7 +3026,9 @@ static int sort_get_next_record(MI_SORT_PARAM *sort_param)
if ((param->testflag & (T_EXTEND | T_REP)) || searching)
{
if (_mi_rec_check(info, sort_param->record, sort_param->rec_buff,
sort_param->find_length))
sort_param->find_length,
(param->testflag & T_QUICK) &&
test(info->s->calc_checksum)))
{
mi_check_print_info(param,"Found wrong packed record at %s",
llstr(sort_param->start_recpos,llbuff));
......
......@@ -816,7 +816,7 @@ uint _mi_rec_pack(MI_INFO *info, register byte *to, register const byte *from)
*/
my_bool _mi_rec_check(MI_INFO *info,const char *record, byte *rec_buff,
ulong packed_length)
ulong packed_length, my_bool with_checksum)
{
uint length,new_length,flag,bit,i;
char *pos,*end,*packpos,*to;
......@@ -920,13 +920,10 @@ my_bool _mi_rec_check(MI_INFO *info,const char *record, byte *rec_buff,
if (packed_length != (uint) (to - rec_buff) + test(info->s->calc_checksum) ||
(bit != 1 && (flag & ~(bit - 1))))
goto err;
if (info->s->calc_checksum)
if (with_checksum && ((uchar) info->checksum != (uchar) *to))
{
if ((uchar) info->checksum != (uchar) *to)
{
DBUG_PRINT("error",("wrong checksum for row"));
goto err;
}
DBUG_PRINT("error",("wrong checksum for row"));
goto err;
}
DBUG_RETURN(0);
......
......@@ -584,7 +584,7 @@ extern byte *mi_alloc_rec_buff(MI_INFO *,ulong, byte**);
extern ulong _mi_rec_unpack(MI_INFO *info,byte *to,byte *from,
ulong reclength);
extern my_bool _mi_rec_check(MI_INFO *info,const char *record, byte *packpos,
ulong reclength);
ulong packed_length, my_bool with_checkum);
extern int _mi_write_part_record(MI_INFO *info,my_off_t filepos,ulong length,
my_off_t next_filepos,byte **record,
ulong *reclength,int *flag);
......
......@@ -69,6 +69,9 @@
#include <signaldata/FsOpenReq.hpp>
#include <DebuggerNames.hpp>
#include <EventLogger.hpp>
extern EventLogger g_eventLogger;
#define SYSFILE ((Sysfile *)&sysfileData[0])
#define RETURN_IF_NODE_NOT_ALIVE(node) \
......@@ -13131,6 +13134,48 @@ Dbdih::execDUMP_STATE_ORD(Signal* signal)
}
}
}
if(dumpState->args[0] == 7019 && signal->getLength() == 2)
{
char buf2[8+1];
NodeRecordPtr nodePtr;
nodePtr.i = signal->theData[1];
ptrCheckGuard(nodePtr, MAX_NDB_NODES, nodeRecord);
infoEvent("NF Node %d tc: %d lqh: %d dih: %d dict: %d recNODE_FAILREP: %d",
nodePtr.i,
nodePtr.p->dbtcFailCompleted,
nodePtr.p->dblqhFailCompleted,
nodePtr.p->dbdihFailCompleted,
nodePtr.p->dbdictFailCompleted,
nodePtr.p->recNODE_FAILREP);
infoEvent(" m_NF_COMPLETE_REP: %s m_nodefailSteps: %s",
nodePtr.p->m_NF_COMPLETE_REP.getText(),
nodePtr.p->m_nodefailSteps.getText(buf2));
}
if(dumpState->args[0] == 7020 && signal->getLength() > 3)
{
Uint32 gsn= signal->theData[1];
Uint32 block= signal->theData[2];
Uint32 length= signal->length() - 3;
memmove(signal->theData, signal->theData+3, 4*length);
sendSignal(numberToRef(block, getOwnNodeId()), gsn, signal, length, JBB);
warningEvent("-- SENDING CUSTOM SIGNAL --");
char buf[100], buf2[100];
buf2[0]= 0;
for(Uint32 i = 0; i<length; i++)
{
snprintf(buf, 100, "%s %.8x", buf2, signal->theData[i]);
snprintf(buf2, 100, "%s", buf);
}
warningEvent("gsn: %d block: %s, length: %d theData: %s",
gsn, getBlockName(block, "UNKNOWN"), length, buf);
g_eventLogger.warning("-- SENDING CUSTOM SIGNAL --");
g_eventLogger.warning("gsn: %d block: %s, length: %d theData: %s",
gsn, getBlockName(block, "UNKNOWN"), length, buf);
}
if(dumpState->args[0] == DumpStateOrd::DihDumpLCPState){
infoEvent("-- Node %d LCP STATE --", getOwnNodeId());
......
......@@ -61,7 +61,9 @@ int main(int argc, char** argv)
// Print to stdout/console
g_eventLogger.createConsoleHandler();
g_eventLogger.setCategory("NDB");
g_eventLogger.enable(Logger::LL_ON, Logger::LL_CRITICAL);
g_eventLogger.enable(Logger::LL_ON, Logger::LL_ERROR);
g_eventLogger.enable(Logger::LL_ON, Logger::LL_WARNING);
globalEmulatorData.create();
......
......@@ -2078,7 +2078,7 @@ MgmtSrvr::handleStopReply(NodeId nodeId, Uint32 errCode)
}
void
MgmtSrvr::handleStatus(NodeId nodeId, bool alive)
MgmtSrvr::handleStatus(NodeId nodeId, bool alive, bool nfComplete)
{
DBUG_ENTER("MgmtSrvr::handleStatus");
Uint32 theData[25];
......@@ -2087,9 +2087,14 @@ MgmtSrvr::handleStatus(NodeId nodeId, bool alive)
m_started_nodes.push_back(nodeId);
theData[0] = NDB_LE_Connected;
} else {
handleStopReply(nodeId, 0);
theData[0] = NDB_LE_Disconnected;
if(nfComplete)
{
handleStopReply(nodeId, 0);
DBUG_VOID_RETURN;
}
}
eventReport(_ownNodeId, theData);
DBUG_VOID_RETURN;
}
......@@ -2114,8 +2119,7 @@ MgmtSrvr::nodeStatusNotification(void* mgmSrv, Uint32 nodeId,
{
DBUG_ENTER("MgmtSrvr::nodeStatusNotification");
DBUG_PRINT("enter",("nodeid= %d, alive= %d, nfComplete= %d", nodeId, alive, nfComplete));
if(!(!alive && nfComplete))
((MgmtSrvr*)mgmSrv)->handleStatus(nodeId, alive);
((MgmtSrvr*)mgmSrv)->handleStatus(nodeId, alive, nfComplete);
DBUG_VOID_RETURN;
}
......
......@@ -584,7 +584,7 @@ private:
// Returns: -
//**************************************************************************
void handleStatus(NodeId nodeId, bool alive);
void handleStatus(NodeId nodeId, bool alive, bool nfComplete);
//**************************************************************************
// Description: Handle the death of a process
// Parameters:
......
......@@ -761,7 +761,7 @@ Ndb::getAutoIncrementValue(const char* aTableName, Uint32 cacheSize)
Ndb_local_table_info *info=
theDictionary->get_local_table_info(internalTableName, false);
if (info == 0)
DBUG_RETURN(~0);
DBUG_RETURN(~(Uint64)0);
const NdbTableImpl *table= info->m_table_impl;
Uint64 tupleId = getTupleIdFromNdb(table->m_tableId, cacheSize);
DBUG_PRINT("info", ("value %u", tupleId));
......@@ -773,7 +773,7 @@ Ndb::getAutoIncrementValue(const NdbDictionary::Table * aTable, Uint32 cacheSize
{
DBUG_ENTER("getAutoIncrementValue");
if (aTable == 0)
DBUG_RETURN(~0);
DBUG_RETURN(~(Uint64)0);
const NdbTableImpl* table = & NdbTableImpl::getImpl(*aTable);
Uint64 tupleId = getTupleIdFromNdb(table->m_tableId, cacheSize);
DBUG_PRINT("info", ("value %u", tupleId));
......@@ -785,7 +785,7 @@ Ndb::getTupleIdFromNdb(const char* aTableName, Uint32 cacheSize)
{
const NdbTableImpl* table = theDictionary->getTable(aTableName);
if (table == 0)
return ~0;
return ~(Uint64)0;
return getTupleIdFromNdb(table->m_tableId, cacheSize);
}
......@@ -814,7 +814,7 @@ Ndb::readAutoIncrementValue(const char* aTableName)
const NdbTableImpl* table = theDictionary->getTable(aTableName);
if (table == 0) {
theError= theDictionary->getNdbError();
DBUG_RETURN(~0);
DBUG_RETURN(~(Uint64)0);
}
Uint64 tupleId = readTupleIdFromNdb(table->m_tableId);
DBUG_PRINT("info", ("value %u", tupleId));
......@@ -826,7 +826,7 @@ Ndb::readAutoIncrementValue(const NdbDictionary::Table * aTable)
{
DBUG_ENTER("readtAutoIncrementValue");
if (aTable == 0)
DBUG_RETURN(~0);
DBUG_RETURN(~(Uint64)0);
const NdbTableImpl* table = & NdbTableImpl::getImpl(*aTable);
Uint64 tupleId = readTupleIdFromNdb(table->m_tableId);
DBUG_PRINT("info", ("value %u", tupleId));
......@@ -863,7 +863,7 @@ Ndb::setAutoIncrementValue(const NdbDictionary::Table * aTable, Uint64 val, bool
{
DEBUG_TRACE("setAutoIncrementValue " << val);
if (aTable == 0)
return ~0;
return ~(Uint64)0;
const NdbTableImpl* table = & NdbTableImpl::getImpl(*aTable);
return setTupleIdInNdb(table->m_tableId, val, increase);
}
......@@ -1018,7 +1018,7 @@ Ndb::opTupleIdOnNdb(Uint32 aTableId, Uint64 opValue, Uint32 op)
theError.code,
tConnection ? tConnection->theError.code : -1,
tOperation ? tOperation->theError.code : -1));
DBUG_RETURN(~0);
DBUG_RETURN(~(Uint64)0);
}
Uint32
......
......@@ -4673,6 +4673,10 @@ ha_innobase::rename_table(
trx->mysql_thd = current_thd;
trx->mysql_query_str = &((*current_thd).query);
if (current_thd->options & OPTION_NO_FOREIGN_KEY_CHECKS) {
trx->check_foreigns = FALSE;
}
name_len1 = strlen(from);
name_len2 = strlen(to);
......
......@@ -1976,7 +1976,7 @@ int ha_ndbcluster::write_row(byte *record)
m_rows_inserted++;
no_uncommitted_rows_update(1);
m_bulk_insert_not_flushed= TRUE;
if ((m_rows_to_insert == 1) ||
if ((m_rows_to_insert == (ha_rows) 1) ||
((m_rows_inserted % m_bulk_insert_rows) == 0) ||
set_blob_value)
{
......@@ -2992,8 +2992,8 @@ void ha_ndbcluster::start_bulk_insert(ha_rows rows)
DBUG_ENTER("start_bulk_insert");
DBUG_PRINT("enter", ("rows: %d", (int)rows));
m_rows_inserted= 0;
if (rows == 0)
m_rows_inserted= (ha_rows) 0;
if (rows == (ha_rows) 0)
/* We don't know how many will be inserted, guess */
m_rows_to_insert= m_autoincrement_prefetch;
else
......@@ -3031,7 +3031,7 @@ int ha_ndbcluster::end_bulk_insert()
// Send rows to NDB
DBUG_PRINT("info", ("Sending inserts to NDB, "\
"rows_inserted:%d, bulk_insert_rows: %d",
m_rows_inserted, m_bulk_insert_rows));
(int) m_rows_inserted, (int) m_bulk_insert_rows));
m_bulk_insert_not_flushed= FALSE;
if (execute_no_commit(this,trans) != 0) {
no_uncommitted_rows_execute_failure();
......@@ -3039,8 +3039,8 @@ int ha_ndbcluster::end_bulk_insert()
}
}
m_rows_inserted= 0;
m_rows_to_insert= 1;
m_rows_inserted= (ha_rows) 0;
m_rows_to_insert= (ha_rows) 1;
DBUG_RETURN(error);
}
......@@ -3222,7 +3222,8 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type)
// store thread specific data first to set the right context
m_force_send= thd->variables.ndb_force_send;
m_ha_not_exact_count= !thd->variables.ndb_use_exact_count;
m_autoincrement_prefetch= thd->variables.ndb_autoincrement_prefetch_sz;
m_autoincrement_prefetch=
(ha_rows) thd->variables.ndb_autoincrement_prefetch_sz;
if (!thd->transaction.on)
m_transaction_on= FALSE;
else
......@@ -3746,7 +3747,7 @@ static int create_ndb_column(NDBCOL &col,
static void ndb_set_fragmentation(NDBTAB &tab, TABLE *form, uint pk_length)
{
if (form->s->max_rows == 0) /* default setting, don't set fragmentation */
if (form->s->max_rows == (ha_rows) 0) /* default setting, don't set fragmentation */
return;
/**
* get the number of fragments right
......@@ -4112,6 +4113,7 @@ ulonglong ha_ndbcluster::get_auto_increment()
/* We guessed too low */
m_rows_to_insert+= m_autoincrement_prefetch;
cache_size=
(int)
(m_rows_to_insert - m_rows_inserted < m_autoincrement_prefetch) ?
m_rows_to_insert - m_rows_inserted
: (m_rows_to_insert > m_autoincrement_prefetch) ?
......@@ -4148,10 +4150,10 @@ ha_ndbcluster::ha_ndbcluster(TABLE *table_arg):
m_primary_key_update(FALSE),
m_retrieve_all_fields(FALSE),
m_retrieve_primary_key(FALSE),
m_rows_to_insert(1),
m_rows_inserted(0),
m_bulk_insert_rows(1024),
m_rows_changed(0),
m_rows_to_insert((ha_rows) 1),
m_rows_inserted((ha_rows) 0),
m_bulk_insert_rows((ha_rows) 1024),
m_rows_changed((ha_rows) 0),
m_bulk_insert_not_flushed(FALSE),
m_ops_pending(0),
m_skip_auto_increment(TRUE),
......@@ -4161,7 +4163,7 @@ ha_ndbcluster::ha_ndbcluster(TABLE *table_arg):
m_dupkey((uint) -1),
m_ha_not_exact_count(FALSE),
m_force_send(TRUE),
m_autoincrement_prefetch(32),
m_autoincrement_prefetch((ha_rows) 32),
m_transaction_on(TRUE),
m_cond_stack(NULL),
m_multi_cursor(NULL)
......
......@@ -4707,7 +4707,7 @@ Disable with --skip-ndbcluster (will save memory).",
"Specify number of autoincrement values that are prefetched.",
(gptr*) &global_system_variables.ndb_autoincrement_prefetch_sz,
(gptr*) &global_system_variables.ndb_autoincrement_prefetch_sz,
0, GET_INT, REQUIRED_ARG, 32, 1, 256, 0, 0, 0},
0, GET_ULONG, REQUIRED_ARG, 32, 1, 256, 0, 0, 0},
{"ndb-force-send", OPT_NDB_FORCE_SEND,
"Force send of buffers to ndb immediately without waiting for "
"other threads.",
......
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