Skip to content
Merged
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 @@ -18,7 +18,6 @@

package org.apache.hudi.table.action.savepoint;

import org.apache.hudi.common.model.HoodieTableType;
import org.apache.hudi.common.table.timeline.HoodieInstant;
import org.apache.hudi.common.table.timeline.HoodieTimeline;
import org.apache.hudi.common.util.Option;
Expand All @@ -33,9 +32,6 @@ public class SavepointHelpers {
private static final Logger LOG = LogManager.getLogger(SavepointHelpers.class);

public static void deleteSavepoint(HoodieTable table, String savepointTime) {
if (table.getMetaClient().getTableType() == HoodieTableType.MERGE_ON_READ) {
throw new UnsupportedOperationException("Savepointing is not supported or MergeOnRead table types");
}
HoodieInstant savePoint = new HoodieInstant(false, HoodieTimeline.SAVEPOINT_ACTION, savepointTime);
boolean isSavepointPresent = table.getCompletedSavepointTimeline().containsInstant(savePoint);
if (!isSavepointPresent) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,9 @@ private void testUpsertsInternal(HoodieWriteConfig config,

assertFalse(metaClient.reloadActiveTimeline().getRollbackTimeline().lastInstant().isPresent());

client.deleteSavepoint("004");
assertFalse(metaClient.reloadActiveTimeline().getSavePointTimeline().containsInstant("004"));

// Check the entire dataset has all records still
String[] fullPartitionPaths = new String[dataGen.getPartitionPaths().length];
for (int i = 0; i < fullPartitionPaths.length; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,9 @@ void testRestoreWithCleanedUpCommits() throws Exception {
HoodieTableFileSystemView tableView = getHoodieTableFileSystemView(metaClient, metaClient.getCommitTimeline().filterCompletedInstants(), allFiles);
Stream<HoodieBaseFile> dataFilesToRead = tableView.getLatestBaseFiles();
assertFalse(dataFilesToRead.anyMatch(file -> HoodieTimeline.compareTimestamps("002", HoodieTimeline.GREATER_THAN, file.getCommitTime())));

client.deleteSavepoint("002");
assertFalse(metaClient.reloadActiveTimeline().getSavePointTimeline().containsInstant("002"));
}
}

Expand Down