Commit 162bd361 authored by unknown's avatar unknown

bug#4590

Use ndb_mgm_listen_event to wait for backup messages


ndb/src/mgmclient/CommandInterpreter.cpp:
  Listen to backup event
  start backup
  wait until event related to backup arrives
ndb/src/mgmsrv/Services.cpp:
  Fix newline at end of reply
parent ef5c6152
......@@ -1672,13 +1672,45 @@ CommandInterpreter::executeStartBackup(char* /*parameters*/)
connect();
struct ndb_mgm_reply reply;
unsigned int backupId;
int filter[] = { 15, NDB_MGM_EVENT_CATEGORY_BACKUP, 0 };
int fd = ndb_mgm_listen_event(m_mgmsrv, filter);
int result = ndb_mgm_start_backup(m_mgmsrv, &backupId, &reply);
if (result != 0) {
ndbout << "Start of backup failed" << endl;
printError();
} else {
ndbout << "Backup started. Backup id " << backupId << "." << endl;
close(fd);
return;
}
char *tmp;
char buf[1024];
{
SocketInputStream in(fd);
int count = 0;
do {
tmp = in.gets(buf, 1024);
if(tmp)
{
ndbout << tmp;
int id;
if(sscanf(tmp, "%*[^:]: Backup %d ", &id) == 1 && id == backupId){
count++;
}
}
} while(count < 2);
}
SocketInputStream in(fd, 10);
do {
tmp = in.gets(buf, 1024);
if(tmp && tmp[0] != 0)
{
ndbout << tmp;
}
} while(tmp && tmp[0] != 0);
close(fd);
}
void
......
......@@ -1411,6 +1411,7 @@ done:
m_output->println("result: %d", result);
if(result != 0)
m_output->println("msg: %s", msg.c_str());
m_output->println("");
}
template class MutexVector<int>;
......
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