private DeprecatedTablesCleaner cleaner(Schema... schemas) { return new DeprecatedTablesCleaner(ImmutableSet.copyOf(schemas)); }
DeprecatedTablesCleaner(Set<Schema> schemas) { deprecatedTables = deprecatedTables(schemas); }
@Test public void doesNotThrowIfWeCannotDropTables() { Schema schema = schemaWithNamespaceAndDeprecatedTables("namespace", "deprecated"); TableReference deprecatedTableReference = TableReference.create(schema.getNamespace(), "deprecated"); doThrow(new RuntimeException("failed for some reason")) .when(keyValueService).dropTables(ImmutableSet.of(deprecatedTableReference)); assertThatCode(() -> cleaner(schema).runWithRetry(transactionManager)).doesNotThrowAnyException(); }
@Test public void canDropDeprecatedTables() { Schema schema1 = schemaWithNamespaceAndDeprecatedTables("namespace", "aTable"); Schema schema2 = schemaWithNamespaceAndDeprecatedTables("anotherNamespace", "anotherTable"); cleaner(schema1, schema2).runWithRetry(transactionManager); Set<TableReference> expectedDeprecatedTables = ImmutableSet.of( TableReference.create(schema1.getNamespace(), "aTable"), TableReference.create(schema2.getNamespace(), "anotherTable")); verify(keyValueService).dropTables(expectedDeprecatedTables); }
timelockConsistencyCheckCallback(config(), runtimeConfigSupplier.get(), lockAndTimestampServices), targetedSweep.singleAttemptCallback(), new DeprecatedTablesCleaner(schemas()), asyncInitializationCallback());
DeprecatedTablesCleaner(Set<Schema> schemas) { deprecatedTables = deprecatedTables(schemas); }
timelockConsistencyCheckCallback(config(), runtimeConfigSupplier.get(), lockAndTimestampServices), targetedSweep.singleAttemptCallback(), new DeprecatedTablesCleaner(schemas()), asyncInitializationCallback());