[HUDI-2268] Add upgrade and downgrade to and from 0.9.0 (#3470)
- Added upgrade and downgrade step to and from 0.9.0. Upgrade adds few table properties. Downgrade recreates timeline server based marker files if any.
This commit is contained in:
@@ -30,7 +30,9 @@ public enum HoodieTableVersion {
|
||||
// < 0.6.0 versions
|
||||
ZERO(0),
|
||||
// 0.6.0 onwards
|
||||
ONE(1);
|
||||
ONE(1),
|
||||
// 0.9.0 onwards
|
||||
TWO(2);
|
||||
|
||||
private final int versionCode;
|
||||
|
||||
@@ -43,10 +45,10 @@ public enum HoodieTableVersion {
|
||||
}
|
||||
|
||||
public static HoodieTableVersion current() {
|
||||
return ONE;
|
||||
return TWO;
|
||||
}
|
||||
|
||||
static HoodieTableVersion versionFromCode(int versionCode) {
|
||||
public static HoodieTableVersion versionFromCode(int versionCode) {
|
||||
return Arrays.stream(HoodieTableVersion.values())
|
||||
.filter(v -> v.versionCode == versionCode).findAny()
|
||||
.orElseThrow(() -> new HoodieException("Unknown versionCode:" + versionCode));
|
||||
|
||||
@@ -179,12 +179,13 @@ public class MarkerUtils {
|
||||
try {
|
||||
if (fileSystem.exists(dirPath)) {
|
||||
FileStatus[] fileStatuses = fileSystem.listStatus(dirPath);
|
||||
Predicate<String> prefixFilter = pathStr -> pathStr.contains(MARKERS_FILENAME_PREFIX);
|
||||
Predicate<String> markerTypeFilter =
|
||||
pathStr -> !stripMarkerFolderPrefix(pathStr, markerDir).equals(MARKER_TYPE_FILENAME);
|
||||
Predicate<FileStatus> prefixFilter = fileStatus ->
|
||||
fileStatus.getPath().getName().startsWith(MARKERS_FILENAME_PREFIX);
|
||||
Predicate<FileStatus> markerTypeFilter = fileStatus ->
|
||||
!fileStatus.getPath().getName().equals(MARKER_TYPE_FILENAME);
|
||||
List<String> markerDirSubPaths = Arrays.stream(fileStatuses)
|
||||
.map(fileStatus -> fileStatus.getPath().toString())
|
||||
.filter(prefixFilter.and(markerTypeFilter))
|
||||
.map(fileStatus -> fileStatus.getPath().toString())
|
||||
.collect(Collectors.toList());
|
||||
|
||||
if (markerDirSubPaths.size() > 0) {
|
||||
@@ -216,4 +217,4 @@ public class MarkerUtils {
|
||||
throw new HoodieIOException(ioe.getMessage(), ioe);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user