use of io.prestosql.spi.connector.ConnectorVacuumTableHandle in project hetu-core by openlookeng.
the class TestBackgroundHiveSplitLoader method testFullAcidTableVacuumWithOpenTxns.
@Test
public void testFullAcidTableVacuumWithOpenTxns() throws Exception {
java.nio.file.Path tablePath = Files.createTempDirectory("TestBackgroundHiveSplitLoader");
Table table = table(tablePath.toString(), ImmutableList.of(), Optional.empty(), ImmutableMap.of("transactional", "true"));
List<String> filePaths = ImmutableList.of(tablePath + "/delta_0000001_0000001_0000/_orc_acid_version", tablePath + "/delta_0000001_0000001_0000/bucket_00000", tablePath + "/delta_0000002_0000002_0000/_orc_acid_version", tablePath + "/delta_0000002_0000002_0000/bucket_00000", tablePath + "/delta_0000003_0000003_0000/_orc_acid_version", tablePath + "/delta_0000003_0000003_0000/bucket_00000");
try {
for (String path : filePaths) {
File file = new File(path);
assertTrue(file.getParentFile().exists() || file.getParentFile().mkdirs(), "Failed creating directory " + file.getParentFile());
createOrcAcidFile(file);
}
// ValidWriteIdsList is of format <currentTxn>$<schema>.<table>:<highWatermark>:<minOpenWriteId>::<AbortedTxns>
// This writeId list has high watermark transaction=3
ValidReaderWriteIdList validWriteIdsList = new ValidReaderWriteIdList(format("4$%s.%s:1:2::", table.getDatabaseName(), table.getTableName()));
ImmutableMap<String, Object> queryInfo = ImmutableMap.of("FULL", false, "vacuumHandle", new ConnectorVacuumTableHandle() {
});
BackgroundHiveSplitLoader backgroundHiveSplitLoader = backgroundHiveSplitLoader(createTestHdfsEnvironment(new HiveConfig()), TupleDomain.all(), Optional.empty(), table, Optional.empty(), Optional.of(validWriteIdsList), Optional.of(QueryType.VACUUM), queryInfo);
HiveSplitSource hiveSplitSource = hiveSplitSource(backgroundHiveSplitLoader);
backgroundHiveSplitLoader.start(hiveSplitSource);
List<HiveSplit> splits = drainSplits(hiveSplitSource);
assertEquals(1, splits.size());
} finally {
MoreFiles.deleteRecursively(tablePath, ALLOW_INSECURE);
}
}
use of io.prestosql.spi.connector.ConnectorVacuumTableHandle in project hetu-core by openlookeng.
the class MetadataManager method beginVacuum.
@Override
public VacuumTableHandle beginVacuum(Session session, TableHandle tableHandle, boolean full, boolean merge, Optional<String> partition) {
CatalogName catalogName = tableHandle.getCatalogName();
CatalogMetadata catalogMetadata = getCatalogMetadataForWrite(session, catalogName);
ConnectorMetadata metadata = getMetadataForWrite(session, catalogName);
ConnectorTransactionHandle transactionHandle = catalogMetadata.getTransactionHandleFor(catalogName);
ConnectorVacuumTableHandle vacuumTableHandle = metadata.beginVacuum(session.toConnectorSession(catalogName), tableHandle.getConnectorHandle(), full, merge, partition);
return new VacuumTableHandle(tableHandle.getCatalogName(), transactionHandle, vacuumTableHandle);
}
Aggregations