|
|
|
|
@@ -378,7 +378,7 @@ public class TestHoodieTableFileSystemView extends HoodieCommonTestHarness {
|
|
|
|
|
|
|
|
|
|
String dataFileName = null;
|
|
|
|
|
if (!skipCreatingDataFile) {
|
|
|
|
|
dataFileName = FSUtils.makeDataFileName(instantTime1, TEST_WRITE_TOKEN, fileId);
|
|
|
|
|
dataFileName = FSUtils.makeBaseFileName(instantTime1, TEST_WRITE_TOKEN, fileId);
|
|
|
|
|
new File(basePath + "/" + partitionPath + "/" + dataFileName).createNewFile();
|
|
|
|
|
}
|
|
|
|
|
String fileName1 =
|
|
|
|
|
@@ -417,7 +417,7 @@ public class TestHoodieTableFileSystemView extends HoodieCommonTestHarness {
|
|
|
|
|
checkExternalFile(srcFileStatus, fileSlice.getBaseFile().get().getBootstrapBaseFile(), testBootstrap);
|
|
|
|
|
}
|
|
|
|
|
String compactionRequestedTime = "4";
|
|
|
|
|
String compactDataFileName = FSUtils.makeDataFileName(compactionRequestedTime, TEST_WRITE_TOKEN, fileId);
|
|
|
|
|
String compactDataFileName = FSUtils.makeBaseFileName(compactionRequestedTime, TEST_WRITE_TOKEN, fileId);
|
|
|
|
|
List<Pair<String, FileSlice>> partitionFileSlicesPairs = new ArrayList<>();
|
|
|
|
|
partitionFileSlicesPairs.add(Pair.of(partitionPath, fileSlices.get(0)));
|
|
|
|
|
HoodieCompactionPlan compactionPlan =
|
|
|
|
|
@@ -552,12 +552,12 @@ public class TestHoodieTableFileSystemView extends HoodieCommonTestHarness {
|
|
|
|
|
final String orphanFileId2 = UUID.randomUUID().toString();
|
|
|
|
|
final String invalidInstantId = "INVALIDTIME";
|
|
|
|
|
String inflightDeltaInstantTime = "7";
|
|
|
|
|
String orphanDataFileName = FSUtils.makeDataFileName(invalidInstantId, TEST_WRITE_TOKEN, orphanFileId1);
|
|
|
|
|
String orphanDataFileName = FSUtils.makeBaseFileName(invalidInstantId, TEST_WRITE_TOKEN, orphanFileId1);
|
|
|
|
|
new File(basePath + "/" + partitionPath + "/" + orphanDataFileName).createNewFile();
|
|
|
|
|
String orphanLogFileName =
|
|
|
|
|
FSUtils.makeLogFileName(orphanFileId2, HoodieLogFile.DELTA_EXTENSION, invalidInstantId, 0, TEST_WRITE_TOKEN);
|
|
|
|
|
new File(basePath + "/" + partitionPath + "/" + orphanLogFileName).createNewFile();
|
|
|
|
|
String inflightDataFileName = FSUtils.makeDataFileName(inflightDeltaInstantTime, TEST_WRITE_TOKEN, inflightFileId1);
|
|
|
|
|
String inflightDataFileName = FSUtils.makeBaseFileName(inflightDeltaInstantTime, TEST_WRITE_TOKEN, inflightFileId1);
|
|
|
|
|
new File(basePath + "/" + partitionPath + "/" + inflightDataFileName).createNewFile();
|
|
|
|
|
String inflightLogFileName = FSUtils.makeLogFileName(inflightFileId2, HoodieLogFile.DELTA_EXTENSION,
|
|
|
|
|
inflightDeltaInstantTime, 0, TEST_WRITE_TOKEN);
|
|
|
|
|
@@ -712,7 +712,7 @@ public class TestHoodieTableFileSystemView extends HoodieCommonTestHarness {
|
|
|
|
|
|
|
|
|
|
// Only one commit, but is not safe
|
|
|
|
|
String commitTime1 = "1";
|
|
|
|
|
String fileName1 = FSUtils.makeDataFileName(commitTime1, TEST_WRITE_TOKEN, fileId);
|
|
|
|
|
String fileName1 = FSUtils.makeBaseFileName(commitTime1, TEST_WRITE_TOKEN, fileId);
|
|
|
|
|
new File(basePath + "/" + partitionPath + "/" + fileName1).createNewFile();
|
|
|
|
|
refreshFsView();
|
|
|
|
|
assertFalse(roView.getLatestBaseFiles(partitionPath).anyMatch(dfile -> dfile.getFileId().equals(fileId)),
|
|
|
|
|
@@ -728,7 +728,7 @@ public class TestHoodieTableFileSystemView extends HoodieCommonTestHarness {
|
|
|
|
|
|
|
|
|
|
// Do another commit, but not safe
|
|
|
|
|
String commitTime2 = "2";
|
|
|
|
|
String fileName2 = FSUtils.makeDataFileName(commitTime2, TEST_WRITE_TOKEN, fileId);
|
|
|
|
|
String fileName2 = FSUtils.makeBaseFileName(commitTime2, TEST_WRITE_TOKEN, fileId);
|
|
|
|
|
new File(basePath + "/" + partitionPath + "/" + fileName2).createNewFile();
|
|
|
|
|
refreshFsView();
|
|
|
|
|
assertEquals(fileName1, roView.getLatestBaseFiles(partitionPath)
|
|
|
|
|
@@ -762,22 +762,22 @@ public class TestHoodieTableFileSystemView extends HoodieCommonTestHarness {
|
|
|
|
|
String fileId3 = UUID.randomUUID().toString();
|
|
|
|
|
String fileId4 = UUID.randomUUID().toString();
|
|
|
|
|
|
|
|
|
|
new File(fullPartitionPath + FSUtils.makeDataFileName(commitTime1, TEST_WRITE_TOKEN, fileId1)).createNewFile();
|
|
|
|
|
new File(fullPartitionPath + FSUtils.makeDataFileName(commitTime4, TEST_WRITE_TOKEN, fileId1)).createNewFile();
|
|
|
|
|
new File(fullPartitionPath + FSUtils.makeBaseFileName(commitTime1, TEST_WRITE_TOKEN, fileId1)).createNewFile();
|
|
|
|
|
new File(fullPartitionPath + FSUtils.makeBaseFileName(commitTime4, TEST_WRITE_TOKEN, fileId1)).createNewFile();
|
|
|
|
|
new File(fullPartitionPath
|
|
|
|
|
+ FSUtils.makeLogFileName(fileId1, HoodieLogFile.DELTA_EXTENSION, commitTime4, 0, TEST_WRITE_TOKEN))
|
|
|
|
|
.createNewFile();
|
|
|
|
|
new File(fullPartitionPath
|
|
|
|
|
+ FSUtils.makeLogFileName(fileId1, HoodieLogFile.DELTA_EXTENSION, commitTime4, 1, TEST_WRITE_TOKEN))
|
|
|
|
|
.createNewFile();
|
|
|
|
|
new File(fullPartitionPath + FSUtils.makeDataFileName(commitTime1, TEST_WRITE_TOKEN, fileId2)).createNewFile();
|
|
|
|
|
new File(fullPartitionPath + FSUtils.makeDataFileName(commitTime2, TEST_WRITE_TOKEN, fileId2)).createNewFile();
|
|
|
|
|
new File(fullPartitionPath + FSUtils.makeDataFileName(commitTime3, TEST_WRITE_TOKEN, fileId2)).createNewFile();
|
|
|
|
|
new File(fullPartitionPath + FSUtils.makeBaseFileName(commitTime1, TEST_WRITE_TOKEN, fileId2)).createNewFile();
|
|
|
|
|
new File(fullPartitionPath + FSUtils.makeBaseFileName(commitTime2, TEST_WRITE_TOKEN, fileId2)).createNewFile();
|
|
|
|
|
new File(fullPartitionPath + FSUtils.makeBaseFileName(commitTime3, TEST_WRITE_TOKEN, fileId2)).createNewFile();
|
|
|
|
|
new File(fullPartitionPath
|
|
|
|
|
+ FSUtils.makeLogFileName(fileId2, HoodieLogFile.DELTA_EXTENSION, commitTime3, 0, TEST_WRITE_TOKEN))
|
|
|
|
|
.createNewFile();
|
|
|
|
|
new File(fullPartitionPath + FSUtils.makeDataFileName(commitTime3, TEST_WRITE_TOKEN, fileId3)).createNewFile();
|
|
|
|
|
new File(fullPartitionPath + FSUtils.makeDataFileName(commitTime4, TEST_WRITE_TOKEN, fileId3)).createNewFile();
|
|
|
|
|
new File(fullPartitionPath + FSUtils.makeBaseFileName(commitTime3, TEST_WRITE_TOKEN, fileId3)).createNewFile();
|
|
|
|
|
new File(fullPartitionPath + FSUtils.makeBaseFileName(commitTime4, TEST_WRITE_TOKEN, fileId3)).createNewFile();
|
|
|
|
|
new File(fullPartitionPath
|
|
|
|
|
+ FSUtils.makeLogFileName(fileId4, HoodieLogFile.DELTA_EXTENSION, commitTime4, 0, TEST_WRITE_TOKEN))
|
|
|
|
|
.createNewFile();
|
|
|
|
|
@@ -827,9 +827,9 @@ public class TestHoodieTableFileSystemView extends HoodieCommonTestHarness {
|
|
|
|
|
for (HoodieBaseFile status : dataFileList) {
|
|
|
|
|
filenames.add(status.getFileName());
|
|
|
|
|
}
|
|
|
|
|
assertTrue(filenames.contains(FSUtils.makeDataFileName(commitTime4, TEST_WRITE_TOKEN, fileId1)));
|
|
|
|
|
assertTrue(filenames.contains(FSUtils.makeDataFileName(commitTime3, TEST_WRITE_TOKEN, fileId2)));
|
|
|
|
|
assertTrue(filenames.contains(FSUtils.makeDataFileName(commitTime4, TEST_WRITE_TOKEN, fileId3)));
|
|
|
|
|
assertTrue(filenames.contains(FSUtils.makeBaseFileName(commitTime4, TEST_WRITE_TOKEN, fileId1)));
|
|
|
|
|
assertTrue(filenames.contains(FSUtils.makeBaseFileName(commitTime3, TEST_WRITE_TOKEN, fileId2)));
|
|
|
|
|
assertTrue(filenames.contains(FSUtils.makeBaseFileName(commitTime4, TEST_WRITE_TOKEN, fileId3)));
|
|
|
|
|
|
|
|
|
|
filenames = new HashSet<>();
|
|
|
|
|
List<HoodieLogFile> logFilesList = rtView.getLatestFileSlicesBeforeOrOn("2016/05/01", commitTime4, true)
|
|
|
|
|
@@ -856,12 +856,12 @@ public class TestHoodieTableFileSystemView extends HoodieCommonTestHarness {
|
|
|
|
|
}
|
|
|
|
|
if (!isLatestFileSliceOnly) {
|
|
|
|
|
assertEquals(3, dataFiles.size());
|
|
|
|
|
assertTrue(filenames.contains(FSUtils.makeDataFileName(commitTime1, TEST_WRITE_TOKEN, fileId1)));
|
|
|
|
|
assertTrue(filenames.contains(FSUtils.makeDataFileName(commitTime3, TEST_WRITE_TOKEN, fileId2)));
|
|
|
|
|
assertTrue(filenames.contains(FSUtils.makeDataFileName(commitTime3, TEST_WRITE_TOKEN, fileId3)));
|
|
|
|
|
assertTrue(filenames.contains(FSUtils.makeBaseFileName(commitTime1, TEST_WRITE_TOKEN, fileId1)));
|
|
|
|
|
assertTrue(filenames.contains(FSUtils.makeBaseFileName(commitTime3, TEST_WRITE_TOKEN, fileId2)));
|
|
|
|
|
assertTrue(filenames.contains(FSUtils.makeBaseFileName(commitTime3, TEST_WRITE_TOKEN, fileId3)));
|
|
|
|
|
} else {
|
|
|
|
|
assertEquals(1, dataFiles.size());
|
|
|
|
|
assertTrue(filenames.contains(FSUtils.makeDataFileName(commitTime3, TEST_WRITE_TOKEN, fileId2)));
|
|
|
|
|
assertTrue(filenames.contains(FSUtils.makeBaseFileName(commitTime3, TEST_WRITE_TOKEN, fileId2)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
logFilesList = rtView.getLatestFileSlicesBeforeOrOn("2016/05/01", commitTime3, true)
|
|
|
|
|
@@ -887,13 +887,13 @@ public class TestHoodieTableFileSystemView extends HoodieCommonTestHarness {
|
|
|
|
|
String fileId2 = UUID.randomUUID().toString();
|
|
|
|
|
String fileId3 = UUID.randomUUID().toString();
|
|
|
|
|
|
|
|
|
|
new File(fullPartitionPath + FSUtils.makeDataFileName(commitTime1, TEST_WRITE_TOKEN, fileId1)).createNewFile();
|
|
|
|
|
new File(fullPartitionPath + FSUtils.makeDataFileName(commitTime4, TEST_WRITE_TOKEN, fileId1)).createNewFile();
|
|
|
|
|
new File(fullPartitionPath + FSUtils.makeDataFileName(commitTime1, TEST_WRITE_TOKEN, fileId2)).createNewFile();
|
|
|
|
|
new File(fullPartitionPath + FSUtils.makeDataFileName(commitTime2, TEST_WRITE_TOKEN, fileId2)).createNewFile();
|
|
|
|
|
new File(fullPartitionPath + FSUtils.makeDataFileName(commitTime3, TEST_WRITE_TOKEN, fileId2)).createNewFile();
|
|
|
|
|
new File(fullPartitionPath + FSUtils.makeDataFileName(commitTime3, TEST_WRITE_TOKEN, fileId3)).createNewFile();
|
|
|
|
|
new File(fullPartitionPath + FSUtils.makeDataFileName(commitTime4, TEST_WRITE_TOKEN, fileId3)).createNewFile();
|
|
|
|
|
new File(fullPartitionPath + FSUtils.makeBaseFileName(commitTime1, TEST_WRITE_TOKEN, fileId1)).createNewFile();
|
|
|
|
|
new File(fullPartitionPath + FSUtils.makeBaseFileName(commitTime4, TEST_WRITE_TOKEN, fileId1)).createNewFile();
|
|
|
|
|
new File(fullPartitionPath + FSUtils.makeBaseFileName(commitTime1, TEST_WRITE_TOKEN, fileId2)).createNewFile();
|
|
|
|
|
new File(fullPartitionPath + FSUtils.makeBaseFileName(commitTime2, TEST_WRITE_TOKEN, fileId2)).createNewFile();
|
|
|
|
|
new File(fullPartitionPath + FSUtils.makeBaseFileName(commitTime3, TEST_WRITE_TOKEN, fileId2)).createNewFile();
|
|
|
|
|
new File(fullPartitionPath + FSUtils.makeBaseFileName(commitTime3, TEST_WRITE_TOKEN, fileId3)).createNewFile();
|
|
|
|
|
new File(fullPartitionPath + FSUtils.makeBaseFileName(commitTime4, TEST_WRITE_TOKEN, fileId3)).createNewFile();
|
|
|
|
|
|
|
|
|
|
new File(basePath + "/.hoodie/" + commitTime1 + ".commit").createNewFile();
|
|
|
|
|
new File(basePath + "/.hoodie/" + commitTime2 + ".commit").createNewFile();
|
|
|
|
|
@@ -918,22 +918,22 @@ public class TestHoodieTableFileSystemView extends HoodieCommonTestHarness {
|
|
|
|
|
Set<String> expFileNames = new HashSet<>();
|
|
|
|
|
if (fileId.equals(fileId1)) {
|
|
|
|
|
if (!isLatestFileSliceOnly) {
|
|
|
|
|
expFileNames.add(FSUtils.makeDataFileName(commitTime1, TEST_WRITE_TOKEN, fileId1));
|
|
|
|
|
expFileNames.add(FSUtils.makeBaseFileName(commitTime1, TEST_WRITE_TOKEN, fileId1));
|
|
|
|
|
}
|
|
|
|
|
expFileNames.add(FSUtils.makeDataFileName(commitTime4, TEST_WRITE_TOKEN, fileId1));
|
|
|
|
|
expFileNames.add(FSUtils.makeBaseFileName(commitTime4, TEST_WRITE_TOKEN, fileId1));
|
|
|
|
|
assertEquals(expFileNames, filenames);
|
|
|
|
|
} else if (fileId.equals(fileId2)) {
|
|
|
|
|
if (!isLatestFileSliceOnly) {
|
|
|
|
|
expFileNames.add(FSUtils.makeDataFileName(commitTime1, TEST_WRITE_TOKEN, fileId2));
|
|
|
|
|
expFileNames.add(FSUtils.makeDataFileName(commitTime2, TEST_WRITE_TOKEN, fileId2));
|
|
|
|
|
expFileNames.add(FSUtils.makeBaseFileName(commitTime1, TEST_WRITE_TOKEN, fileId2));
|
|
|
|
|
expFileNames.add(FSUtils.makeBaseFileName(commitTime2, TEST_WRITE_TOKEN, fileId2));
|
|
|
|
|
}
|
|
|
|
|
expFileNames.add(FSUtils.makeDataFileName(commitTime3, TEST_WRITE_TOKEN, fileId2));
|
|
|
|
|
expFileNames.add(FSUtils.makeBaseFileName(commitTime3, TEST_WRITE_TOKEN, fileId2));
|
|
|
|
|
assertEquals(expFileNames, filenames);
|
|
|
|
|
} else {
|
|
|
|
|
if (!isLatestFileSliceOnly) {
|
|
|
|
|
expFileNames.add(FSUtils.makeDataFileName(commitTime3, TEST_WRITE_TOKEN, fileId3));
|
|
|
|
|
expFileNames.add(FSUtils.makeBaseFileName(commitTime3, TEST_WRITE_TOKEN, fileId3));
|
|
|
|
|
}
|
|
|
|
|
expFileNames.add(FSUtils.makeDataFileName(commitTime4, TEST_WRITE_TOKEN, fileId3));
|
|
|
|
|
expFileNames.add(FSUtils.makeBaseFileName(commitTime4, TEST_WRITE_TOKEN, fileId3));
|
|
|
|
|
assertEquals(expFileNames, filenames);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -956,21 +956,21 @@ public class TestHoodieTableFileSystemView extends HoodieCommonTestHarness {
|
|
|
|
|
String fileId2 = UUID.randomUUID().toString();
|
|
|
|
|
String fileId3 = UUID.randomUUID().toString();
|
|
|
|
|
|
|
|
|
|
new File(fullPartitionPath + FSUtils.makeDataFileName(commitTime1, TEST_WRITE_TOKEN, fileId1)).createNewFile();
|
|
|
|
|
new File(fullPartitionPath + FSUtils.makeBaseFileName(commitTime1, TEST_WRITE_TOKEN, fileId1)).createNewFile();
|
|
|
|
|
new File(fullPartitionPath
|
|
|
|
|
+ FSUtils.makeLogFileName(fileId1, HoodieLogFile.DELTA_EXTENSION, commitTime1, 0, TEST_WRITE_TOKEN))
|
|
|
|
|
.createNewFile();
|
|
|
|
|
new File(fullPartitionPath + FSUtils.makeDataFileName(commitTime3, TEST_WRITE_TOKEN, fileId1)).createNewFile();
|
|
|
|
|
new File(fullPartitionPath + FSUtils.makeBaseFileName(commitTime3, TEST_WRITE_TOKEN, fileId1)).createNewFile();
|
|
|
|
|
|
|
|
|
|
new File(fullPartitionPath + FSUtils.makeDataFileName(commitTime1, TEST_WRITE_TOKEN, fileId2)).createNewFile();
|
|
|
|
|
new File(fullPartitionPath + FSUtils.makeDataFileName(commitTime2, TEST_WRITE_TOKEN, fileId2)).createNewFile();
|
|
|
|
|
new File(fullPartitionPath + FSUtils.makeDataFileName(commitTime3, TEST_WRITE_TOKEN, fileId2)).createNewFile();
|
|
|
|
|
new File(fullPartitionPath + FSUtils.makeBaseFileName(commitTime1, TEST_WRITE_TOKEN, fileId2)).createNewFile();
|
|
|
|
|
new File(fullPartitionPath + FSUtils.makeBaseFileName(commitTime2, TEST_WRITE_TOKEN, fileId2)).createNewFile();
|
|
|
|
|
new File(fullPartitionPath + FSUtils.makeBaseFileName(commitTime3, TEST_WRITE_TOKEN, fileId2)).createNewFile();
|
|
|
|
|
new File(fullPartitionPath
|
|
|
|
|
+ FSUtils.makeLogFileName(fileId2, HoodieLogFile.DELTA_EXTENSION, commitTime3, 0, TEST_WRITE_TOKEN))
|
|
|
|
|
.createNewFile();
|
|
|
|
|
|
|
|
|
|
new File(fullPartitionPath + FSUtils.makeDataFileName(commitTime3, TEST_WRITE_TOKEN, fileId3)).createNewFile();
|
|
|
|
|
new File(fullPartitionPath + FSUtils.makeDataFileName(commitTime4, TEST_WRITE_TOKEN, fileId3)).createNewFile();
|
|
|
|
|
new File(fullPartitionPath + FSUtils.makeBaseFileName(commitTime3, TEST_WRITE_TOKEN, fileId3)).createNewFile();
|
|
|
|
|
new File(fullPartitionPath + FSUtils.makeBaseFileName(commitTime4, TEST_WRITE_TOKEN, fileId3)).createNewFile();
|
|
|
|
|
|
|
|
|
|
new File(basePath + "/.hoodie/" + commitTime1 + ".commit").createNewFile();
|
|
|
|
|
new File(basePath + "/.hoodie/" + commitTime2 + ".commit").createNewFile();
|
|
|
|
|
@@ -993,10 +993,10 @@ public class TestHoodieTableFileSystemView extends HoodieCommonTestHarness {
|
|
|
|
|
filenames.add(status.getFileName());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
assertTrue(filenames.contains(FSUtils.makeDataFileName(commitTime3, TEST_WRITE_TOKEN, fileId1)));
|
|
|
|
|
assertTrue(filenames.contains(FSUtils.makeDataFileName(commitTime3, TEST_WRITE_TOKEN, fileId2)));
|
|
|
|
|
assertTrue(filenames.contains(FSUtils.makeBaseFileName(commitTime3, TEST_WRITE_TOKEN, fileId1)));
|
|
|
|
|
assertTrue(filenames.contains(FSUtils.makeBaseFileName(commitTime3, TEST_WRITE_TOKEN, fileId2)));
|
|
|
|
|
if (!isLatestFileSliceOnly) {
|
|
|
|
|
assertTrue(filenames.contains(FSUtils.makeDataFileName(commitTime3, TEST_WRITE_TOKEN, fileId3)));
|
|
|
|
|
assertTrue(filenames.contains(FSUtils.makeBaseFileName(commitTime3, TEST_WRITE_TOKEN, fileId3)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<FileSlice> slices =
|
|
|
|
|
@@ -1037,13 +1037,13 @@ public class TestHoodieTableFileSystemView extends HoodieCommonTestHarness {
|
|
|
|
|
String fileId2 = UUID.randomUUID().toString();
|
|
|
|
|
String fileId3 = UUID.randomUUID().toString();
|
|
|
|
|
|
|
|
|
|
new File(fullPartitionPath + FSUtils.makeDataFileName(commitTime1, TEST_WRITE_TOKEN, fileId1)).createNewFile();
|
|
|
|
|
new File(fullPartitionPath + FSUtils.makeDataFileName(commitTime4, TEST_WRITE_TOKEN, fileId1)).createNewFile();
|
|
|
|
|
new File(fullPartitionPath + FSUtils.makeDataFileName(commitTime1, TEST_WRITE_TOKEN, fileId2)).createNewFile();
|
|
|
|
|
new File(fullPartitionPath + FSUtils.makeDataFileName(commitTime2, TEST_WRITE_TOKEN, fileId2)).createNewFile();
|
|
|
|
|
new File(fullPartitionPath + FSUtils.makeDataFileName(commitTime3, TEST_WRITE_TOKEN, fileId2)).createNewFile();
|
|
|
|
|
new File(fullPartitionPath + FSUtils.makeDataFileName(commitTime3, TEST_WRITE_TOKEN, fileId3)).createNewFile();
|
|
|
|
|
new File(fullPartitionPath + FSUtils.makeDataFileName(commitTime4, TEST_WRITE_TOKEN, fileId3)).createNewFile();
|
|
|
|
|
new File(fullPartitionPath + FSUtils.makeBaseFileName(commitTime1, TEST_WRITE_TOKEN, fileId1)).createNewFile();
|
|
|
|
|
new File(fullPartitionPath + FSUtils.makeBaseFileName(commitTime4, TEST_WRITE_TOKEN, fileId1)).createNewFile();
|
|
|
|
|
new File(fullPartitionPath + FSUtils.makeBaseFileName(commitTime1, TEST_WRITE_TOKEN, fileId2)).createNewFile();
|
|
|
|
|
new File(fullPartitionPath + FSUtils.makeBaseFileName(commitTime2, TEST_WRITE_TOKEN, fileId2)).createNewFile();
|
|
|
|
|
new File(fullPartitionPath + FSUtils.makeBaseFileName(commitTime3, TEST_WRITE_TOKEN, fileId2)).createNewFile();
|
|
|
|
|
new File(fullPartitionPath + FSUtils.makeBaseFileName(commitTime3, TEST_WRITE_TOKEN, fileId3)).createNewFile();
|
|
|
|
|
new File(fullPartitionPath + FSUtils.makeBaseFileName(commitTime4, TEST_WRITE_TOKEN, fileId3)).createNewFile();
|
|
|
|
|
|
|
|
|
|
new File(basePath + "/.hoodie/" + commitTime1 + ".commit").createNewFile();
|
|
|
|
|
new File(basePath + "/.hoodie/" + commitTime2 + ".commit").createNewFile();
|
|
|
|
|
@@ -1063,8 +1063,8 @@ public class TestHoodieTableFileSystemView extends HoodieCommonTestHarness {
|
|
|
|
|
for (HoodieBaseFile status : dataFiles) {
|
|
|
|
|
filenames.add(status.getFileName());
|
|
|
|
|
}
|
|
|
|
|
assertTrue(filenames.contains(FSUtils.makeDataFileName(commitTime1, TEST_WRITE_TOKEN, fileId1)));
|
|
|
|
|
assertTrue(filenames.contains(FSUtils.makeDataFileName(commitTime2, TEST_WRITE_TOKEN, fileId2)));
|
|
|
|
|
assertTrue(filenames.contains(FSUtils.makeBaseFileName(commitTime1, TEST_WRITE_TOKEN, fileId1)));
|
|
|
|
|
assertTrue(filenames.contains(FSUtils.makeBaseFileName(commitTime2, TEST_WRITE_TOKEN, fileId2)));
|
|
|
|
|
} else {
|
|
|
|
|
assertEquals(0, dataFiles.size());
|
|
|
|
|
}
|
|
|
|
|
@@ -1088,30 +1088,30 @@ public class TestHoodieTableFileSystemView extends HoodieCommonTestHarness {
|
|
|
|
|
String fileId2 = UUID.randomUUID().toString();
|
|
|
|
|
String fileId3 = UUID.randomUUID().toString();
|
|
|
|
|
|
|
|
|
|
new File(fullPartitionPath + "/" + FSUtils.makeDataFileName(commitTime1, TEST_WRITE_TOKEN, fileId1))
|
|
|
|
|
new File(fullPartitionPath + "/" + FSUtils.makeBaseFileName(commitTime1, TEST_WRITE_TOKEN, fileId1))
|
|
|
|
|
.createNewFile();
|
|
|
|
|
new File(fullPartitionPath + "/"
|
|
|
|
|
+ FSUtils.makeLogFileName(fileId1, HoodieLogFile.DELTA_EXTENSION, commitTime1, 0, TEST_WRITE_TOKEN))
|
|
|
|
|
.createNewFile();
|
|
|
|
|
new File(fullPartitionPath + "/" + FSUtils.makeDataFileName(commitTime4, TEST_WRITE_TOKEN, fileId1))
|
|
|
|
|
new File(fullPartitionPath + "/" + FSUtils.makeBaseFileName(commitTime4, TEST_WRITE_TOKEN, fileId1))
|
|
|
|
|
.createNewFile();
|
|
|
|
|
new File(fullPartitionPath + "/"
|
|
|
|
|
+ FSUtils.makeLogFileName(fileId1, HoodieLogFile.DELTA_EXTENSION, commitTime4, 0, TEST_WRITE_TOKEN))
|
|
|
|
|
.createNewFile();
|
|
|
|
|
|
|
|
|
|
new File(fullPartitionPath + "/" + FSUtils.makeDataFileName(commitTime1, TEST_WRITE_TOKEN, fileId2))
|
|
|
|
|
new File(fullPartitionPath + "/" + FSUtils.makeBaseFileName(commitTime1, TEST_WRITE_TOKEN, fileId2))
|
|
|
|
|
.createNewFile();
|
|
|
|
|
new File(fullPartitionPath + "/" + FSUtils.makeDataFileName(commitTime2, TEST_WRITE_TOKEN, fileId2))
|
|
|
|
|
new File(fullPartitionPath + "/" + FSUtils.makeBaseFileName(commitTime2, TEST_WRITE_TOKEN, fileId2))
|
|
|
|
|
.createNewFile();
|
|
|
|
|
new File(fullPartitionPath + "/"
|
|
|
|
|
+ FSUtils.makeLogFileName(fileId2, HoodieLogFile.DELTA_EXTENSION, commitTime2, 0, TEST_WRITE_TOKEN))
|
|
|
|
|
.createNewFile();
|
|
|
|
|
new File(fullPartitionPath + "/" + FSUtils.makeDataFileName(commitTime3, TEST_WRITE_TOKEN, fileId2))
|
|
|
|
|
new File(fullPartitionPath + "/" + FSUtils.makeBaseFileName(commitTime3, TEST_WRITE_TOKEN, fileId2))
|
|
|
|
|
.createNewFile();
|
|
|
|
|
|
|
|
|
|
new File(fullPartitionPath + "/" + FSUtils.makeDataFileName(commitTime3, TEST_WRITE_TOKEN, fileId3))
|
|
|
|
|
new File(fullPartitionPath + "/" + FSUtils.makeBaseFileName(commitTime3, TEST_WRITE_TOKEN, fileId3))
|
|
|
|
|
.createNewFile();
|
|
|
|
|
new File(fullPartitionPath + "/" + FSUtils.makeDataFileName(commitTime4, TEST_WRITE_TOKEN, fileId3))
|
|
|
|
|
new File(fullPartitionPath + "/" + FSUtils.makeBaseFileName(commitTime4, TEST_WRITE_TOKEN, fileId3))
|
|
|
|
|
.createNewFile();
|
|
|
|
|
|
|
|
|
|
new File(basePath + "/.hoodie/" + commitTime1 + ".commit").createNewFile();
|
|
|
|
|
@@ -1158,9 +1158,9 @@ public class TestHoodieTableFileSystemView extends HoodieCommonTestHarness {
|
|
|
|
|
for (HoodieBaseFile status : statuses1) {
|
|
|
|
|
filenames.add(status.getFileName());
|
|
|
|
|
}
|
|
|
|
|
assertTrue(filenames.contains(FSUtils.makeDataFileName(commitTime4, TEST_WRITE_TOKEN, fileId1)));
|
|
|
|
|
assertTrue(filenames.contains(FSUtils.makeDataFileName(commitTime3, TEST_WRITE_TOKEN, fileId2)));
|
|
|
|
|
assertTrue(filenames.contains(FSUtils.makeDataFileName(commitTime4, TEST_WRITE_TOKEN, fileId3)));
|
|
|
|
|
assertTrue(filenames.contains(FSUtils.makeBaseFileName(commitTime4, TEST_WRITE_TOKEN, fileId1)));
|
|
|
|
|
assertTrue(filenames.contains(FSUtils.makeBaseFileName(commitTime3, TEST_WRITE_TOKEN, fileId2)));
|
|
|
|
|
assertTrue(filenames.contains(FSUtils.makeBaseFileName(commitTime4, TEST_WRITE_TOKEN, fileId3)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
@@ -1181,15 +1181,15 @@ public class TestHoodieTableFileSystemView extends HoodieCommonTestHarness {
|
|
|
|
|
String deltaInstantTime2 = "3";
|
|
|
|
|
String fileId = UUID.randomUUID().toString();
|
|
|
|
|
|
|
|
|
|
String dataFileName = FSUtils.makeDataFileName(instantTime1, TEST_WRITE_TOKEN, fileId);
|
|
|
|
|
String dataFileName = FSUtils.makeBaseFileName(instantTime1, TEST_WRITE_TOKEN, fileId);
|
|
|
|
|
new File(fullPartitionPath1 + dataFileName).createNewFile();
|
|
|
|
|
|
|
|
|
|
String fileName1 =
|
|
|
|
|
FSUtils.makeLogFileName(fileId, HoodieLogFile.DELTA_EXTENSION, instantTime1, 0, TEST_WRITE_TOKEN);
|
|
|
|
|
new File(fullPartitionPath1 + fileName1).createNewFile();
|
|
|
|
|
new File(fullPartitionPath2 + FSUtils.makeDataFileName(instantTime1, TEST_WRITE_TOKEN, fileId)).createNewFile();
|
|
|
|
|
new File(fullPartitionPath2 + FSUtils.makeBaseFileName(instantTime1, TEST_WRITE_TOKEN, fileId)).createNewFile();
|
|
|
|
|
new File(fullPartitionPath2 + fileName1).createNewFile();
|
|
|
|
|
new File(fullPartitionPath3 + FSUtils.makeDataFileName(instantTime1, TEST_WRITE_TOKEN, fileId)).createNewFile();
|
|
|
|
|
new File(fullPartitionPath3 + FSUtils.makeBaseFileName(instantTime1, TEST_WRITE_TOKEN, fileId)).createNewFile();
|
|
|
|
|
new File(fullPartitionPath3 + fileName1).createNewFile();
|
|
|
|
|
|
|
|
|
|
HoodieActiveTimeline commitTimeline = metaClient.getActiveTimeline();
|
|
|
|
|
@@ -1228,7 +1228,7 @@ public class TestHoodieTableFileSystemView extends HoodieCommonTestHarness {
|
|
|
|
|
partitionFileSlicesPairs.add(Pair.of(partitionPath3, fileSlices.get(0)));
|
|
|
|
|
|
|
|
|
|
String compactionRequestedTime = "2";
|
|
|
|
|
String compactDataFileName = FSUtils.makeDataFileName(compactionRequestedTime, TEST_WRITE_TOKEN, fileId);
|
|
|
|
|
String compactDataFileName = FSUtils.makeBaseFileName(compactionRequestedTime, TEST_WRITE_TOKEN, fileId);
|
|
|
|
|
HoodieCompactionPlan compactionPlan =
|
|
|
|
|
CompactionUtils.buildFromFileSlices(partitionFileSlicesPairs, Option.empty(), Option.empty());
|
|
|
|
|
|
|
|
|
|
@@ -1345,8 +1345,8 @@ public class TestHoodieTableFileSystemView extends HoodieCommonTestHarness {
|
|
|
|
|
"No commit, should not find any data file");
|
|
|
|
|
// Only one commit
|
|
|
|
|
String commitTime1 = "1";
|
|
|
|
|
String fileName1 = FSUtils.makeDataFileName(commitTime1, TEST_WRITE_TOKEN, fileId1);
|
|
|
|
|
String fileName2 = FSUtils.makeDataFileName(commitTime1, TEST_WRITE_TOKEN, fileId2);
|
|
|
|
|
String fileName1 = FSUtils.makeBaseFileName(commitTime1, TEST_WRITE_TOKEN, fileId1);
|
|
|
|
|
String fileName2 = FSUtils.makeBaseFileName(commitTime1, TEST_WRITE_TOKEN, fileId2);
|
|
|
|
|
new File(basePath + "/" + partitionPath1 + "/" + fileName1).createNewFile();
|
|
|
|
|
new File(basePath + "/" + partitionPath1 + "/" + fileName2).createNewFile();
|
|
|
|
|
|
|
|
|
|
@@ -1362,8 +1362,8 @@ public class TestHoodieTableFileSystemView extends HoodieCommonTestHarness {
|
|
|
|
|
// create commit2 - fileId1 is replaced. new file groups fileId3,fileId4 are created.
|
|
|
|
|
String fileId3 = UUID.randomUUID().toString();
|
|
|
|
|
String fileId4 = UUID.randomUUID().toString();
|
|
|
|
|
String fileName3 = FSUtils.makeDataFileName(commitTime1, TEST_WRITE_TOKEN, fileId3);
|
|
|
|
|
String fileName4 = FSUtils.makeDataFileName(commitTime1, TEST_WRITE_TOKEN, fileId4);
|
|
|
|
|
String fileName3 = FSUtils.makeBaseFileName(commitTime1, TEST_WRITE_TOKEN, fileId3);
|
|
|
|
|
String fileName4 = FSUtils.makeBaseFileName(commitTime1, TEST_WRITE_TOKEN, fileId4);
|
|
|
|
|
new File(basePath + "/" + partitionPath1 + "/" + fileName3).createNewFile();
|
|
|
|
|
new File(basePath + "/" + partitionPath1 + "/" + fileName4).createNewFile();
|
|
|
|
|
|
|
|
|
|
@@ -1440,10 +1440,10 @@ public class TestHoodieTableFileSystemView extends HoodieCommonTestHarness {
|
|
|
|
|
|
|
|
|
|
// Only one commit
|
|
|
|
|
String commitTime1 = "1";
|
|
|
|
|
String fileName1 = FSUtils.makeDataFileName(commitTime1, TEST_WRITE_TOKEN, fileId1);
|
|
|
|
|
String fileName2 = FSUtils.makeDataFileName(commitTime1, TEST_WRITE_TOKEN, fileId2);
|
|
|
|
|
String fileName3 = FSUtils.makeDataFileName(commitTime1, TEST_WRITE_TOKEN, fileId3);
|
|
|
|
|
String fileName4 = FSUtils.makeDataFileName(commitTime1, TEST_WRITE_TOKEN, fileId4);
|
|
|
|
|
String fileName1 = FSUtils.makeBaseFileName(commitTime1, TEST_WRITE_TOKEN, fileId1);
|
|
|
|
|
String fileName2 = FSUtils.makeBaseFileName(commitTime1, TEST_WRITE_TOKEN, fileId2);
|
|
|
|
|
String fileName3 = FSUtils.makeBaseFileName(commitTime1, TEST_WRITE_TOKEN, fileId3);
|
|
|
|
|
String fileName4 = FSUtils.makeBaseFileName(commitTime1, TEST_WRITE_TOKEN, fileId4);
|
|
|
|
|
new File(basePath + "/" + partitionPath1 + "/" + fileName1).createNewFile();
|
|
|
|
|
new File(basePath + "/" + partitionPath1 + "/" + fileName2).createNewFile();
|
|
|
|
|
new File(basePath + "/" + partitionPath2 + "/" + fileName3).createNewFile();
|
|
|
|
|
@@ -1500,9 +1500,9 @@ public class TestHoodieTableFileSystemView extends HoodieCommonTestHarness {
|
|
|
|
|
"No commit, should not find any data file");
|
|
|
|
|
// Only one commit
|
|
|
|
|
String commitTime1 = "1";
|
|
|
|
|
String fileName1 = FSUtils.makeDataFileName(commitTime1, TEST_WRITE_TOKEN, fileId1);
|
|
|
|
|
String fileName2 = FSUtils.makeDataFileName(commitTime1, TEST_WRITE_TOKEN, fileId2);
|
|
|
|
|
String fileName3 = FSUtils.makeDataFileName(commitTime1, TEST_WRITE_TOKEN, fileId3);
|
|
|
|
|
String fileName1 = FSUtils.makeBaseFileName(commitTime1, TEST_WRITE_TOKEN, fileId1);
|
|
|
|
|
String fileName2 = FSUtils.makeBaseFileName(commitTime1, TEST_WRITE_TOKEN, fileId2);
|
|
|
|
|
String fileName3 = FSUtils.makeBaseFileName(commitTime1, TEST_WRITE_TOKEN, fileId3);
|
|
|
|
|
new File(basePath + "/" + partitionPath1 + "/" + fileName1).createNewFile();
|
|
|
|
|
new File(basePath + "/" + partitionPath1 + "/" + fileName2).createNewFile();
|
|
|
|
|
new File(basePath + "/" + partitionPath1 + "/" + fileName3).createNewFile();
|
|
|
|
|
@@ -1614,8 +1614,8 @@ public class TestHoodieTableFileSystemView extends HoodieCommonTestHarness {
|
|
|
|
|
|
|
|
|
|
// first insert commit
|
|
|
|
|
String commitTime1 = "1";
|
|
|
|
|
String fileName1 = FSUtils.makeDataFileName(commitTime1, TEST_WRITE_TOKEN, fileId1);
|
|
|
|
|
String fileName2 = FSUtils.makeDataFileName(commitTime1, TEST_WRITE_TOKEN, fileId2);
|
|
|
|
|
String fileName1 = FSUtils.makeBaseFileName(commitTime1, TEST_WRITE_TOKEN, fileId1);
|
|
|
|
|
String fileName2 = FSUtils.makeBaseFileName(commitTime1, TEST_WRITE_TOKEN, fileId2);
|
|
|
|
|
new File(basePath + "/" + partitionPath + "/" + fileName1).createNewFile();
|
|
|
|
|
new File(basePath + "/" + partitionPath + "/" + fileName2).createNewFile();
|
|
|
|
|
|
|
|
|
|
@@ -1636,7 +1636,7 @@ public class TestHoodieTableFileSystemView extends HoodieCommonTestHarness {
|
|
|
|
|
|
|
|
|
|
// replace commit
|
|
|
|
|
String commitTime2 = "2";
|
|
|
|
|
String fileName3 = FSUtils.makeDataFileName(commitTime2, TEST_WRITE_TOKEN, fileId3);
|
|
|
|
|
String fileName3 = FSUtils.makeBaseFileName(commitTime2, TEST_WRITE_TOKEN, fileId3);
|
|
|
|
|
new File(basePath + "/" + partitionPath + "/" + fileName3).createNewFile();
|
|
|
|
|
|
|
|
|
|
HoodieInstant instant2 = new HoodieInstant(true, HoodieTimeline.REPLACE_COMMIT_ACTION, commitTime2);
|
|
|
|
|
@@ -1658,7 +1658,7 @@ public class TestHoodieTableFileSystemView extends HoodieCommonTestHarness {
|
|
|
|
|
|
|
|
|
|
// another insert commit
|
|
|
|
|
String commitTime3 = "3";
|
|
|
|
|
String fileName4 = FSUtils.makeDataFileName(commitTime3, TEST_WRITE_TOKEN, fileId4);
|
|
|
|
|
String fileName4 = FSUtils.makeBaseFileName(commitTime3, TEST_WRITE_TOKEN, fileId4);
|
|
|
|
|
new File(basePath + "/" + partitionPath + "/" + fileName4).createNewFile();
|
|
|
|
|
HoodieInstant instant3 = new HoodieInstant(true, HoodieTimeline.COMMIT_ACTION, commitTime3);
|
|
|
|
|
|
|
|
|
|
|