You've already forked mariadb-columnstore-engine
							
							
				mirror of
				https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
				synced 2025-10-31 18:30:33 +03:00 
			
		
		
		
	mcol-833 - merge code from 1.0 for missing file fix
This commit is contained in:
		
							
								
								
									
										101
									
								
								procmgr/main.cpp
									
									
									
									
									
								
							
							
						
						
									
										101
									
								
								procmgr/main.cpp
									
									
									
									
									
								
							| @@ -58,6 +58,7 @@ bool HDFS = false; | ||||
| string localHostName; | ||||
| string PMwithUM = "n"; | ||||
| string MySQLRep = "n"; | ||||
| string DBRootStorageType = "internal"; | ||||
|  | ||||
| // pushing the ACTIVE_ALARMS_FILE to all nodes every 10 seconds. | ||||
| const int ACTIVE_ALARMS_PUSHING_INTERVAL = 10; | ||||
| @@ -1365,6 +1366,9 @@ void pingDeviceThread() | ||||
| 									break; | ||||
|  | ||||
| 								//set query system state not ready | ||||
| 								BRM::DBRM dbrm; | ||||
| 								dbrm.setSystemQueryReady(false); | ||||
|  | ||||
| 								processManager.setQuerySystemState(false); | ||||
|  | ||||
| 								processManager.setSystemState(oam::BUSY_INIT); | ||||
| @@ -1380,19 +1384,19 @@ void pingDeviceThread() | ||||
| 								//send notification | ||||
| 								oam.sendDeviceNotification(config.moduleName(), MODULE_UP); | ||||
|  | ||||
| 								//set module to enable state | ||||
| 								processManager.enableModule(moduleName, oam::AUTO_OFFLINE); | ||||
|  | ||||
| 								int status; | ||||
| 	 | ||||
| 								// if pm, move dbroots back to pm | ||||
| 								if ( ( moduleName.find("pm") == 0 && !amazon ) || | ||||
| 		 | ||||
| 								// if shared pm, move dbroots back to pm | ||||
| 								if ( ( moduleName.find("pm") == 0 && !amazon && ( DBRootStorageType != "internal") ) || | ||||
| 									( moduleName.find("pm") == 0 && amazon && downActiveOAMModule ) || | ||||
| 									( moduleName.find("pm") == 0 && amazon && AmazonPMFailover == "y") ) { | ||||
|  | ||||
| 									//restart to get the versionbuffer files closed so it can be unmounted | ||||
| 									processManager.restartProcessType("WriteEngineServer", moduleName); | ||||
|  | ||||
| 									//set module to enable state | ||||
| 									processManager.enableModule(moduleName, oam::AUTO_OFFLINE); | ||||
|  | ||||
| 									downActiveOAMModule = false; | ||||
| 									int retry; | ||||
| 									for ( retry = 0 ; retry < 5 ; retry++ ) | ||||
| @@ -1484,6 +1488,9 @@ void pingDeviceThread() | ||||
| 										break; | ||||
| 									} | ||||
| 								} | ||||
| 								else | ||||
| 								    //set module to enable state | ||||
| 								    processManager.enableModule(moduleName, oam::AUTO_OFFLINE); | ||||
|  | ||||
| 								//restart module processes | ||||
| 								int retry = 0; | ||||
| @@ -1584,14 +1591,6 @@ void pingDeviceThread() | ||||
| 										continue; | ||||
| 									} | ||||
|  | ||||
| 									//call dbrm control, need to resume before start so the getdbrmfiles halt doesn't hang | ||||
| 									oam.dbrmctl("reload"); | ||||
| 									log.writeLog(__LINE__, "'dbrmctl reload' done", LOG_TYPE_DEBUG); | ||||
| 	 | ||||
| 									// resume the dbrm | ||||
| 									oam.dbrmctl("resume"); | ||||
| 									log.writeLog(__LINE__, "'dbrmctl resume' done", LOG_TYPE_DEBUG); | ||||
|  | ||||
| 									// next, startmodule | ||||
| 									status = processManager.startModule(moduleName, oam::FORCEFUL, oam::AUTO_OFFLINE); | ||||
| 									if ( status == oam::API_SUCCESS ) | ||||
| @@ -1606,6 +1605,14 @@ void pingDeviceThread() | ||||
| 								if ( retry < ModuleProcMonWaitCount ) | ||||
| 								{	// module successfully started | ||||
|  | ||||
| 									//call dbrm control, need to resume before start so the getdbrmfiles halt doesn't hang | ||||
| 									oam.dbrmctl("reload"); | ||||
| 									log.writeLog(__LINE__, "'dbrmctl reload' done", LOG_TYPE_DEBUG); | ||||
| 	 | ||||
| 									// resume the dbrm | ||||
| 									oam.dbrmctl("resume"); | ||||
| 									log.writeLog(__LINE__, "'dbrmctl resume' done", LOG_TYPE_DEBUG); | ||||
|  | ||||
| 									//distribute config file | ||||
| 									processManager.distributeConfigFile("system");	 | ||||
| 									sleep(1); | ||||
| @@ -1647,6 +1654,9 @@ void pingDeviceThread() | ||||
| 										processManager.restartProcessType("DMLProc", moduleName); | ||||
| 									} | ||||
|  | ||||
| 									//enable query stats | ||||
| 									dbrm.setSystemQueryReady(true); | ||||
|  | ||||
| 									//set query system state ready | ||||
| 									processManager.setQuerySystemState(true); | ||||
|  | ||||
| @@ -1664,8 +1674,9 @@ void pingDeviceThread() | ||||
| 									aManager.sendAlarmReport(moduleName.c_str(), MODULE_DOWN_AUTO, SET); | ||||
|  | ||||
| 									// if pm, move dbroots back to pm | ||||
| 									if ( ( moduleName.find("pm") == 0 && !amazon ) || | ||||
| 										( moduleName.find("pm") == 0 && amazon && downActiveOAMModule ) ) { | ||||
| 									if ( ( moduleName.find("pm") == 0 && !amazon && ( DBRootStorageType != "internal") ) || | ||||
| 									    ( moduleName.find("pm") == 0 && amazon && downActiveOAMModule ) || | ||||
| 									    ( moduleName.find("pm") == 0 && amazon && AmazonPMFailover == "y") ) { | ||||
| 										//move dbroots to other modules | ||||
| 										try { | ||||
| 											log.writeLog(__LINE__, "Call autoMovePmDbroot", LOG_TYPE_DEBUG); | ||||
| @@ -1703,6 +1714,9 @@ void pingDeviceThread() | ||||
| 									else | ||||
| 										processManager.setSystemState(oam::ACTIVE); | ||||
|  | ||||
| 									//enable query stats | ||||
| 									dbrm.setSystemQueryReady(true); | ||||
|  | ||||
| 									//set query system state ready | ||||
| 									processManager.setQuerySystemState(true); | ||||
|  | ||||
| @@ -1741,8 +1755,13 @@ void pingDeviceThread() | ||||
| 								log.writeLog(__LINE__, "module is down: " + moduleName, LOG_TYPE_CRITICAL); | ||||
| 				 | ||||
| 								//set query system state not ready | ||||
| 								BRM::DBRM dbrm; | ||||
| 								dbrm.setSystemQueryReady(false); | ||||
|  | ||||
| 								processManager.setQuerySystemState(false); | ||||
|  | ||||
| 								processManager.setSystemState(oam::BUSY_INIT); | ||||
|  | ||||
| 								processManager.reinitProcessType("cpimport"); | ||||
|  | ||||
| 								// halt the dbrm | ||||
| @@ -1771,25 +1790,24 @@ void pingDeviceThread() | ||||
| 								log.writeLog(__LINE__, "'dbrmctl reload' done", LOG_TYPE_DEBUG); | ||||
|  | ||||
| 								// if pm, move dbroots to other pms | ||||
| 								if ( !amazon || | ||||
| 									( amazon && AmazonPMFailover == "y") ) { | ||||
| 									if( moduleName.find("pm") == 0 ) { | ||||
| 										try { | ||||
| 											log.writeLog(__LINE__, "Call autoMovePmDbroot", LOG_TYPE_DEBUG); | ||||
| 											oam.autoMovePmDbroot(moduleName); | ||||
| 											log.writeLog(__LINE__, "autoMovePmDbroot success", LOG_TYPE_DEBUG); | ||||
| 											//distribute config file | ||||
| 											processManager.distributeConfigFile("system");	 | ||||
| 										} | ||||
| 										catch (exception& ex) | ||||
| 										{ | ||||
| 											string error = ex.what(); | ||||
| 											log.writeLog(__LINE__, "EXCEPTION ERROR on autoMovePmDbroot: " + error, LOG_TYPE_DEBUG); | ||||
| 										} | ||||
| 										catch(...) | ||||
| 										{ | ||||
| 											log.writeLog(__LINE__, "EXCEPTION ERROR on autoMovePmDbroot: Caught unknown exception!", LOG_TYPE_ERROR); | ||||
| 										} | ||||
| 								if ( ( moduleName.find("pm") == 0 && !amazon && ( DBRootStorageType != "internal") ) || | ||||
| 									( moduleName.find("pm") == 0 && amazon && downActiveOAMModule ) || | ||||
| 									( moduleName.find("pm") == 0 && amazon && AmazonPMFailover == "y") ) { | ||||
| 									try { | ||||
| 										log.writeLog(__LINE__, "Call autoMovePmDbroot", LOG_TYPE_DEBUG); | ||||
| 										oam.autoMovePmDbroot(moduleName); | ||||
| 										log.writeLog(__LINE__, "autoMovePmDbroot success", LOG_TYPE_DEBUG); | ||||
| 										//distribute config file | ||||
| 										processManager.distributeConfigFile("system");	 | ||||
| 									} | ||||
| 									catch (exception& ex) | ||||
| 									{ | ||||
| 										string error = ex.what(); | ||||
| 										log.writeLog(__LINE__, "EXCEPTION ERROR on autoMovePmDbroot: " + error, LOG_TYPE_DEBUG); | ||||
| 									} | ||||
| 									catch(...) | ||||
| 									{ | ||||
| 										log.writeLog(__LINE__, "EXCEPTION ERROR on autoMovePmDbroot: Caught unknown exception!", LOG_TYPE_ERROR); | ||||
| 									} | ||||
| 								} | ||||
| 	 | ||||
| @@ -1968,7 +1986,9 @@ void pingDeviceThread() | ||||
| 											processManager.removeModule(devicenetworklist, false); | ||||
|  | ||||
| 											// if pm, move dbroots to other pms | ||||
| 											if( moduleName.find("pm") == 0 ) { | ||||
| 											if ( ( moduleName.find("pm") == 0 && !amazon && ( DBRootStorageType != "internal") ) || | ||||
| 												( moduleName.find("pm") == 0 && amazon && downActiveOAMModule ) || | ||||
| 												( moduleName.find("pm") == 0 && amazon && AmazonPMFailover == "y") ) { | ||||
| 												try { | ||||
| 													log.writeLog(__LINE__, "Call autoMovePmDbroot", LOG_TYPE_DEBUG); | ||||
| 													oam.autoMovePmDbroot(moduleName); | ||||
| @@ -1990,6 +2010,9 @@ void pingDeviceThread() | ||||
| 											//set recycle process | ||||
| 											processManager.recycleProcess(moduleName); | ||||
|  | ||||
| 											//enable query stats | ||||
| 											dbrm.setSystemQueryReady(true); | ||||
|  | ||||
| 											//set query system state ready | ||||
| 											processManager.setQuerySystemState(true); | ||||
|  | ||||
| @@ -2004,6 +2027,9 @@ void pingDeviceThread() | ||||
| 										oam.dbrmctl("resume"); | ||||
| 										log.writeLog(__LINE__, "'dbrmctl resume' done", LOG_TYPE_DEBUG); | ||||
|  | ||||
| 										//enable query stats | ||||
| 										dbrm.setSystemQueryReady(true); | ||||
|  | ||||
| 										//set query system state ready | ||||
| 										processManager.setQuerySystemState(true); | ||||
| 									} | ||||
| @@ -2017,6 +2043,9 @@ void pingDeviceThread() | ||||
| 									//set recycle process | ||||
| 									processManager.recycleProcess(moduleName); | ||||
|  | ||||
| 									//enable query stats | ||||
| 									dbrm.setSystemQueryReady(true); | ||||
|  | ||||
| 									//set query system state ready | ||||
| 									processManager.setQuerySystemState(true); | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user