Add more logs for MS cluster manager

This commit is contained in:
Anthony Xu 2014-07-11 17:39:40 -07:00
parent 63b81995f6
commit 388210c8f9
2 changed files with 16 additions and 11 deletions

View File

@ -542,7 +542,7 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
s_logger.trace("Cluster manager heartbeat update, id:" + _mshostId);
}
_mshostDao.update(_mshostId, getCurrentRunId(), DateUtil.currentGMTTime());
_mshostDao.update(_mshostId, _runId, DateUtil.currentGMTTime());
profilerHeartbeatUpdate.stop();
profilerPeerScan.start();
@ -934,7 +934,7 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
@DB
public boolean start() {
if (s_logger.isInfoEnabled()) {
s_logger.info("Starting cluster manager, msid : " + _msId);
s_logger.info("Starting Cluster manager, msid : " + _msId);
}
ManagementServerHostVO mshost = Transaction.execute(new TransactionCallback<ManagementServerHostVO>() {
@ -948,7 +948,7 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
if (mshost == null) {
mshost = new ManagementServerHostVO();
mshost.setMsid(_msId);
mshost.setRunid(getCurrentRunId());
mshost.setRunid(_runId);
mshost.setName(NetUtils.getHostName());
mshost.setVersion(version);
mshost.setServiceIP(_clusterNodeIP);
@ -960,15 +960,14 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
_mshostDao.persist(mshost);
if (s_logger.isInfoEnabled()) {
s_logger.info("New instance of management server msid " + _msId + " is being started");
s_logger.info("New instance of management server msid " + _msId + ", runId " + _runId + " is being started");
}
} else {
if (s_logger.isInfoEnabled()) {
s_logger.info("Management server " + _msId + " is being started");
}
_mshostDao.update(mshost.getId(), getCurrentRunId(), NetUtils.getHostName(), version, _clusterNodeIP, _currentServiceAdapter.getServicePort(),
_mshostDao.update(mshost.getId(), _runId, NetUtils.getHostName(), version, _clusterNodeIP, _currentServiceAdapter.getServicePort(),
DateUtil.currentGMTTime());
if (s_logger.isInfoEnabled()) {
s_logger.info("Management server " + _msId + ", runId " + _runId + " is being started");
}
}
return mshost;
@ -996,6 +995,10 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
@Override
@DB
public boolean stop() {
if (s_logger.isInfoEnabled()) {
s_logger.info("Stopping Cluster manager, msid : " + _msId);
}
if (_mshostId != null) {
ManagementServerHostVO mshost = _mshostDao.findByMsid(_msId);
mshost.setState(ManagementServerHost.State.Down);

View File

@ -142,7 +142,8 @@ public class ManagementServerHostDaoImpl extends GenericDaoBase<ManagementServer
txn.commit();
if (count < 1) {
throw new CloudRuntimeException("Invalid cluster session detected", new ClusterInvalidSessionException("runid " + runid + " is no longer valid"));
s_logger.info("Invalid cluster session detected, runId " + runid + " is no longer valid");
throw new CloudRuntimeException("Invalid cluster session detected, runId " + runid + " is no longer valid", new ClusterInvalidSessionException("runId " + runid + " is no longer valid"));
}
} catch (Exception e) {
s_logger.warn("Unexpected exception, ", e);
@ -222,7 +223,8 @@ public class ManagementServerHostDaoImpl extends GenericDaoBase<ManagementServer
int count = pstmt.executeUpdate();
if (count < 1) {
throw new CloudRuntimeException("Invalid cluster session detected", new ClusterInvalidSessionException("runid " + runId + " is no longer valid"));
s_logger.info("Invalid cluster session detected, runId " + runId + " is no longer valid");
throw new CloudRuntimeException("Invalid cluster session detected, runId " + runId + " is no longer valid", new ClusterInvalidSessionException("runId " + runId + " is no longer valid"));
}
} catch (SQLException e) {
throw new CloudRuntimeException("DB exception on " + pstmt.toString(), e);