Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dataroaring committed Jun 20, 2024
1 parent 84849cb commit 96f7608
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 96f7608

Please sign in to comment.