Skip to content

Commit

Permalink
Rename force compaction to compact all files
Browse files Browse the repository at this point in the history
  • Loading branch information
kr565370 committed Dec 13, 2023
1 parent c74b182 commit 9d069aa
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions docs/06-status.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,12 @@ To run this client you can run the following command:
sleeper deployment utility/adminClient.sh ${INSTANCE_ID}
```

## Force compaction job creation
## Compact all files

If you want to fully compact all files in leaf partitions, but the compaction strategy is not compacting files in a
partition, you can run the following script to force compactions to be created for files in leaf partitions that were
skipped by the compaction strategy:

```bash
sleeper deployment utility/forceCreateJobs.sh ${NSTANCE_ID}
sleeper deployment utility/compactAllFiles.sh ${NSTANCE_ID}
```
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@

import java.io.IOException;

public class ForceCreateCompactionJobs {
private ForceCreateCompactionJobs() {
public class CompactAllFiles {
private CompactAllFiles() {
}

public static void main(String[] args) throws ObjectFactoryException, StateStoreException, IOException {
Expand All @@ -59,7 +59,7 @@ public static void main(String[] args) throws ObjectFactoryException, StateStore
Configuration conf = HadoopConfigurationProvider.getConfigurationForClient(instanceProperties);
StateStoreProvider stateStoreProvider = new StateStoreProvider(dynamoDBClient, instanceProperties, conf);
CompactionJobStatusStore jobStatusStore = CompactionJobStatusStoreFactory.getStatusStore(dynamoDBClient, instanceProperties);
CreateJobs jobCreator = CreateJobs.forceCompaction(
CreateJobs jobCreator = CreateJobs.compactAllFiles(
new ObjectFactory(instanceProperties, s3Client, "/tmp"),
instanceProperties, tablePropertiesProvider, stateStoreProvider,
new SendCompactionJobToSqs(instanceProperties, sqsClient)::send, jobStatusStore);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,25 +65,25 @@ public class CreateJobs {
private final TablePropertiesProvider tablePropertiesProvider;
private final StateStoreProvider stateStoreProvider;
private final CompactionJobStatusStore jobStatusStore;
private final boolean forceCreateJobs;
private final boolean compactAllFiles;

private CreateJobs(ObjectFactory objectFactory,
InstanceProperties instanceProperties,
TablePropertiesProvider tablePropertiesProvider,
StateStoreProvider stateStoreProvider,
JobSender jobSender,
CompactionJobStatusStore jobStatusStore,
boolean forceCreateJobs) {
boolean compactAllFiles) {
this.objectFactory = objectFactory;
this.instanceProperties = instanceProperties;
this.jobSender = jobSender;
this.tablePropertiesProvider = tablePropertiesProvider;
this.stateStoreProvider = stateStoreProvider;
this.jobStatusStore = jobStatusStore;
this.forceCreateJobs = forceCreateJobs;
this.compactAllFiles = compactAllFiles;
}

public static CreateJobs forceCompaction(ObjectFactory objectFactory,
public static CreateJobs compactAllFiles(ObjectFactory objectFactory,
InstanceProperties instanceProperties,
TablePropertiesProvider tablePropertiesProvider,
StateStoreProvider stateStoreProvider,
Expand Down Expand Up @@ -134,7 +134,7 @@ public void createJobsForTable(TableProperties tableProperties) throws StateStor
List<CompactionJob> compactionJobs = compactionStrategy.createCompactionJobs(activeFileInfosWithJobId, activeFileInfosWithNoJobId, allPartitions);
LOGGER.info("Used {} to create {} compaction jobs for table {}", compactionStrategy.getClass().getSimpleName(), compactionJobs.size(), tableId);

if (forceCreateJobs) {
if (compactAllFiles) {
createJobsFromLeftoverFiles(tableProperties, activeFileInfosWithNoJobId, allPartitions, compactionJobs);
}
for (CompactionJob compactionJob : compactionJobs) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ private List<CompactionJob> createJobs() throws Exception {

private List<CompactionJob> forceCreateJobs() throws Exception {
List<CompactionJob> compactionJobs = new ArrayList<>();
CreateJobs createJobs = CreateJobs.forceCompaction(ObjectFactory.noUserJars(), instanceProperties,
CreateJobs createJobs = CreateJobs.compactAllFiles(ObjectFactory.noUserJars(), instanceProperties,
new FixedTablePropertiesProvider(tableProperties),
new FixedStateStoreProvider(tableProperties, stateStore),
compactionJobs::add, jobStatusStore);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public List<String> forceCreateJobsGetIds() {
CompactionJobStatusStore store = CompactionJobStatusStoreFactory
.getStatusStoreWithStronglyConsistentReads(dynamoDBClient, instance.getInstanceProperties());
Set<String> jobsBefore = allJobIds(store).collect(Collectors.toSet());
CreateJobs createJobs = CreateJobs.forceCompaction(
CreateJobs createJobs = CreateJobs.compactAllFiles(
ObjectFactory.noUserJars(), instance.getInstanceProperties(),
instance.getTablePropertiesProvider(), instance.getStateStoreProvider(),
new SendCompactionJobToSqs(instance.getInstanceProperties(), sqsClient)::send, store);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ VERSION=$(cat "${TEMPLATE_DIR}/version.txt")
echo "-------------------------------------------------------"
echo "Forcing compaction job creation"
echo "-------------------------------------------------------"
java -cp "${JAR_DIR}/clients-${VERSION}-utility.jar" sleeper.clients.status.update.ForceCreateCompactionJobs "${INSTANCE_ID}"
java -cp "${JAR_DIR}/clients-${VERSION}-utility.jar" sleeper.clients.status.update.CompactAllFiles "${INSTANCE_ID}"

0 comments on commit 9d069aa

Please sign in to comment.