mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
bug 11060: use lockTable instead of rowLock when createDomR/createDhcp
status 11060: resolved fixed
This commit is contained in:
parent
4393162ecd
commit
9544d42908
@ -872,10 +872,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());
|
||||
}
|
||||
@ -972,8 +970,6 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
|
||||
}
|
||||
routers.add(router);
|
||||
}
|
||||
|
||||
txn.commit();
|
||||
} finally {
|
||||
if (network != null) {
|
||||
_networkDao.releaseFromLockTable(network.getId());
|
||||
@ -1086,11 +1082,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());
|
||||
}
|
||||
@ -1164,8 +1157,6 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
|
||||
_userStatsDao.persist(stats);
|
||||
}
|
||||
|
||||
txn.commit();
|
||||
|
||||
} finally {
|
||||
if (network != null) {
|
||||
_networkDao.releaseFromLockTable(network.getId());
|
||||
|
||||
@ -283,6 +283,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");
|
||||
}
|
||||
@ -296,7 +298,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…
x
Reference in New Issue
Block a user