Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HUDI-8798] Validate Metadata Table Enabled during Archival #12549

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ private List<HoodieInstant> getInstantsToArchive() throws IOException {

// If metadata table is enabled, do not archive instants which are more recent than the last compaction on the
// metadata table.
if (table.getMetaClient().getTableConfig().isMetadataTableAvailable()) {
if (config.isMetadataTableEnabled() && table.getMetaClient().getTableConfig().isMetadataTableAvailable()) {
try (HoodieTableMetadata tableMetadata = HoodieTableMetadata.create(table.getContext(), table.getStorage(), config.getMetadataConfig(), config.getBasePath())) {
Option<String> latestCompactionTime = tableMetadata.getLatestCompactionTime();
if (!latestCompactionTime.isPresent()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ private List<HoodieInstant> getCommitInstantsToArchive() throws IOException {

// 4. If metadata table is enabled, do not archive instants which are more recent than the last compaction on the
// metadata table.
if (table.getMetaClient().getTableConfig().isMetadataTableAvailable()) {
if (config.isMetadataTableEnabled() && table.getMetaClient().getTableConfig().isMetadataTableAvailable()) {
try (HoodieTableMetadata tableMetadata = HoodieTableMetadata.create(
table.getContext(), table.getStorage(), config.getMetadataConfig(), config.getBasePath())) {
Option<String> latestCompactionTime = tableMetadata.getLatestCompactionTime();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,9 @@ public void testArchiveTableWithArchival(boolean enableMetadata) throws Exceptio
getAllArchivedCommitInstants(Arrays.asList("00000001", "00000002")),
getActiveCommitInstants(Arrays.asList("00000003", "00000004", "00000005", "00000006")),
commitsAfterArchival, false);
if (enableMetadata) {
disableMetadataTable(writeConfig);
}
Comment on lines +298 to +300
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're disabling metadata table after few commits are made, metadata table partitions should already be presnet.

} else if (i < 8) {
assertEquals(originalCommits, commitsAfterArchival);
} else if (i == 8) {
Expand Down Expand Up @@ -1817,6 +1820,11 @@ private Pair<List<HoodieInstant>, List<HoodieInstant>> archiveAndGetCommitsList(
return archiveAndGetCommitsList(writeConfig, false);
}

private void disableMetadataTable(HoodieWriteConfig writeConfig) {
writeConfig.setValue(HoodieMetadataConfig.ENABLE.key(), "false");
writeConfig.getMetadataConfig().setValue(HoodieMetadataConfig.ENABLE.key(), "false");
}

private Pair<List<HoodieInstant>, List<HoodieInstant>> archiveAndGetCommitsList(
HoodieWriteConfig writeConfig, boolean includeIncompleteInstants) throws IOException {
metaClient.reloadActiveTimeline();
Expand Down
Loading