Merge istruewing@bk-internal.mysql.com:/home/bk/mysql-4.1
into chilla.local:/home/mydev/mysql-4.1
This commit is contained in:
commit
0b3db56164
@ -270,6 +270,7 @@ void ha_ndbcluster::records_update()
|
|||||||
{
|
{
|
||||||
Ndb *ndb= get_ndb();
|
Ndb *ndb= get_ndb();
|
||||||
Uint64 rows;
|
Uint64 rows;
|
||||||
|
ndb->setDatabaseName(m_dbname);
|
||||||
if(ndb_get_table_statistics(ndb, m_tabname, &rows, 0) == 0){
|
if(ndb_get_table_statistics(ndb, m_tabname, &rows, 0) == 0){
|
||||||
info->records= rows;
|
info->records= rows;
|
||||||
}
|
}
|
||||||
@ -2876,6 +2877,7 @@ void ha_ndbcluster::info(uint flag)
|
|||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
Ndb *ndb= get_ndb();
|
Ndb *ndb= get_ndb();
|
||||||
Uint64 rows= 100;
|
Uint64 rows= 100;
|
||||||
|
ndb->setDatabaseName(m_dbname);
|
||||||
if (current_thd->variables.ndb_use_exact_count)
|
if (current_thd->variables.ndb_use_exact_count)
|
||||||
ndb_get_table_statistics(ndb, m_tabname, &rows, 0);
|
ndb_get_table_statistics(ndb, m_tabname, &rows, 0);
|
||||||
records= rows;
|
records= rows;
|
||||||
@ -5228,34 +5230,53 @@ ndb_get_table_statistics(Ndb* ndb, const char * table,
|
|||||||
{
|
{
|
||||||
DBUG_ENTER("ndb_get_table_statistics");
|
DBUG_ENTER("ndb_get_table_statistics");
|
||||||
DBUG_PRINT("enter", ("table: %s", table));
|
DBUG_PRINT("enter", ("table: %s", table));
|
||||||
NdbConnection* pTrans= ndb->startTransaction();
|
NdbConnection* pTrans;
|
||||||
do
|
NdbError error;
|
||||||
|
int retries= 10;
|
||||||
|
int retry_sleep= 30 * 1000; /* 30 milliseconds */
|
||||||
|
|
||||||
|
do
|
||||||
{
|
{
|
||||||
if (pTrans == NULL)
|
|
||||||
break;
|
|
||||||
|
|
||||||
NdbScanOperation* pOp= pTrans->getNdbScanOperation(table);
|
|
||||||
if (pOp == NULL)
|
|
||||||
break;
|
|
||||||
|
|
||||||
NdbResultSet* rs= pOp->readTuples(NdbOperation::LM_CommittedRead);
|
|
||||||
if (rs == 0)
|
|
||||||
break;
|
|
||||||
|
|
||||||
int check= pOp->interpret_exit_last_row();
|
|
||||||
if (check == -1)
|
|
||||||
break;
|
|
||||||
|
|
||||||
Uint64 rows, commits;
|
Uint64 rows, commits;
|
||||||
|
Uint64 sum_rows= 0;
|
||||||
|
Uint64 sum_commits= 0;
|
||||||
|
NdbScanOperation*pOp;
|
||||||
|
NdbResultSet *rs;
|
||||||
|
int check;
|
||||||
|
|
||||||
|
if ((pTrans= ndb->startTransaction()) == NULL)
|
||||||
|
{
|
||||||
|
error= ndb->getNdbError();
|
||||||
|
goto retry;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((pOp= pTrans->getNdbScanOperation(table)) == NULL)
|
||||||
|
{
|
||||||
|
error= pTrans->getNdbError();
|
||||||
|
goto retry;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((rs= pOp->readTuples(NdbOperation::LM_CommittedRead)) == 0)
|
||||||
|
{
|
||||||
|
error= pOp->getNdbError();
|
||||||
|
goto retry;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pOp->interpret_exit_last_row() == -1)
|
||||||
|
{
|
||||||
|
error= pOp->getNdbError();
|
||||||
|
goto retry;
|
||||||
|
}
|
||||||
|
|
||||||
pOp->getValue(NdbDictionary::Column::ROW_COUNT, (char*)&rows);
|
pOp->getValue(NdbDictionary::Column::ROW_COUNT, (char*)&rows);
|
||||||
pOp->getValue(NdbDictionary::Column::COMMIT_COUNT, (char*)&commits);
|
pOp->getValue(NdbDictionary::Column::COMMIT_COUNT, (char*)&commits);
|
||||||
|
|
||||||
check= pTrans->execute(NoCommit, AbortOnError, TRUE);
|
if (pTrans->execute(NoCommit, AbortOnError, TRUE) == -1)
|
||||||
if (check == -1)
|
{
|
||||||
break;
|
error= pTrans->getNdbError();
|
||||||
|
goto retry;
|
||||||
|
}
|
||||||
|
|
||||||
Uint64 sum_rows= 0;
|
|
||||||
Uint64 sum_commits= 0;
|
|
||||||
while((check= rs->nextResult(TRUE, TRUE)) == 0)
|
while((check= rs->nextResult(TRUE, TRUE)) == 0)
|
||||||
{
|
{
|
||||||
sum_rows+= rows;
|
sum_rows+= rows;
|
||||||
@ -5263,7 +5284,10 @@ ndb_get_table_statistics(Ndb* ndb, const char * table,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (check == -1)
|
if (check == -1)
|
||||||
break;
|
{
|
||||||
|
error= pOp->getNdbError();
|
||||||
|
goto retry;
|
||||||
|
}
|
||||||
|
|
||||||
rs->close(TRUE);
|
rs->close(TRUE);
|
||||||
|
|
||||||
@ -5274,11 +5298,22 @@ ndb_get_table_statistics(Ndb* ndb, const char * table,
|
|||||||
* commit_count= sum_commits;
|
* commit_count= sum_commits;
|
||||||
DBUG_PRINT("exit", ("records: %u commits: %u", sum_rows, sum_commits));
|
DBUG_PRINT("exit", ("records: %u commits: %u", sum_rows, sum_commits));
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
} while(0);
|
|
||||||
|
|
||||||
ndb->closeTransaction(pTrans);
|
retry:
|
||||||
DBUG_PRINT("exit", ("failed"));
|
if (pTrans)
|
||||||
DBUG_RETURN(-1);
|
{
|
||||||
|
ndb->closeTransaction(pTrans);
|
||||||
|
pTrans= NULL;
|
||||||
|
}
|
||||||
|
if (error.status == NdbError::TemporaryError && retries--)
|
||||||
|
{
|
||||||
|
my_sleep(retry_sleep);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
} while(1);
|
||||||
|
DBUG_PRINT("exit", ("failed, error %u(%s)", error.code, error.message));
|
||||||
|
ERR_RETURN(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -496,11 +496,13 @@ void close_temporary_tables(THD *thd)
|
|||||||
TABLE *table;
|
TABLE *table;
|
||||||
if (!thd->temporary_tables)
|
if (!thd->temporary_tables)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!mysql_bin_log.is_open())
|
if (!mysql_bin_log.is_open())
|
||||||
{
|
{
|
||||||
for (table= thd->temporary_tables; table; table= table->next)
|
TABLE *next;
|
||||||
|
for (table= thd->temporary_tables; table; table= next)
|
||||||
{
|
{
|
||||||
|
next= table->next;
|
||||||
close_temporary(table, 1);
|
close_temporary(table, 1);
|
||||||
}
|
}
|
||||||
thd->temporary_tables= 0;
|
thd->temporary_tables= 0;
|
||||||
@ -518,7 +520,7 @@ void close_temporary_tables(THD *thd)
|
|||||||
String s_query= String(buf, sizeof(buf), system_charset_info);
|
String s_query= String(buf, sizeof(buf), system_charset_info);
|
||||||
bool found_user_tables= false;
|
bool found_user_tables= false;
|
||||||
LINT_INIT(next);
|
LINT_INIT(next);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
insertion sort of temp tables by pseudo_thread_id to build ordered list
|
insertion sort of temp tables by pseudo_thread_id to build ordered list
|
||||||
of sublists of equal pseudo_thread_id
|
of sublists of equal pseudo_thread_id
|
||||||
|
Loading…
x
Reference in New Issue
Block a user