Class FirstFailedInCache


  • public class FirstFailedInCache
    extends Object
    This class is used to keep cached values of FirstFailedIn builds for failed tests. The idea of caching First Failed In values is as follows: When calculating first failed in, we go back through builds history (see BuildTypeTestsCache) and looking for the build where the test is successful (see DetectPreviousFailuresProcessor in BuildStatisticsBuilder). When found, we stop searching and consider the previous failed build as First Failed In. The problem is, if FFI build is not in cached build instances (BuildTypeTestsCache is limited), the repeatable requests to find FFI for a test become lengthy. So, while searching for a FFI build, we track if the returning build data is cached in BuildTypeTestsCache. The first uncached build becomes an anchor for the FFI cache. After the first full scan, for all tests (testNameIds) which have FFI build before the anchor, we cache the FFI build for the pair anchor_buildId+testNameId. On subsequent pass, when we're passing anchored buildId, we take value for FFI build from this cache.
    Author:
    kir
    • Constructor Detail

      • FirstFailedInCache

        public FirstFailedInCache​(@NotNull
                                  BuildsManager buildsManager)
    • Method Detail

      • getCachedFFI

        public Optional<SBuild> getCachedFFI​(long buildId,
                                             @NotNull
                                             Long testNameId)
        Returns null if value is not in cache, i.e. cache was not popuplated. Returns Optional.empty() if FFI was calculated and was not found Returns Optional.of(ffiBuild) if ffiBuild was calculated, found and placed to cache
        Returns:
        see above
      • put2Cache

        public void put2Cache​(long buildId,
                              Long testNameId,
                              @Nullable
                              Build firstFailed)
      • clearCache

        public void clearCache()
      • size

        public int size()
      • buildsDeleted

        public void buildsDeleted​(Collection<Long> deletedBuildIds)