You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by dp...@apache.org on 2019/08/05 12:51:33 UTC

[ignite-teamcity-bot] branch filter-hist-by-tag updated: IGNITE-10095: Filter suite and test history by build tag finished, Suite History made versioned entity and enforced to rebuild for tags filter

This is an automated email from the ASF dual-hosted git repository.

dpavlov pushed a commit to branch filter-hist-by-tag
in repository https://gitbox.apache.org/repos/asf/ignite-teamcity-bot.git


The following commit(s) were added to refs/heads/filter-hist-by-tag by this push:
     new eefdf0a  IGNITE-10095: Filter suite and test history by build tag finished, Suite History made versioned entity and enforced to rebuild for tags filter
eefdf0a is described below

commit eefdf0a194ef3827776da3d1587a20898dae0835
Author: Dmitriy Pavlov <dp...@apache.org>
AuthorDate: Mon Aug 5 15:51:26 2019 +0300

    IGNITE-10095: Filter suite and test history by build tag finished, Suite History made versioned entity and enforced to rebuild for tags filter
---
 .../ignite/tcbot/engine/chain/MultBuildRunCtx.java | 10 +++++-----
 .../ignite/tcignited/history/SuiteInvocation.java  | 23 ++++++++++++++++++++--
 .../history/SuiteInvocationHistoryDao.java         | 19 ++++++++++++------
 3 files changed, 39 insertions(+), 13 deletions(-)

