1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +03:00

Changed the retry behavior in SocketPool to get load_brm to work

when called by proc???.  Also made proc??? start/stop SM around
save_brm runs.  There seems not to be a saner way to do that atm.

So, on stop/restart/shutdown, it will do
1) stop everything
2) restart SM
3) save_brm
4) stop SM again
This commit is contained in:
Patrick LeBlanc
2019-07-18 11:14:12 -05:00
parent 43f7a71bad
commit 7d4f406888
2 changed files with 32 additions and 5 deletions

View File

@ -1331,12 +1331,28 @@ void processMSG(messageqcpp::IOSocket* cfIos)
}
else
{
/* XXXPAT: saveBRM requires StorageManager being up at the time.
A couple options. 1) start/stop SM around saveBRM(). Will work but it means SM would go
down-up-down for this single operation. 2) add a special path to stopModule()
to NOT stop SM in the first call, then after saveBRM(), stop SM.
Neither option is great. The least invasive is option 1, so going with that
for now.
*/
//now stop local module
processManager.stopModule(config.moduleName(), graceful, manualFlag );
//run save brm script
string storageType = Config::makeConfig()->getConfig("Installation", "DBRootStorageType");
if (storageType == "storagemanager")
processManager.startProcess(config.moduleName(), "StorageManager", FORCEFUL);
processManager.saveBRM(false);
if (storageType == "storagemanager")
processManager.stopProcess(config.moduleName(), "StorageManager", GRACEFUL, false);
log.writeLog(__LINE__, "Stop System Completed Success", LOG_TYPE_INFO);
processManager.setSystemState(oam::MAN_OFFLINE);
@ -1766,8 +1782,16 @@ void processMSG(messageqcpp::IOSocket* cfIos)
processManager.stopModule(config.moduleName(), graceful, manualFlag );
//run save.brm script
string storageType = Config::makeConfig()->getConfig("Installation", "DBRootStorageType");
if (storageType == "storagemanager")
processManager.startProcess(config.moduleName(), "StorageManager", FORCEFUL);
processManager.saveBRM(false);
if (storageType == "storagemanager")
processManager.stopProcess(config.moduleName(), "StorageManager", GRACEFUL, false);
log.writeLog(__LINE__, "RESTARTSYSTEM: ACK received from Process-Monitor for stopModule requests, return status = " + oam.itoa(status));
startsystemthreadStop = false;

View File

@ -92,13 +92,14 @@ int SocketPool::send_recv(messageqcpp::ByteStream &in, messageqcpp::ByteStream *
const uint8_t *inbuf = in.buf();
ssize_t err = 0;
/* should there be a retry limit here... */
while (sock < 0)
{
sock = getSocket();
if (sock < 0)
{
log(logging::LOG_TYPE_ERROR, "SocketPool::send_recv(): retrying in 5 sec...");
sleep(5);
//log(logging::LOG_TYPE_ERROR, "SocketPool::send_recv(): retrying in 5 sec...");
sleep(1);
}
}
@ -214,10 +215,12 @@ int SocketPool::getSocket()
int saved_errno = errno;
ostringstream os;
char buf[80];
os << "SocketPool::getSocket() failed to connect; got '" << strerror_r(saved_errno, buf, 80);
os << "SocketPool::getSocket() failed to connect; got '" << strerror_r(saved_errno, buf, 80) << "'";
cout << os.str() << endl;
log(logging::LOG_TYPE_ERROR, os.str());
close(clientSocket);
errno = saved_errno;
return -1;
}
return clientSocket;
}