[HUDI-559] : Make the timeline layout version default to be null version
This commit is contained in:
committed by
Balaji Varadarajan
parent
7087e7d766
commit
ba54a7e973
@@ -22,6 +22,7 @@ import org.apache.hudi.common.model.HoodieFileFormat;
|
||||
import org.apache.hudi.common.model.HoodieTableType;
|
||||
import org.apache.hudi.common.model.OverwriteWithLatestAvroPayload;
|
||||
import org.apache.hudi.common.model.TimelineLayoutVersion;
|
||||
import org.apache.hudi.common.util.Option;
|
||||
import org.apache.hudi.exception.HoodieIOException;
|
||||
|
||||
import org.apache.hadoop.fs.FSDataInputStream;
|
||||
@@ -144,10 +145,10 @@ public class HoodieTableConfig implements Serializable {
|
||||
return DEFAULT_TABLE_TYPE;
|
||||
}
|
||||
|
||||
public TimelineLayoutVersion getTimelineLayoutVersion() {
|
||||
return new TimelineLayoutVersion(Integer.valueOf(props.getProperty(HOODIE_TIMELINE_LAYOUT_VERSION,
|
||||
String.valueOf(DEFAULT_TIMELINE_LAYOUT_VERSION))));
|
||||
|
||||
public Option<TimelineLayoutVersion> getTimelineLayoutVersion() {
|
||||
return props.containsKey(HOODIE_TIMELINE_LAYOUT_VERSION)
|
||||
? Option.of(new TimelineLayoutVersion(Integer.valueOf(props.getProperty(HOODIE_TIMELINE_LAYOUT_VERSION))))
|
||||
: Option.empty();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -117,7 +117,14 @@ public class HoodieTableMetaClient implements Serializable {
|
||||
TableNotFoundException.checkTableValidity(fs, basePathDir, metaPathDir);
|
||||
this.tableConfig = new HoodieTableConfig(fs, metaPath, payloadClassName);
|
||||
this.tableType = tableConfig.getTableType();
|
||||
this.timelineLayoutVersion = layoutVersion.orElse(tableConfig.getTimelineLayoutVersion());
|
||||
Option<TimelineLayoutVersion> tableConfigVersion = tableConfig.getTimelineLayoutVersion();
|
||||
if (layoutVersion.isPresent() && tableConfigVersion.isPresent()) {
|
||||
// Ensure layout version passed in config is not lower than the one seen in hoodie.properties
|
||||
Preconditions.checkArgument(layoutVersion.get().compareTo(tableConfigVersion.get()) >= 0,
|
||||
"Layout Version defined in hoodie properties has higher version (" + tableConfigVersion.get()
|
||||
+ ") than the one passed in config (" + layoutVersion.get() + ")");
|
||||
}
|
||||
this.timelineLayoutVersion = layoutVersion.orElseGet(() -> tableConfig.getTimelineLayoutVersion().get());
|
||||
this.loadActiveTimelineOnLoad = loadActiveTimelineOnLoad;
|
||||
LOG.info("Finished Loading Table of type " + tableType + "(version=" + timelineLayoutVersion + ") from " + basePath);
|
||||
if (loadActiveTimelineOnLoad) {
|
||||
|
||||
Reference in New Issue
Block a user