Skip to content

Commit

Permalink
fix comment
Browse files Browse the repository at this point in the history
  • Loading branch information
仟弋 committed Oct 17, 2024
1 parent e9d89b6 commit 1b13af3
Showing 1 changed file with 53 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -943,17 +943,68 @@ public void testManifestCompact() throws Exception {
.isEqualTo(0);
}

@Test
public void testManifestCompactFull() throws Exception {
// Disable full compaction by options.
TestFileStore store =
createStore(
false,
Collections.singletonMap(
CoreOptions.MANIFEST_FULL_COMPACTION_FILE_SIZE.key(),
String.valueOf(Long.MAX_VALUE)));

List<KeyValue> keyValues = generateDataList(1);
BinaryRow partition = gen.getPartition(keyValues.get(0));
// commit 1
Snapshot snapshot =
store.commitData(keyValues, s -> partition, kv -> 0, Collections.emptyMap()).get(0);

for (int i = 0; i < 10; i++) {
snapshot =
store.overwriteData(keyValues, s -> partition, kv -> 0, Collections.emptyMap())
.get(0);
}

long deleteNum =
store.manifestListFactory().create().readDataManifests(snapshot).stream()
.mapToLong(ManifestFileMeta::numDeletedFiles)
.sum();
assertThat(deleteNum).isGreaterThan(0);
store.newCommit().compactManifest();
Snapshot latest = store.snapshotManager().latestSnapshot();
assertThat(
store.manifestListFactory().create().readDataManifests(latest).stream()
.mapToLong(ManifestFileMeta::numDeletedFiles)
.sum())
.isEqualTo(0);
}

private TestFileStore createStore(boolean failing, Map<String, String> options)
throws Exception {
return createStore(failing, 1, CoreOptions.ChangelogProducer.NONE, options);
}

private TestFileStore createStore(boolean failing) throws Exception {
return createStore(failing, 1);
}

private TestFileStore createStore(boolean failing, int numBucket) throws Exception {
return createStore(failing, numBucket, CoreOptions.ChangelogProducer.NONE);
return createStore(
failing, numBucket, CoreOptions.ChangelogProducer.NONE, Collections.emptyMap());
}

private TestFileStore createStore(
boolean failing, int numBucket, CoreOptions.ChangelogProducer changelogProducer)
throws Exception {
return createStore(failing, numBucket, changelogProducer, Collections.emptyMap());
}

private TestFileStore createStore(
boolean failing,
int numBucket,
CoreOptions.ChangelogProducer changelogProducer,
Map<String, String> options)
throws Exception {
String root =
failing
? FailingFileIO.getFailingPath(failingName, tempDir.toString())
Expand All @@ -967,7 +1018,7 @@ private TestFileStore createStore(
TestKeyValueGenerator.DEFAULT_PART_TYPE.getFieldNames(),
TestKeyValueGenerator.getPrimaryKeys(
TestKeyValueGenerator.GeneratorMode.MULTI_PARTITIONED),
Collections.emptyMap(),
options,
null));
return new TestFileStore.Builder(
"avro",
Expand Down

0 comments on commit 1b13af3

Please sign in to comment.