@Test @Timeout(value = 10) void doNotInfiniteLoopOnRepeatedFailures() { List<HousekeepingMetadata> tables = List .of(createHousekeepingMetadata("table1", "s3: createHousekeepingMetadata("table2", "s3: createHousekeepingMetadata("table3", "s3: doThrow(new RuntimeException("Error")).when(metadataCleaner).dropTable(Mockito.any(), Mockito.any()); for (int i = 0; i < 5; i++) { int finalI = i; tables.forEach(path -> { if (finalI == 0) { metadataRepository.save(path); } }); pagingCleanupService.cleanUp(Instant.now()); metadataRepository.findAll().forEach(table -> { assertThat(table.getCleanupAttempts()).isEqualTo(finalI + 1); assertThat(table.getHousekeepingStatus()).isEqualTo(FAILED); }); } }
@Override @Timed("metadata-cleanup-job") public void cleanUp(Instant referenceTime) { try { metadataHandlers.forEach(handler -> pagingCleanup(handler, referenceTime)); } catch (Exception e) { throw new BeekeeperException(format("Metadata cleanup failed for instant %s", referenceTime.toString()), e); } }
PagingMetadataCleanupService implements CleanupService { @Override @Timed("metadata-cleanup-job") public void cleanUp(Instant referenceTime) { try { metadataHandlers.forEach(handler -> pagingCleanup(handler, referenceTime)); } catch (Exception e) { throw new BeekeeperException(format("Metadata cleanup failed for instant %s", referenceTime.toString()), e); } } }
PagingMetadataCleanupService implements CleanupService { @Override @Timed("metadata-cleanup-job") public void cleanUp(Instant referenceTime) { try { metadataHandlers.forEach(handler -> pagingCleanup(handler, referenceTime)); } catch (Exception e) { throw new BeekeeperException(format("Metadata cleanup failed for instant %s", referenceTime.toString()), e); } } PagingMetadataCleanupService(
      List<MetadataHandler> metadataHandlers,
      int pageSize,
      boolean dryRunEnabled); }
PagingMetadataCleanupService implements CleanupService { @Override @Timed("metadata-cleanup-job") public void cleanUp(Instant referenceTime) { try { metadataHandlers.forEach(handler -> pagingCleanup(handler, referenceTime)); } catch (Exception e) { throw new BeekeeperException(format("Metadata cleanup failed for instant %s", referenceTime.toString()), e); } } PagingMetadataCleanupService(
      List<MetadataHandler> metadataHandlers,
      int pageSize,
      boolean dryRunEnabled); @Override @Timed("metadata-cleanup-job") void cleanUp(Instant referenceTime); }
PagingMetadataCleanupService implements CleanupService { @Override @Timed("metadata-cleanup-job") public void cleanUp(Instant referenceTime) { try { metadataHandlers.forEach(handler -> pagingCleanup(handler, referenceTime)); } catch (Exception e) { throw new BeekeeperException(format("Metadata cleanup failed for instant %s", referenceTime.toString()), e); } } PagingMetadataCleanupService(
      List<MetadataHandler> metadataHandlers,
      int pageSize,
      boolean dryRunEnabled); @Override @Timed("metadata-cleanup-job") void cleanUp(Instant referenceTime);  }