@Test public void typicalUnpartitioned() { List<String> paths = List.of("s3: List<String> tables = List.of("table1", "table2", "table3"); IntStream .range(0, tables.size()) .forEach( i -> metadataRepository.save(createHousekeepingMetadata(tables.get(i), paths.get(i), null, SCHEDULED))); pagingCleanupService.cleanUp(Instant.now()); verify(metadataCleaner, times(3)).dropTable(metadataCaptor.capture(), hiveClientCaptor.capture()); assertThat(metadataCaptor.getAllValues()) .extracting("tableName") .containsExactly(tables.get(0), tables.get(1), tables.get(2)); verify(pathCleaner, times(3)).cleanupPath(pathCaptor.capture()); assertThat(pathCaptor.getAllValues()).extracting("path").containsExactly(paths.get(0), paths.get(1), paths.get(2)); metadataRepository.findAll().forEach(housekeepingMetadata -> { assertThat(housekeepingMetadata.getCleanupAttempts()).isEqualTo(1); assertThat(housekeepingMetadata.getHousekeepingStatus()).isEqualTo(DELETED); }); pagingCleanupService.cleanUp(Instant.now()); verifyNoMoreInteractions(pathCleaner); }
@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);  }