mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 20:02:29 +01:00
bug 10322: arrival of the next generation Merovingians
This commit is contained in:
parent
5134b44ff5
commit
cbee5a6044
@ -69,6 +69,7 @@ import com.cloud.utils.component.ComponentLocator;
|
|||||||
import com.cloud.utils.component.Inject;
|
import com.cloud.utils.component.Inject;
|
||||||
import com.cloud.utils.concurrency.NamedThreadFactory;
|
import com.cloud.utils.concurrency.NamedThreadFactory;
|
||||||
import com.cloud.utils.db.DB;
|
import com.cloud.utils.db.DB;
|
||||||
|
import com.cloud.utils.db.Merovingian2;
|
||||||
import com.cloud.utils.db.Transaction;
|
import com.cloud.utils.db.Transaction;
|
||||||
import com.cloud.utils.events.SubscriptionMgr;
|
import com.cloud.utils.events.SubscriptionMgr;
|
||||||
import com.cloud.utils.exception.CloudRuntimeException;
|
import com.cloud.utils.exception.CloudRuntimeException;
|
||||||
@ -604,13 +605,14 @@ public class ClusterManagerImpl implements ClusterManager {
|
|||||||
s_logger.error("Problem with the cluster heartbeat!", e);
|
s_logger.error("Problem with the cluster heartbeat!", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isRootCauseConnectionRelated(Throwable e) {
|
private boolean isRootCauseConnectionRelated(Throwable e) {
|
||||||
while (e != null) {
|
while (e != null) {
|
||||||
if (e instanceof com.mysql.jdbc.CommunicationsException || e instanceof com.mysql.jdbc.exceptions.jdbc4.CommunicationsException)
|
if (e instanceof com.mysql.jdbc.CommunicationsException || e instanceof com.mysql.jdbc.exceptions.jdbc4.CommunicationsException) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
e = e.getCause();
|
e = e.getCause();
|
||||||
}
|
}
|
||||||
@ -1029,6 +1031,9 @@ public class ClusterManagerImpl implements ClusterManager {
|
|||||||
|
|
||||||
|
|
||||||
_agentLBEnabled = Boolean.valueOf(configDao.getValue(Config.AgentLbEnable.key()));
|
_agentLBEnabled = Boolean.valueOf(configDao.getValue(Config.AgentLbEnable.key()));
|
||||||
|
|
||||||
|
Merovingian2 m = Merovingian2.createLockMaster(this._msId);
|
||||||
|
m.clear();
|
||||||
|
|
||||||
checkConflicts();
|
checkConflicts();
|
||||||
|
|
||||||
|
|||||||
@ -311,7 +311,8 @@ CREATE TABLE `cloud`.`op_lock` (
|
|||||||
`thread` varchar(255) NOT NULL COMMENT 'Thread that acquired this lock',
|
`thread` varchar(255) NOT NULL COMMENT 'Thread that acquired this lock',
|
||||||
`acquired_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Time acquired',
|
`acquired_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Time acquired',
|
||||||
`waiters` int NOT NULL DEFAULT 0 COMMENT 'How many have waited for this',
|
`waiters` int NOT NULL DEFAULT 0 COMMENT 'How many have waited for this',
|
||||||
PRIMARY KEY (`key`)
|
PRIMARY KEY (`key`),
|
||||||
|
INDEX `i_op_lock__mac_ip_thread`(`mac`, `ip`, `thread`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
CREATE TABLE `cloud`.`configuration` (
|
CREATE TABLE `cloud`.`configuration` (
|
||||||
|
|||||||
@ -1268,7 +1268,7 @@ public abstract class GenericDaoBase<T, ID extends Serializable> implements Gene
|
|||||||
while (en.hasMoreElements()) {
|
while (en.hasMoreElements()) {
|
||||||
pstmt = txn.prepareAutoCloseStatement(ec.insertSql);
|
pstmt = txn.prepareAutoCloseStatement(ec.insertSql);
|
||||||
if (ec.targetClass == Date.class) {
|
if (ec.targetClass == Date.class) {
|
||||||
pstmt.setString(1, DateUtil.getDateDisplayString(TimeZone.getTimeZone("GMT"), (Date)en.nextElement()));
|
pstmt.setString(1, DateUtil.getDateDisplayString(s_gmtTimeZone, (Date)en.nextElement()));
|
||||||
} else {
|
} else {
|
||||||
pstmt.setObject(1, en.nextElement());
|
pstmt.setObject(1, en.nextElement());
|
||||||
}
|
}
|
||||||
@ -1347,11 +1347,11 @@ public abstract class GenericDaoBase<T, ID extends Serializable> implements Gene
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (attr.is(Attribute.Flag.Date)) {
|
if (attr.is(Attribute.Flag.Date)) {
|
||||||
pstmt.setString(j, DateUtil.getDateDisplayString(TimeZone.getTimeZone("GMT"), date));
|
pstmt.setString(j, DateUtil.getDateDisplayString(s_gmtTimeZone, date));
|
||||||
} else if (attr.is(Attribute.Flag.TimeStamp)) {
|
} else if (attr.is(Attribute.Flag.TimeStamp)) {
|
||||||
pstmt.setString(j, DateUtil.getDateDisplayString(TimeZone.getTimeZone("GMT"), date));
|
pstmt.setString(j, DateUtil.getDateDisplayString(s_gmtTimeZone, date));
|
||||||
} else if (attr.is(Attribute.Flag.Time)) {
|
} else if (attr.is(Attribute.Flag.Time)) {
|
||||||
pstmt.setString(j, DateUtil.getDateDisplayString(TimeZone.getTimeZone("GMT"), date));
|
pstmt.setString(j, DateUtil.getDateDisplayString(s_gmtTimeZone, date));
|
||||||
}
|
}
|
||||||
} else if (attr.field.getType() == Calendar.class) {
|
} else if (attr.field.getType() == Calendar.class) {
|
||||||
final Calendar cal = (Calendar)value;
|
final Calendar cal = (Calendar)value;
|
||||||
@ -1360,11 +1360,11 @@ public abstract class GenericDaoBase<T, ID extends Serializable> implements Gene
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (attr.is(Attribute.Flag.Date)) {
|
if (attr.is(Attribute.Flag.Date)) {
|
||||||
pstmt.setString(j, DateUtil.getDateDisplayString(TimeZone.getTimeZone("GMT"), cal.getTime()));
|
pstmt.setString(j, DateUtil.getDateDisplayString(s_gmtTimeZone, cal.getTime()));
|
||||||
} else if (attr.is(Attribute.Flag.TimeStamp)) {
|
} else if (attr.is(Attribute.Flag.TimeStamp)) {
|
||||||
pstmt.setString(j, DateUtil.getDateDisplayString(TimeZone.getTimeZone("GMT"), cal.getTime()));
|
pstmt.setString(j, DateUtil.getDateDisplayString(s_gmtTimeZone, cal.getTime()));
|
||||||
} else if (attr.is(Attribute.Flag.Time)) {
|
} else if (attr.is(Attribute.Flag.Time)) {
|
||||||
pstmt.setString(j, DateUtil.getDateDisplayString(TimeZone.getTimeZone("GMT"), cal.getTime()));
|
pstmt.setString(j, DateUtil.getDateDisplayString(s_gmtTimeZone, cal.getTime()));
|
||||||
}
|
}
|
||||||
} else if (attr.field.getType().isEnum()) {
|
} else if (attr.field.getType().isEnum()) {
|
||||||
final Enumerated enumerated = attr.field.getAnnotation(Enumerated.class);
|
final Enumerated enumerated = attr.field.getAnnotation(Enumerated.class);
|
||||||
|
|||||||
@ -201,6 +201,7 @@ public class Transaction {
|
|||||||
|
|
||||||
public static Connection getStandaloneConnectionWithException() throws SQLException {
|
public static Connection getStandaloneConnectionWithException() throws SQLException {
|
||||||
Connection conn = s_ds.getConnection();
|
Connection conn = s_ds.getConnection();
|
||||||
|
conn.setAutoCommit(true);
|
||||||
if (s_connLogger.isTraceEnabled()) {
|
if (s_connLogger.isTraceEnabled()) {
|
||||||
s_connLogger.trace("Retrieving a standalone connection: dbconn" + System.identityHashCode(conn));
|
s_connLogger.trace("Retrieving a standalone connection: dbconn" + System.identityHashCode(conn));
|
||||||
}
|
}
|
||||||
@ -209,13 +210,9 @@ public class Transaction {
|
|||||||
|
|
||||||
public static Connection getStandaloneConnection() {
|
public static Connection getStandaloneConnection() {
|
||||||
try {
|
try {
|
||||||
Connection conn = s_ds.getConnection();
|
return getStandaloneConnectionWithException();
|
||||||
if (s_connLogger.isTraceEnabled()) {
|
|
||||||
s_connLogger.trace("Retrieving a standalone connection: dbconn" + System.identityHashCode(conn));
|
|
||||||
}
|
|
||||||
return conn;
|
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
s_logger.warn("Unexpected exception: ", e);
|
s_logger.error("Unexpected exception: ", e);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,6 +24,7 @@ package com.cloud.utils.time;
|
|||||||
public class InaccurateClock extends Thread {
|
public class InaccurateClock extends Thread {
|
||||||
static final InaccurateClock s_timer = new InaccurateClock();
|
static final InaccurateClock s_timer = new InaccurateClock();
|
||||||
static {
|
static {
|
||||||
|
time = System.currentTimeMillis();
|
||||||
s_timer.start();
|
s_timer.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user