[HUDI-1714] Added tests to TestHoodieTimelineArchiveLog for the archival of compl… (#2677)
* Added tests to TestHoodieTimelineArchiveLog for the archival of completed clean and rollback actions. * Adding code review changes * [HUDI-1714] Minor Fixes
This commit is contained in:
@@ -180,8 +180,8 @@ public class FileCreateUtils {
|
||||
createMetaFile(basePath, instantTime, HoodieTimeline.INFLIGHT_ROLLBACK_EXTENSION);
|
||||
}
|
||||
|
||||
public static void createRollbackFile(String basePath, String instantTime, HoodieRollbackMetadata rollbackMetadata) throws IOException {
|
||||
createMetaFile(basePath, instantTime, HoodieTimeline.ROLLBACK_EXTENSION, serializeRollbackMetadata(rollbackMetadata).get());
|
||||
public static void createRollbackFile(String basePath, String instantTime, HoodieRollbackMetadata hoodieRollbackMetadata) throws IOException {
|
||||
createMetaFile(basePath, instantTime, HoodieTimeline.ROLLBACK_EXTENSION, serializeRollbackMetadata(hoodieRollbackMetadata).get());
|
||||
}
|
||||
|
||||
private static void createAuxiliaryMetaFile(String basePath, String instantTime, String suffix) throws IOException {
|
||||
|
||||
@@ -341,6 +341,14 @@ public class HoodieTestDataGenerator {
|
||||
}
|
||||
|
||||
private static void createMetadataFile(String f, String basePath, Configuration configuration, HoodieCommitMetadata commitMetadata) {
|
||||
try {
|
||||
createMetadataFile(f, basePath, configuration, commitMetadata.toJsonString().getBytes(StandardCharsets.UTF_8));
|
||||
} catch (IOException e) {
|
||||
throw new HoodieIOException(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
private static void createMetadataFile(String f, String basePath, Configuration configuration, byte[] content) {
|
||||
Path commitFile = new Path(
|
||||
basePath + "/" + HoodieTableMetaClient.METAFOLDER_NAME + "/" + f);
|
||||
FSDataOutputStream os = null;
|
||||
@@ -348,7 +356,7 @@ public class HoodieTestDataGenerator {
|
||||
FileSystem fs = FSUtils.getFs(basePath, configuration);
|
||||
os = fs.create(commitFile, true);
|
||||
// Write empty commit metadata
|
||||
os.writeBytes(new String(commitMetadata.toJsonString().getBytes(StandardCharsets.UTF_8)));
|
||||
os.write(content);
|
||||
} catch (IOException ioe) {
|
||||
throw new HoodieIOException(ioe.getMessage(), ioe);
|
||||
} finally {
|
||||
|
||||
@@ -210,6 +210,13 @@ public class HoodieTestTable {
|
||||
return this;
|
||||
}
|
||||
|
||||
public HoodieTestTable addInflightRollback(String instantTime) throws IOException {
|
||||
createInflightRollbackFile(basePath, instantTime);
|
||||
currentInstantTime = instantTime;
|
||||
metaClient = HoodieTableMetaClient.reload(metaClient);
|
||||
return this;
|
||||
}
|
||||
|
||||
public HoodieTestTable addRollback(String instantTime, HoodieRollbackMetadata rollbackMetadata) throws IOException {
|
||||
createInflightRollbackFile(basePath, instantTime);
|
||||
createRollbackFile(basePath, instantTime, rollbackMetadata);
|
||||
|
||||
Reference in New Issue
Block a user