-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[improvement](binlog) Reduce AlterJobV2/TruncateTable binlog size (#3…
…0505) (#30567) Signed-off-by: Jack Drogon <[email protected]>
- Loading branch information
1 parent
b69344f
commit 50a10c8
Showing
4 changed files
with
113 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
fe/fe-core/src/main/java/org/apache/doris/binlog/AlterJobRecord.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// Licensed to the Apache Software Foundation (ASF) under one | ||
// or more contributor license agreements. See the NOTICE file | ||
// distributed with this work for additional information | ||
// regarding copyright ownership. The ASF licenses this file | ||
// to you under the Apache License, Version 2.0 (the | ||
// "License"); you may not use this file except in compliance | ||
// with the License. You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, | ||
// software distributed under the License is distributed on an | ||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
// KIND, either express or implied. See the License for the | ||
// specific language governing permissions and limitations | ||
// under the License. | ||
|
||
package org.apache.doris.binlog; | ||
|
||
import org.apache.doris.alter.AlterJobV2; | ||
import org.apache.doris.persist.gson.GsonUtils; | ||
|
||
import com.google.gson.annotations.SerializedName; | ||
|
||
public class AlterJobRecord { | ||
@SerializedName(value = "type") | ||
private AlterJobV2.JobType type; | ||
@SerializedName(value = "dbId") | ||
private long dbId; | ||
@SerializedName(value = "tableId") | ||
private long tableId; | ||
@SerializedName(value = "tableName") | ||
private String tableName; | ||
@SerializedName(value = "jobId") | ||
private long jobId; | ||
@SerializedName(value = "jobState") | ||
private AlterJobV2.JobState jobState; | ||
@SerializedName(value = "rawSql") | ||
private String rawSql; | ||
|
||
public AlterJobRecord(AlterJobV2 job) { | ||
this.type = job.getType(); | ||
this.dbId = job.getDbId(); | ||
this.tableId = job.getTableId(); | ||
this.tableName = job.getTableName(); | ||
this.jobId = job.getJobId(); | ||
this.jobState = job.getJobState(); | ||
this.rawSql = job.getRawSql(); | ||
} | ||
|
||
public String toJson() { | ||
return GsonUtils.GSON.toJson(this); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
fe/fe-core/src/main/java/org/apache/doris/binlog/TruncateTableRecord.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// Licensed to the Apache Software Foundation (ASF) under one | ||
// or more contributor license agreements. See the NOTICE file | ||
// distributed with this work for additional information | ||
// regarding copyright ownership. The ASF licenses this file | ||
// to you under the Apache License, Version 2.0 (the | ||
// "License"); you may not use this file except in compliance | ||
// with the License. You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, | ||
// software distributed under the License is distributed on an | ||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
// KIND, either express or implied. See the License for the | ||
// specific language governing permissions and limitations | ||
// under the License. | ||
|
||
package org.apache.doris.binlog; | ||
|
||
import org.apache.doris.persist.TruncateTableInfo; | ||
import org.apache.doris.persist.gson.GsonUtils; | ||
|
||
import com.google.gson.annotations.SerializedName; | ||
|
||
public class TruncateTableRecord { | ||
@SerializedName(value = "dbId") | ||
private long dbId; | ||
@SerializedName(value = "db") | ||
private String db; | ||
@SerializedName(value = "tblId") | ||
private long tblId; | ||
@SerializedName(value = "table") | ||
private String table; | ||
@SerializedName(value = "isEntireTable") | ||
private boolean isEntireTable = false; | ||
@SerializedName(value = "rawSql") | ||
private String rawSql = ""; | ||
|
||
public TruncateTableRecord(TruncateTableInfo info) { | ||
this.dbId = info.getDbId(); | ||
this.db = info.getDb(); | ||
this.tblId = info.getTblId(); | ||
this.table = info.getTable(); | ||
this.isEntireTable = info.isEntireTable(); | ||
this.rawSql = info.getRawSql(); | ||
} | ||
|
||
public String toJson() { | ||
return GsonUtils.GSON.toJson(this); | ||
} | ||
} |