diff --git a/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/chain/MultBuildRunCtx.java b/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/chain/MultBuildRunCtx.java
index 86146f3..7432550 100644
--- a/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/chain/MultBuildRunCtx.java
+++ b/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/chain/MultBuildRunCtx.java
@@ -156,12 +156,12 @@ public class MultBuildRunCtx implements ISuiteResults {
 
     /** */
     public long getMetricProblemCount() {
-        return buildsStream().filter(ISuiteResults::hasMetricProblem).count();
+        return buildsStream().filter(SingleBuildRunCtx::hasMetricProblem).count();
     }
 
     /** */
     public long getBuildMessageProblemCount() {
-        return buildsStream().filter(ISuiteResults::hasBuildMessageProblem).count();
+        return buildsStream().filter(SingleBuildRunCtx::hasBuildMessageProblem).count();
     }
 
     /** {@inheritDoc} */
@@ -171,7 +171,7 @@ public class MultBuildRunCtx implements ISuiteResults {
 
     /** */
     public long getCompilationProblemCount() {
-        return buildsStream().filter(ISuiteResults::hasCompilationProblem).count();
+        return buildsStream().filter(SingleBuildRunCtx::hasCompilationProblem).count();
     }
 
     /** {@inheritDoc} */
@@ -203,11 +203,11 @@ public class MultBuildRunCtx implements ISuiteResults {
     }
 
     private long getExitCodeProblemsCount() {
-        return buildsStream().filter(ISuiteResults::hasExitCodeProblem).count();
+        return buildsStream().filter(SingleBuildRunCtx::hasExitCodeProblem).count();
     }
 
     private long getOomeProblemCount() {
-        return buildsStream().filter(ISuiteResults::hasOomeProblem).count();
+        return buildsStream().filter(SingleBuildRunCtx::hasOomeProblem).count();
     }
 
     public int failedTests() {
diff --git a/tcbot-teamcity-ignited/src/main/java/org/apache/ignite/tcignited/history/SuiteInvocation.java b/tcbot-teamcity-ignited/src/main/java/org/apache/ignite/tcignited/history/SuiteInvocation.java
index 7342af7..e904bae 100644
--- a/tcbot-teamcity-ignited/src/main/java/org/apache/ignite/tcignited/history/SuiteInvocation.java
+++ b/tcbot-teamcity-ignited/src/main/java/org/apache/ignite/tcignited/history/SuiteInvocation.java
@@ -25,6 +25,7 @@ import org.apache.ignite.cache.query.annotations.QuerySqlField;
 import org.apache.ignite.ci.teamcity.ignited.fatbuild.FatBuildCompacted;
 import org.apache.ignite.ci.teamcity.ignited.runhist.Invocation;
 import org.apache.ignite.tcbot.persistence.IStringCompactor;
+import org.apache.ignite.tcbot.persistence.IVersionedEntity;
 import org.apache.ignite.tcbot.persistence.Persisted;
 
 /**
@@ -32,7 +33,14 @@ import org.apache.ignite.tcbot.persistence.Persisted;
  * has time limitation of MAX_DAYS, may have TTL.
  */
 @Persisted
-public class SuiteInvocation {
+public class SuiteInvocation implements IVersionedEntity {
+    /** Latest version. */
+    private static final int LATEST_VERSION = 1;
+
+    /** Entity fields version. */
+    @SuppressWarnings("FieldCanBeLocal")
+    private short _ver = LATEST_VERSION;
+
     /** Server ID for queries */
     @QuerySqlField(orderedGroups = {@QuerySqlField.Group(name = "serverSuiteBranch", order = 0)})
     private int srvId;
@@ -50,7 +58,7 @@ public class SuiteInvocation {
 
     private Map<Integer, Invocation> tests = new HashMap<>();
 
-    Long buildStartTime;
+    private Long buildStartTime;
 
     public SuiteInvocation() {}
 
@@ -63,6 +71,17 @@ public class SuiteInvocation {
         this.buildTypeId = buildCompacted.buildTypeId();
     }
 
+
+    /** {@inheritDoc} */
+    @Override public int version() {
+        return _ver;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int latestVersion() {
+        return LATEST_VERSION;
+    }
+
     public void addTest(int testName, Invocation invocation) {
         tests.put(testName, invocation);
     }
diff --git a/tcbot-teamcity-ignited/src/main/java/org/apache/ignite/tcignited/history/SuiteInvocationHistoryDao.java b/tcbot-teamcity-ignited/src/main/java/org/apache/ignite/tcignited/history/SuiteInvocationHistoryDao.java
index dd93c5e..e62a4e5 100644
--- a/tcbot-teamcity-ignited/src/main/java/org/apache/ignite/tcignited/history/SuiteInvocationHistoryDao.java
+++ b/tcbot-teamcity-ignited/src/main/java/org/apache/ignite/tcignited/history/SuiteInvocationHistoryDao.java
@@ -45,7 +45,7 @@ public class SuiteInvocationHistoryDao {
     private Provider<Ignite> igniteProvider;
 
     /** Suite history cache. */
-    private IgniteCache<Long, SuiteInvocation> suiteHistory;
+    private IgniteCache<Long, SuiteInvocation> suiteHist;
 
     public void init() {
         CacheConfiguration<Long , SuiteInvocation> ccfg = CacheConfigs.getCacheV2Config("teamcitySuiteHistory");
@@ -56,20 +56,27 @@ public class SuiteInvocationHistoryDao {
 
         Ignite ignite = igniteProvider.get();
 
-        suiteHistory = ignite.getOrCreateCache(ccfg);
+        suiteHist = ignite.getOrCreateCache(ccfg);
     }
 
     @AutoProfiling
     public Map<Integer, SuiteInvocation> getSuiteRunHist(int srvId, int buildTypeId, int normalizedBranchName) {
-        java.util.Map<Integer, SuiteInvocation> map = new HashMap<>();
-        try (QueryCursor<Cache.Entry<Long, SuiteInvocation>> qryCursor = suiteHistory.query(
+        Map<Integer, SuiteInvocation> map = new HashMap<>();
+
+        try (QueryCursor<Cache.Entry<Long, SuiteInvocation>> qryCursor = suiteHist.query(
             new SqlQuery<Long, SuiteInvocation>(SuiteInvocation.class, "srvId = ? and buildTypeId = ? and normalizedBranchName = ?")
                 .setArgs(srvId, buildTypeId, normalizedBranchName))) {
 
             for (Cache.Entry<Long, SuiteInvocation> next : qryCursor) {
                 Long key = next.getKey();
                 int buildId = BuildRefDao.cacheKeyToBuildId(key);
-                map.put(buildId, next.getValue());
+
+                SuiteInvocation invocation = next.getValue();
+
+                if(invocation.isOutdatedEntityVersion())
+                    continue;
+
+                map.put(buildId, invocation);
             }
         }
 
@@ -82,6 +89,6 @@ public class SuiteInvocationHistoryDao {
 
         addl.forEach((k, v) -> data.put(BuildRefDao.buildIdToCacheKey(srvId, k), v));
 
-        suiteHistory.putAll(data);
+        suiteHist.putAll(data);
     }
 }