mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 20:02: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
|
@DB
|
||||||
protected List<DomainRouterVO> findOrCreateVirtualRouters(Network guestNetwork, DeployDestination dest, Account owner, boolean isRedundant) throws ConcurrentOperationException, InsufficientCapacityException {
|
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) {
|
if (network == null) {
|
||||||
throw new ConcurrentOperationException("Unable to lock network " + guestNetwork.getId());
|
throw new ConcurrentOperationException("Unable to lock network " + guestNetwork.getId());
|
||||||
}
|
}
|
||||||
@ -972,8 +970,6 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
|
|||||||
}
|
}
|
||||||
routers.add(router);
|
routers.add(router);
|
||||||
}
|
}
|
||||||
|
|
||||||
txn.commit();
|
|
||||||
} finally {
|
} finally {
|
||||||
if (network != null) {
|
if (network != null) {
|
||||||
_networkDao.releaseFromLockTable(network.getId());
|
_networkDao.releaseFromLockTable(network.getId());
|
||||||
@ -1086,11 +1082,8 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
|
|||||||
return runningRouters;
|
return runningRouters;
|
||||||
}
|
}
|
||||||
|
|
||||||
@DB
|
|
||||||
List<DomainRouterVO> findOrCreateDhcpServers(Network guestNetwork, DeployDestination dest, Account owner) throws ConcurrentOperationException, InsufficientCapacityException {
|
List<DomainRouterVO> findOrCreateDhcpServers(Network guestNetwork, DeployDestination dest, Account owner) throws ConcurrentOperationException, InsufficientCapacityException {
|
||||||
Transaction txn = Transaction.currentTxn();
|
Network network = _networkDao.acquireInLockTable(guestNetwork.getId());
|
||||||
txn.start();
|
|
||||||
Network network = _networkDao.lockRow(guestNetwork.getId(), true);
|
|
||||||
if (network == null) {
|
if (network == null) {
|
||||||
throw new ConcurrentOperationException("Unable to lock network " + guestNetwork.getId());
|
throw new ConcurrentOperationException("Unable to lock network " + guestNetwork.getId());
|
||||||
}
|
}
|
||||||
@ -1164,8 +1157,6 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
|
|||||||
_userStatsDao.persist(stats);
|
_userStatsDao.persist(stats);
|
||||||
}
|
}
|
||||||
|
|
||||||
txn.commit();
|
|
||||||
|
|
||||||
} finally {
|
} finally {
|
||||||
if (network != null) {
|
if (network != null) {
|
||||||
_networkDao.releaseFromLockTable(network.getId());
|
_networkDao.releaseFromLockTable(network.getId());
|
||||||
|
|||||||
@ -283,6 +283,8 @@ public class Merovingian2 extends StandardMBean implements MerovingianMBean {
|
|||||||
pstmt.setLong(4, threadId);
|
pstmt.setLong(4, threadId);
|
||||||
int rows = pstmt.executeUpdate();
|
int rows = pstmt.executeUpdate();
|
||||||
assert (rows <= 1) : "hmmm....keys not unique? " + pstmt;
|
assert (rows <= 1) : "hmmm....keys not unique? " + pstmt;
|
||||||
|
|
||||||
|
|
||||||
if (s_logger.isTraceEnabled()) {
|
if (s_logger.isTraceEnabled()) {
|
||||||
s_logger.trace("lck-" + key + " released");
|
s_logger.trace("lck-" + key + " released");
|
||||||
}
|
}
|
||||||
@ -296,7 +298,10 @@ public class Merovingian2 extends StandardMBean implements MerovingianMBean {
|
|||||||
s_logger.trace("lck-" + key + " removed");
|
s_logger.trace("lck-" + key + " removed");
|
||||||
}
|
}
|
||||||
decrCount();
|
decrCount();
|
||||||
|
} else if (rows < 1) {
|
||||||
|
s_logger.warn("Was unable to find lock for the key " + key + " and thread id " + threadId);
|
||||||
}
|
}
|
||||||
|
|
||||||
return rows == 1;
|
return rows == 1;
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
throw new CloudRuntimeException("Unable to release " + key, e);
|
throw new CloudRuntimeException("Unable to release " + key, e);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user