Commit 9bbd51e6 authored by tomas@whalegate.ndb.mysql.com's avatar tomas@whalegate.ndb.mysql.com

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

into  whalegate.ndb.mysql.com:/home/tomas/mysql-5.0-ndb
parents 9db8459b 1e7974a0
...@@ -2309,16 +2309,24 @@ int ha_ndbcluster::write_row(byte *record) ...@@ -2309,16 +2309,24 @@ int ha_ndbcluster::write_row(byte *record)
{ {
// Table has hidden primary key // Table has hidden primary key
Ndb *ndb= get_ndb(); Ndb *ndb= get_ndb();
int ret;
Uint64 auto_value; Uint64 auto_value;
uint retries= NDB_AUTO_INCREMENT_RETRIES; uint retries= NDB_AUTO_INCREMENT_RETRIES;
do { int retry_sleep= 30; /* 30 milliseconds, transaction */
ret= ndb->getAutoIncrementValue((const NDBTAB *) m_table, auto_value, 1); for (;;)
} while (ret == -1 && {
--retries && if (ndb->getAutoIncrementValue((const NDBTAB *) m_table,
auto_value, 1) == -1)
{
if (--retries &&
ndb->getNdbError().status == NdbError::TemporaryError); ndb->getNdbError().status == NdbError::TemporaryError);
if (ret == -1) {
my_sleep(retry_sleep);
continue;
}
ERR_RETURN(ndb->getNdbError()); ERR_RETURN(ndb->getNdbError());
}
break;
}
if (set_hidden_key(op, table->s->fields, (const byte*)&auto_value)) if (set_hidden_key(op, table->s->fields, (const byte*)&auto_value))
ERR_RETURN(op->getNdbError()); ERR_RETURN(op->getNdbError());
} }
...@@ -4855,23 +4863,28 @@ ulonglong ha_ndbcluster::get_auto_increment() ...@@ -4855,23 +4863,28 @@ ulonglong ha_ndbcluster::get_auto_increment()
m_rows_to_insert - m_rows_inserted : m_rows_to_insert - m_rows_inserted :
((m_rows_to_insert > m_autoincrement_prefetch) ? ((m_rows_to_insert > m_autoincrement_prefetch) ?
m_rows_to_insert : m_autoincrement_prefetch)); m_rows_to_insert : m_autoincrement_prefetch));
int ret;
uint retries= NDB_AUTO_INCREMENT_RETRIES; uint retries= NDB_AUTO_INCREMENT_RETRIES;
do { int retry_sleep= 30; /* 30 milliseconds, transaction */
ret= for (;;)
m_skip_auto_increment ? {
ndb->readAutoIncrementValue((const NDBTAB *) m_table, auto_value) : if (m_skip_auto_increment &&
ndb->getAutoIncrementValue((const NDBTAB *) m_table, auto_value, cache_size); ndb->readAutoIncrementValue((const NDBTAB *) m_table, auto_value) ||
} while (ret == -1 && ndb->getAutoIncrementValue((const NDBTAB *) m_table,
--retries && auto_value, cache_size))
{
if (--retries &&
ndb->getNdbError().status == NdbError::TemporaryError); ndb->getNdbError().status == NdbError::TemporaryError);
if (ret == -1)
{ {
my_sleep(retry_sleep);
continue;
}
const NdbError err= ndb->getNdbError(); const NdbError err= ndb->getNdbError();
sql_print_error("Error %lu in ::get_auto_increment(): %s", sql_print_error("Error %lu in ::get_auto_increment(): %s",
(ulong) err.code, err.message); (ulong) err.code, err.message);
DBUG_RETURN(~(ulonglong) 0); DBUG_RETURN(~(ulonglong) 0);
} }
break;
}
DBUG_RETURN((longlong)auto_value); DBUG_RETURN((longlong)auto_value);
} }
......
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