cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Qian Shaohua" <wind...@189.cn>
Subject Some "type"s should refer to "WorkType" in HighAvailabilityDaoImpl.java
Date Thu, 19 May 2016 08:37:05 GMT
Hi all,

 There are some HA bugs in CS 4.5.2. 

1. some "type"s should refer to "WorkType" in HighAvailabilityDaoImpl.java.
The same to master branch.

2. Mismatch uses of HighAvailabilityManagerImpl. _timeBetweenFailures. It
may be in seconds as
<eclipse-javadoc:%E2%98%82=cloud-server/src%3Ccom.cloud.ha%7BHaWorkVO.java%E
2%98%83HaWorkVO> HaWorkVO.timeToTry.

3. In
<eclipse-javadoc:%E2%98%82=cloud-server/src%3Ccom.cloud.ha%7BHighAvailabilit
yManagerImpl.java%E2%98%83HighAvailabilityManagerImpl>
HighAvailabilityManagerImpl.restart(
<eclipse-javadoc:%E2%98%82=cloud-server/src%3Ccom.cloud.ha%7BHighAvailabilit
yManagerImpl.java%E2%98%83HighAvailabilityManagerImpl~restart~QHaWorkVO;%E2%
98%82HaWorkVO> HaWorkVO work), the items' size got from
_haDao.listRunningHaWorkForVm is at least 1

 

And we add order for HA work taken sql, so that VR's HA can do first before
User VM's for efficiency.

 

 

diff --git a/server/src/com/cloud/ha/HighAvailabilityManagerImpl.java
b/server/src/com/cloud/ha/HighAvailabilityManagerImpl.java

index 29d0e2c..90cb97d 100755

--- a/server/src/com/cloud/ha/HighAvailabilityManagerImpl.java

+++ b/server/src/com/cloud/ha/HighAvailabilityManagerImpl.java

@@ -430,7 +430,8 @@ public class HighAvailabilityManagerImpl extends
ManagerBase implements HighAvai

         }

         items = _haDao.listRunningHaWorkForVm(work.getInstanceId());

-        if (items.size() > 0) {

+        // Current HA work is running, so items.size is at least 1

+        if (items.size() > 1) {

             StringBuilder str = new StringBuilder("Waiting because there's
HA work being executed on an item currently.  Work Ids =[");

             for (HaWorkVO item : items) {

                 str.append(item.getId()).append(", ");

@@ -796,7 +797,7 @@ public class HighAvailabilityManagerImpl extends
ManagerBase implements HighAvai

         _maxRetries = NumbersUtil.parseInt(value, 5);

         value = params.get("time.between.failures");

-        _timeBetweenFailures = NumbersUtil.parseLong(value, 3600) * 1000;

+        _timeBetweenFailures = NumbersUtil.parseLong(value, 3600);

         value = params.get("time.between.cleanup");

         _timeBetweenCleanups = NumbersUtil.parseLong(value, 3600 * 24);

@@ -859,7 +860,7 @@ public class HighAvailabilityManagerImpl extends
ManagerBase implements HighAvai

             s_logger.info("HA Cleanup Thread Running");

             try {

-                _haDao.cleanup(System.currentTimeMillis() -
_timeBetweenFailures);

+                _haDao.cleanup(System.currentTimeMillis() -
_timeBetweenFailures * 1000);

             } catch (Exception e) {

                 s_logger.warn("Error while cleaning up", e);

             }

diff --git a/server/src/com/cloud/ha/dao/HighAvailabilityDaoImpl.java
b/server/src/com/cloud/ha/dao/HighAvailabilityDaoImpl.java

index 724f4f6..4ed7f53 100644

--- a/server/src/com/cloud/ha/dao/HighAvailabilityDaoImpl.java

+++ b/server/src/com/cloud/ha/dao/HighAvailabilityDaoImpl.java

@@ -98,20 +98,20 @@ public class HighAvailabilityDaoImpl extends
GenericDaoBase<HaWorkVO, Long> impl

         FutureHaWorkSearch = createSearchBuilder();

         FutureHaWorkSearch.and("instance",
FutureHaWorkSearch.entity().getInstanceId(), Op.EQ);

-        FutureHaWorkSearch.and("type",
FutureHaWorkSearch.entity().getType(), Op.EQ);

+        FutureHaWorkSearch.and("type",
FutureHaWorkSearch.entity().getWorkType(), Op.EQ);

         FutureHaWorkSearch.and("id", FutureHaWorkSearch.entity().getId(),
Op.GT);

         FutureHaWorkSearch.done();

         RunningHaWorkSearch = createSearchBuilder();

         RunningHaWorkSearch.and("instance",
RunningHaWorkSearch.entity().getInstanceId(), Op.EQ);

-        RunningHaWorkSearch.and("type",
RunningHaWorkSearch.entity().getType(), Op.EQ);

+        RunningHaWorkSearch.and("type",
RunningHaWorkSearch.entity().getWorkType(), Op.EQ);

         RunningHaWorkSearch.and("taken",
RunningHaWorkSearch.entity().getDateTaken(), Op.NNULL);

         RunningHaWorkSearch.and("step",
RunningHaWorkSearch.entity().getStep(), Op.NIN);

         RunningHaWorkSearch.done();

         PendingHaWorkSearch = createSearchBuilder();

         PendingHaWorkSearch.and("instance",
PendingHaWorkSearch.entity().getInstanceId(), Op.EQ);

-        PendingHaWorkSearch.and("type",
PendingHaWorkSearch.entity().getType(), Op.EQ);

+        PendingHaWorkSearch.and("type",
PendingHaWorkSearch.entity().getWorkType(), Op.EQ);

         PendingHaWorkSearch.and("step",
PendingHaWorkSearch.entity().getStep(), Op.NIN);

         PendingHaWorkSearch.done();

     }

@@ -154,7 +154,7 @@ public class HighAvailabilityDaoImpl extends
GenericDaoBase<HaWorkVO, Long> impl

             sc.setParameters("time", System.currentTimeMillis() >> 10);

             sc.setParameters("step", Step.Done, Step.Cancelled);

-            final Filter filter = new Filter(HaWorkVO.class, null, true,
0l, 1l);

+            final Filter filter = new Filter(HaWorkVO.class, "type", true,
0l, 1l);

             txn.start();

             final List<HaWorkVO> vos = lockRows(sc, filter, true);


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message