mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 04:53:01 +01:00
merge
ndb/src/common/logger/Logger.cpp: Auto merged ndb/test/ndbapi/testBlobs.cpp: Auto merged ndb/tools/restore/consumer_restore.cpp: Auto merged
This commit is contained in:
commit
828c463361
6 changed files with 52 additions and 46 deletions
|
@ -352,11 +352,11 @@ Logger::log(LoggerLevel logLevel, const char* pMsg, va_list ap) const
|
||||||
{
|
{
|
||||||
if (m_logLevels[LL_ON] && m_logLevels[logLevel])
|
if (m_logLevels[LL_ON] && m_logLevels[logLevel])
|
||||||
{
|
{
|
||||||
|
char buf[MAX_LOG_MESSAGE_SIZE];
|
||||||
|
BaseString::vsnprintf(buf, sizeof(buf), pMsg, ap);
|
||||||
LogHandler* pHandler = NULL;
|
LogHandler* pHandler = NULL;
|
||||||
while ( (pHandler = m_pHandlerList->next()) != NULL)
|
while ( (pHandler = m_pHandlerList->next()) != NULL)
|
||||||
{
|
{
|
||||||
char buf[MAX_LOG_MESSAGE_SIZE];
|
|
||||||
BaseString::vsnprintf(buf, sizeof(buf), pMsg, ap);
|
|
||||||
pHandler->append(m_pCategory, logLevel, buf);
|
pHandler->append(m_pCategory, logLevel, buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,10 +32,9 @@
|
||||||
#include "common.hpp"
|
#include "common.hpp"
|
||||||
|
|
||||||
static const char *work_dir = CPCD_DEFAULT_WORK_DIR;
|
static const char *work_dir = CPCD_DEFAULT_WORK_DIR;
|
||||||
static short unsigned int port;
|
static int unsigned port;
|
||||||
static int use_syslog;
|
static int use_syslog;
|
||||||
static const char *logfile = NULL;
|
static const char *logfile = NULL;
|
||||||
static const char *config_file = CPCD_DEFAULT_CONFIG_FILE;
|
|
||||||
static const char *user = 0;
|
static const char *user = 0;
|
||||||
|
|
||||||
static struct my_option my_long_options[] =
|
static struct my_option my_long_options[] =
|
||||||
|
@ -55,9 +54,6 @@ static struct my_option my_long_options[] =
|
||||||
{ "debug", 'D', "Enable debug mode",
|
{ "debug", 'D', "Enable debug mode",
|
||||||
(gptr*) &debug, (gptr*) &debug, 0,
|
(gptr*) &debug, (gptr*) &debug, 0,
|
||||||
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
|
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
|
||||||
{ "config", 'c', "Config file",
|
|
||||||
(gptr*) &config_file, (gptr*) &config_file, 0,
|
|
||||||
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
|
|
||||||
{ "user", 'u', "Run as user",
|
{ "user", 'u', "Run as user",
|
||||||
(gptr*) &user, (gptr*) &user, 0,
|
(gptr*) &user, (gptr*) &user, 0,
|
||||||
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
|
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
|
||||||
|
@ -142,7 +138,8 @@ int main(int argc, char** argv){
|
||||||
|
|
||||||
SocketServer * ss = new SocketServer();
|
SocketServer * ss = new SocketServer();
|
||||||
CPCDAPIService * serv = new CPCDAPIService(cpcd);
|
CPCDAPIService * serv = new CPCDAPIService(cpcd);
|
||||||
if(!ss->setup(serv, &port)){
|
unsigned short real_port= port; // correct type
|
||||||
|
if(!ss->setup(serv, &real_port)){
|
||||||
logger.critical("Cannot setup server: %s", strerror(errno));
|
logger.critical("Cannot setup server: %s", strerror(errno));
|
||||||
sleep(1);
|
sleep(1);
|
||||||
delete ss;
|
delete ss;
|
||||||
|
|
|
@ -1543,11 +1543,11 @@ testperf()
|
||||||
}
|
}
|
||||||
if (n != 0) {
|
if (n != 0) {
|
||||||
CHK(g_con->execute(Commit) == 0);
|
CHK(g_con->execute(Commit) == 0);
|
||||||
|
g_ndb->closeTransaction(g_con); g_con = 0;
|
||||||
n = 0;
|
n = 0;
|
||||||
}
|
}
|
||||||
g_bh1 = 0;
|
g_bh1 = 0;
|
||||||
g_opr = 0;
|
g_opr = 0;
|
||||||
g_con = 0;
|
|
||||||
}
|
}
|
||||||
// pk read char (one trans)
|
// pk read char (one trans)
|
||||||
{
|
{
|
||||||
|
@ -1571,7 +1571,7 @@ testperf()
|
||||||
t1.off(g_opt.m_rowsperf);
|
t1.off(g_opt.m_rowsperf);
|
||||||
DBG(t1.time());
|
DBG(t1.time());
|
||||||
g_opr = 0;
|
g_opr = 0;
|
||||||
g_con = 0;
|
g_ndb->closeTransaction(g_con); g_con = 0;
|
||||||
}
|
}
|
||||||
// pk read text (one trans)
|
// pk read text (one trans)
|
||||||
{
|
{
|
||||||
|
@ -1596,7 +1596,7 @@ testperf()
|
||||||
CHK(g_con->execute(Commit) == 0);
|
CHK(g_con->execute(Commit) == 0);
|
||||||
t2.off(g_opt.m_rowsperf);
|
t2.off(g_opt.m_rowsperf);
|
||||||
DBG(t2.time());
|
DBG(t2.time());
|
||||||
g_opr = 0;
|
g_ndb->closeTransaction(g_con); g_opr = 0;
|
||||||
g_con = 0;
|
g_con = 0;
|
||||||
}
|
}
|
||||||
// pk read overhead
|
// pk read overhead
|
||||||
|
@ -1629,7 +1629,7 @@ testperf()
|
||||||
CHK(n == g_opt.m_rowsperf);
|
CHK(n == g_opt.m_rowsperf);
|
||||||
t1.off(g_opt.m_rowsperf);
|
t1.off(g_opt.m_rowsperf);
|
||||||
DBG(t1.time());
|
DBG(t1.time());
|
||||||
g_ops = 0;
|
g_ndb->closeTransaction(g_con); g_ops = 0;
|
||||||
g_con = 0;
|
g_con = 0;
|
||||||
}
|
}
|
||||||
// scan read text
|
// scan read text
|
||||||
|
@ -1662,7 +1662,7 @@ testperf()
|
||||||
DBG(t2.time());
|
DBG(t2.time());
|
||||||
g_bh1 = 0;
|
g_bh1 = 0;
|
||||||
g_ops = 0;
|
g_ops = 0;
|
||||||
g_con = 0;
|
g_ndb->closeTransaction(g_con); g_con = 0;
|
||||||
}
|
}
|
||||||
// scan read overhead
|
// scan read overhead
|
||||||
DBG("scan read overhead: " << t2.over(t1));
|
DBG("scan read overhead: " << t2.over(t1));
|
||||||
|
|
|
@ -20,40 +20,40 @@ add_procs(){
|
||||||
}
|
}
|
||||||
|
|
||||||
add_proc (){
|
add_proc (){
|
||||||
dir=""
|
|
||||||
conf=""
|
|
||||||
case $type in
|
case $type in
|
||||||
mgm)
|
mgm)
|
||||||
dir="ndb_mgmd"
|
echo "$proc_no.ndb_mgmd" >> $dir_file
|
||||||
conf="[ndb_mgmd]\nId: $node_id\nHostName: $2\n"
|
echo "[ndb_mgmd]" >> $config_file
|
||||||
|
echo "Id: $node_id" >> $config_file
|
||||||
|
echo "HostName: $2" >> $config_file
|
||||||
node_id=`expr $node_id + 1`
|
node_id=`expr $node_id + 1`
|
||||||
;;
|
;;
|
||||||
api)
|
api)
|
||||||
dir="ndb_api"
|
echo "$proc_no.ndb_api" >> $dir_file
|
||||||
conf="[api]\nId: $node_id\nHostName: $2\n"
|
echo "[api]" >> $config_file
|
||||||
|
echo "Id: $node_id" >> $config_file
|
||||||
|
echo "HostName: $2" >> $config_file
|
||||||
node_id=`expr $node_id + 1`
|
node_id=`expr $node_id + 1`
|
||||||
;;
|
;;
|
||||||
ndb)
|
ndb)
|
||||||
dir="ndbd"
|
echo "$proc_no.ndbd" >> $dir_file
|
||||||
conf="[ndbd]\nId: $node_id\nHostName: $2\n"
|
echo "[ndbd]" >> $config_file
|
||||||
|
echo "Id: $node_id" >> $config_file
|
||||||
|
echo "HostName: $2" >> $config_file
|
||||||
node_id=`expr $node_id + 1`
|
node_id=`expr $node_id + 1`
|
||||||
;;
|
;;
|
||||||
mysqld)
|
mysqld)
|
||||||
dir="mysqld"
|
echo "$proc_no.mysqld" >> $dir_file
|
||||||
conf="[mysqld]\nId: $node_id\nHostName: $2\n"
|
echo "[ndb_mgmd]" >> $config_file
|
||||||
|
echo "Id: $node_id" >> $config_file
|
||||||
|
echo "HostName: $2" >> $config_file
|
||||||
node_id=`expr $node_id + 1`
|
node_id=`expr $node_id + 1`
|
||||||
;;
|
;;
|
||||||
mysql)
|
mysql)
|
||||||
dir="mysql"
|
echo "$proc_no.mysql" >> $dir_file
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
dir="$proc_no.$dir"
|
|
||||||
proc_no=`expr $proc_no + 1`
|
proc_no=`expr $proc_no + 1`
|
||||||
echo -e $dir >> $dir_file
|
|
||||||
if [ "$conf" ]
|
|
||||||
then
|
|
||||||
echo -e $conf >> $config_file
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ done
|
||||||
|
|
||||||
if [ -f $conf ]
|
if [ -f $conf ]
|
||||||
then
|
then
|
||||||
. $conf
|
. ./$conf
|
||||||
else
|
else
|
||||||
echo "Can't find config file: $conf"
|
echo "Can't find config file: $conf"
|
||||||
exit
|
exit
|
||||||
|
@ -131,8 +131,10 @@ echo "$DATE $RUN" > $LOCK
|
||||||
# trap them, and remove the #
|
# trap them, and remove the #
|
||||||
# Lock file before exit #
|
# Lock file before exit #
|
||||||
#############################
|
#############################
|
||||||
|
if [ `uname -s` != "SunOS" ]
|
||||||
trap "rm -f $LOCK" ERR
|
then
|
||||||
|
trap "rm -f $LOCK" ERR
|
||||||
|
fi
|
||||||
|
|
||||||
# You can add more to this path#
|
# You can add more to this path#
|
||||||
################################
|
################################
|
||||||
|
@ -191,7 +193,7 @@ then
|
||||||
else
|
else
|
||||||
echo $VERSION > /tmp/version.$$
|
echo $VERSION > /tmp/version.$$
|
||||||
fi
|
fi
|
||||||
match=`grep -c "$VERSION" /tmp/version.$$`
|
match=`grep -c "$VERSION" /tmp/version.$$ | xargs echo`
|
||||||
rm -f /tmp/version.$$
|
rm -f /tmp/version.$$
|
||||||
if [ $match -eq 0 ]
|
if [ $match -eq 0 ]
|
||||||
then
|
then
|
||||||
|
@ -229,7 +231,7 @@ filter(){
|
||||||
shift
|
shift
|
||||||
while [ $# -gt 0 ]
|
while [ $# -gt 0 ]
|
||||||
do
|
do
|
||||||
if [ `grep -c $1 $neg` -eq 0 ] ; then echo $1; fi
|
if [ `grep -c $1 $neg | xargs echo` -eq 0 ] ; then echo $1; fi
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
@ -294,13 +296,12 @@ choose_conf(){
|
||||||
if [ -f $test_dir/conf-$1-$HOST.txt ]
|
if [ -f $test_dir/conf-$1-$HOST.txt ]
|
||||||
then
|
then
|
||||||
echo "$test_dir/conf-$1-$HOST.txt"
|
echo "$test_dir/conf-$1-$HOST.txt"
|
||||||
echo "$test_dir/conf-$1-$host.txt"
|
|
||||||
elif [ -f $test_dir/conf-$1.txt ]
|
elif [ -f $test_dir/conf-$1.txt ]
|
||||||
then
|
then
|
||||||
echo "$test_dir/conf-$1.txt"
|
echo "$test_dir/conf-$1.txt"
|
||||||
else
|
else
|
||||||
echo "Unable to find conf file looked for" 1>&2
|
echo "Unable to find conf file looked for" 1>&2
|
||||||
echo "$testdir/conf-$1-host.txt and" 1>&2
|
echo "$testdir/conf-$1-$HOST.txt and" 1>&2
|
||||||
echo "$testdir/conf-$1.txt" 1>&2
|
echo "$testdir/conf-$1.txt" 1>&2
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
@ -343,7 +344,7 @@ start(){
|
||||||
|
|
||||||
count_hosts(){
|
count_hosts(){
|
||||||
cnt=`grep "CHOOSE_host" $1 | awk '{for(i=1; i<=NF;i++) \
|
cnt=`grep "CHOOSE_host" $1 | awk '{for(i=1; i<=NF;i++) \
|
||||||
if(match($i, "CHOOSE_host") > 0) print $i;}' | sort | uniq | wc -l`
|
if(index($i, "CHOOSE_host") > 0) print $i;}' | sort | uniq | wc -l`
|
||||||
echo $cnt
|
echo $cnt
|
||||||
}
|
}
|
||||||
#######################################################
|
#######################################################
|
||||||
|
|
|
@ -301,12 +301,11 @@ void BackupRestore::tuple_a(restore_callback_t *cb)
|
||||||
cb->connection = m_ndb->startTransaction();
|
cb->connection = m_ndb->startTransaction();
|
||||||
if (cb->connection == NULL)
|
if (cb->connection == NULL)
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
if (errorHandler(cb))
|
if (errorHandler(cb))
|
||||||
{
|
{
|
||||||
|
m_ndb->sendPollNdb(3000, 1);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
exitHandler();
|
exitHandler();
|
||||||
} // if
|
} // if
|
||||||
|
|
||||||
|
@ -423,9 +422,17 @@ void BackupRestore::cback(int result, restore_callback_t *cb)
|
||||||
*/
|
*/
|
||||||
bool BackupRestore::errorHandler(restore_callback_t *cb)
|
bool BackupRestore::errorHandler(restore_callback_t *cb)
|
||||||
{
|
{
|
||||||
NdbError error= cb->connection->getNdbError();
|
NdbError error;
|
||||||
|
if(cb->connection)
|
||||||
|
{
|
||||||
|
error= cb->connection->getNdbError();
|
||||||
m_ndb->closeTransaction(cb->connection);
|
m_ndb->closeTransaction(cb->connection);
|
||||||
cb->connection= 0;
|
cb->connection= 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
error= m_ndb->getNdbError();
|
||||||
|
}
|
||||||
|
|
||||||
Uint32 sleepTime = 100 + cb->retries * 300;
|
Uint32 sleepTime = 100 + cb->retries * 300;
|
||||||
|
|
||||||
|
@ -440,6 +447,7 @@ bool BackupRestore::errorHandler(restore_callback_t *cb)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NdbError::TemporaryError:
|
case NdbError::TemporaryError:
|
||||||
|
err << "Temporary error: " << error << endl;
|
||||||
NdbSleep_MilliSleep(sleepTime);
|
NdbSleep_MilliSleep(sleepTime);
|
||||||
return true;
|
return true;
|
||||||
// RETRY
|
// RETRY
|
||||||
|
|
Loading…
Reference in a new issue