mirror of https://github.com/apache/cloudstack.git
bug 11060: use lockTable instead of rowLock when createDomR/createDhcp
status 11060: resolved fixed
This commit is contained in:
parent
e4db9f4518
commit
97b148b03d
|
|
@ -865,10 +865,8 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
|
|||
|
||||
@DB
|
||||
protected List<DomainRouterVO> findOrCreateVirtualRouters(Network guestNetwork, DeployDestination dest, Account owner, boolean isRedundant) throws ConcurrentOperationException, InsufficientCapacityException {
|
||||
Transaction txn = Transaction.currentTxn();
|
||||
txn.start();
|
||||
|
||||
Network network = _networkDao.lockRow(guestNetwork.getId(), true);
|
||||
Network network = _networkDao.acquireInLockTable(guestNetwork.getId());
|
||||
if (network == null) {
|
||||
throw new ConcurrentOperationException("Unable to lock network " + guestNetwork.getId());
|
||||
}
|
||||
|
|
@ -965,8 +963,6 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
|
|||
}
|
||||
routers.add(router);
|
||||
}
|
||||
|
||||
txn.commit();
|
||||
} finally {
|
||||
if (network != null) {
|
||||
_networkDao.releaseFromLockTable(network.getId());
|
||||
|
|
@ -1079,11 +1075,8 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
|
|||
return runningRouters;
|
||||
}
|
||||
|
||||
@DB
|
||||
List<DomainRouterVO> findOrCreateDhcpServers(Network guestNetwork, DeployDestination dest, Account owner) throws ConcurrentOperationException, InsufficientCapacityException {
|
||||
Transaction txn = Transaction.currentTxn();
|
||||
txn.start();
|
||||
Network network = _networkDao.lockRow(guestNetwork.getId(), true);
|
||||
Network network = _networkDao.acquireInLockTable(guestNetwork.getId());
|
||||
if (network == null) {
|
||||
throw new ConcurrentOperationException("Unable to lock network " + guestNetwork.getId());
|
||||
}
|
||||
|
|
@ -1157,8 +1150,6 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
|
|||
_userStatsDao.persist(stats);
|
||||
}
|
||||
|
||||
txn.commit();
|
||||
|
||||
} finally {
|
||||
if (network != null) {
|
||||
_networkDao.releaseFromLockTable(network.getId());
|
||||
|
|
|
|||
|
|
@ -280,6 +280,8 @@ public class Merovingian2 extends StandardMBean implements MerovingianMBean {
|
|||
pstmt.setLong(4, threadId);
|
||||
int rows = pstmt.executeUpdate();
|
||||
assert (rows <= 1) : "hmmm....keys not unique? " + pstmt;
|
||||
|
||||
|
||||
if (s_logger.isTraceEnabled()) {
|
||||
s_logger.trace("lck-" + key + " released");
|
||||
}
|
||||
|
|
@ -293,7 +295,10 @@ public class Merovingian2 extends StandardMBean implements MerovingianMBean {
|
|||
s_logger.trace("lck-" + key + " removed");
|
||||
}
|
||||
decrCount();
|
||||
} else if (rows < 1) {
|
||||
s_logger.warn("Was unable to find lock for the key " + key + " and thread id " + threadId);
|
||||
}
|
||||
|
||||
return rows == 1;
|
||||
} catch (SQLException e) {
|
||||
throw new CloudRuntimeException("Unable to release " + key, e);
|
||||
|
|
|
|||
Loading…
Reference in New Issue