diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/TableProperty.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/TableProperty.java index 479251ab9d99819..808b63fadc8001d 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/catalog/TableProperty.java +++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/TableProperty.java @@ -24,6 +24,7 @@ import org.apache.doris.common.io.Writable; import org.apache.doris.common.util.PropertyAnalyzer; import org.apache.doris.persist.OperationType; +import org.apache.doris.persist.gson.GsonPostProcessable; import org.apache.doris.persist.gson.GsonUtils; import org.apache.doris.thrift.TCompressionType; import org.apache.doris.thrift.TInvertedIndexStorageFormat; @@ -54,7 +55,7 @@ * Different properties is recognized by prefix such as dynamic_partition * If there is different type properties is added, write a method such as buildDynamicProperty to build it. */ -public class TableProperty implements Writable { +public class TableProperty implements Writable, GsonPostProcessable { private static final Logger LOG = LogManager.getLogger(TableProperty.class); @SerializedName(value = "properties") @@ -627,46 +628,50 @@ public void write(DataOutput out) throws IOException { } public static TableProperty read(DataInput in) throws IOException { - TableProperty tableProperty = GsonUtils.GSON.fromJson(Text.readString(in), TableProperty.class) - .executeBuildDynamicProperty() - .buildInMemory() - .buildMinLoadReplicaNum() - .buildStorageMedium() - .buildStorageFormat() - .buildInvertedIndexStorageFormat() - .buildDataSortInfo() - .buildCompressionType() - .buildStoragePolicy() - .buildIsBeingSynced() - .buildBinlogConfig() - .buildEnableLightSchemaChange() - .buildStoreRowColumn() - .buildRowStoreColumns() - .buildSkipWriteIndexOnLoad() - .buildCompactionPolicy() - .buildTimeSeriesCompactionGoalSizeMbytes() - .buildTimeSeriesCompactionFileCountThreshold() - .buildTimeSeriesCompactionTimeThresholdSeconds() - .buildDisableAutoCompaction() - .buildEnableSingleReplicaCompaction() - .buildTimeSeriesCompactionEmptyRowsetsThreshold() - .buildTimeSeriesCompactionLevelThreshold() - .buildTTLSeconds(); + TableProperty tableProperty = GsonUtils.GSON.fromJson(Text.readString(in), TableProperty.class); + return tableProperty; + } + + public void gsonPostProcess() throws IOException { + executeBuildDynamicProperty(); + buildInMemory(); + buildMinLoadReplicaNum(); + buildStorageMedium(); + buildStorageFormat(); + buildInvertedIndexStorageFormat(); + buildDataSortInfo(); + buildCompressionType(); + buildStoragePolicy(); + buildIsBeingSynced(); + buildBinlogConfig(); + buildEnableLightSchemaChange(); + buildStoreRowColumn(); + buildRowStoreColumns(); + buildSkipWriteIndexOnLoad(); + buildCompactionPolicy(); + buildTimeSeriesCompactionGoalSizeMbytes(); + buildTimeSeriesCompactionFileCountThreshold(); + buildTimeSeriesCompactionTimeThresholdSeconds(); + buildDisableAutoCompaction(); + buildEnableSingleReplicaCompaction(); + buildTimeSeriesCompactionEmptyRowsetsThreshold(); + buildTimeSeriesCompactionLevelThreshold(); + buildTTLSeconds(); + if (Env.getCurrentEnvJournalVersion() < FeMetaVersion.VERSION_105) { // get replica num from property map and create replica allocation - String repNum = tableProperty.properties.remove(PropertyAnalyzer.PROPERTIES_REPLICATION_NUM); + String repNum = properties.remove(PropertyAnalyzer.PROPERTIES_REPLICATION_NUM); if (!Strings.isNullOrEmpty(repNum)) { ReplicaAllocation replicaAlloc = new ReplicaAllocation(Short.valueOf(repNum)); - tableProperty.properties.put("default." + PropertyAnalyzer.PROPERTIES_REPLICATION_ALLOCATION, + properties.put("default." + PropertyAnalyzer.PROPERTIES_REPLICATION_ALLOCATION, replicaAlloc.toCreateStmt()); } else { - tableProperty.properties.put("default." + PropertyAnalyzer.PROPERTIES_REPLICATION_ALLOCATION, + properties.put("default." + PropertyAnalyzer.PROPERTIES_REPLICATION_ALLOCATION, ReplicaAllocation.DEFAULT_ALLOCATION.toCreateStmt()); } } - tableProperty.removeDuplicateReplicaNumProperty(); - tableProperty.buildReplicaAllocation(); - return tableProperty; + removeDuplicateReplicaNumProperty(); + buildReplicaAllocation(); } // For some historical reason, diff --git a/fe/fe-core/src/main/java/org/apache/doris/load/loadv2/LoadJob.java b/fe/fe-core/src/main/java/org/apache/doris/load/loadv2/LoadJob.java index 91cdd9003866159..3bbbd090febd707 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/load/loadv2/LoadJob.java +++ b/fe/fe-core/src/main/java/org/apache/doris/load/loadv2/LoadJob.java @@ -844,6 +844,10 @@ public void getJobInfo(Load.JobInfo jobInfo) throws DdlException { } public static LoadJob read(DataInput in) throws IOException { + if (Env.getCurrentEnvJournalVersion() >= FeMetaVersion.VERSION_136) { + return GsonUtils.GSON.fromJson(Text.readString(in), LoadJob.class); + } + LoadJob job = null; EtlJobType type = EtlJobType.valueOf(Text.readString(in)); if (type == EtlJobType.BROKER) {