diff --git a/fe/fe-core/src/main/java/com/starrocks/authentication/UserPropertyInfo.java b/fe/fe-core/src/main/java/com/starrocks/authentication/UserPropertyInfo.java index 174b21bb382e7b..e319ce3f32af4c 100644 --- a/fe/fe-core/src/main/java/com/starrocks/authentication/UserPropertyInfo.java +++ b/fe/fe-core/src/main/java/com/starrocks/authentication/UserPropertyInfo.java @@ -19,12 +19,11 @@ import com.google.common.collect.Lists; import com.google.gson.annotations.SerializedName; -import com.starrocks.cluster.ClusterNamespace; import com.starrocks.common.Pair; import com.starrocks.common.io.Text; import com.starrocks.common.io.Writable; +import com.starrocks.persist.gson.GsonUtils; -import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import java.util.List; @@ -53,29 +52,8 @@ public List> getProperties() { return properties; } - public static UserPropertyInfo read(DataInput in) throws IOException { - UserPropertyInfo info = new UserPropertyInfo(); - info.readFields(in); - return info; - } - @Override public void write(DataOutput out) throws IOException { - Text.writeString(out, ClusterNamespace.getFullName(user)); - out.writeInt(properties.size()); - for (Pair entry : properties) { - Text.writeString(out, entry.first); - Text.writeString(out, entry.second); - } - } - - public void readFields(DataInput in) throws IOException { - user = ClusterNamespace.getNameFromFullName(Text.readString(in)); - int size = in.readInt(); - for (int i = 0; i < size; i++) { - String key = Text.readString(in); - String val = Text.readString(in); - properties.add(Pair.create(key, val)); - } + Text.writeString(out, GsonUtils.GSON.toJson(this)); } } diff --git a/fe/fe-core/src/main/java/com/starrocks/backup/RestoreJob.java b/fe/fe-core/src/main/java/com/starrocks/backup/RestoreJob.java index ee23d4a73fb50d..5efaff6c7c92d6 100644 --- a/fe/fe-core/src/main/java/com/starrocks/backup/RestoreJob.java +++ b/fe/fe-core/src/main/java/com/starrocks/backup/RestoreJob.java @@ -110,7 +110,6 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import java.util.List; @@ -1742,12 +1741,6 @@ private void setTableStateToNormal(Database db) { } } - public static RestoreJob read(DataInput in) throws IOException { - RestoreJob job = new RestoreJob(); - job.readFields(in); - return job; - } - @Override public void write(DataOutput out) throws IOException { super.write(out); diff --git a/fe/fe-core/src/main/java/com/starrocks/ha/LeaderInfo.java b/fe/fe-core/src/main/java/com/starrocks/ha/LeaderInfo.java index 956af6739af294..a309253b0264ac 100644 --- a/fe/fe-core/src/main/java/com/starrocks/ha/LeaderInfo.java +++ b/fe/fe-core/src/main/java/com/starrocks/ha/LeaderInfo.java @@ -20,8 +20,8 @@ import com.google.gson.annotations.SerializedName; import com.starrocks.common.io.Text; import com.starrocks.common.io.Writable; +import com.starrocks.persist.gson.GsonUtils; -import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; @@ -72,15 +72,6 @@ public void setRpcPort(int rpcPort) { @Override public void write(DataOutput out) throws IOException { - Text.writeString(out, ip); - out.writeInt(httpPort); - out.writeInt(rpcPort); + Text.writeString(out, GsonUtils.GSON.toJson(this)); } - - public void readFields(DataInput in) throws IOException { - ip = Text.readString(in); - httpPort = in.readInt(); - rpcPort = in.readInt(); - } - } diff --git a/fe/fe-core/src/main/java/com/starrocks/journal/JournalEntity.java b/fe/fe-core/src/main/java/com/starrocks/journal/JournalEntity.java index ba3412bd0c546e..c6d6a7cbf233c8 100644 --- a/fe/fe-core/src/main/java/com/starrocks/journal/JournalEntity.java +++ b/fe/fe-core/src/main/java/com/starrocks/journal/JournalEntity.java @@ -47,7 +47,6 @@ import com.starrocks.catalog.FunctionSearchDesc; import com.starrocks.catalog.MetaVersion; import com.starrocks.catalog.Resource; -import com.starrocks.cluster.Cluster; import com.starrocks.common.Config; import com.starrocks.common.io.Text; import com.starrocks.common.io.Writable; @@ -55,12 +54,9 @@ import com.starrocks.ha.LeaderInfo; import com.starrocks.journal.bdbje.Timestamp; import com.starrocks.leader.Checkpoint; -import com.starrocks.load.DeleteInfo; import com.starrocks.load.ExportJob; -import com.starrocks.load.LoadErrorHub; import com.starrocks.load.MultiDeleteInfo; import com.starrocks.load.loadv2.LoadJob; -import com.starrocks.load.loadv2.LoadJob.LoadJobStateUpdateInfo; import com.starrocks.load.loadv2.LoadJobFinalOperation; import com.starrocks.load.routineload.RoutineLoadJob; import com.starrocks.load.streamload.StreamLoadTask; @@ -70,11 +66,9 @@ import com.starrocks.persist.AlterLoadJobOperationLog; import com.starrocks.persist.AlterMaterializedViewBaseTableInfosLog; import com.starrocks.persist.AlterMaterializedViewStatusLog; -import com.starrocks.persist.AlterRoutineLoadJobOperationLog; import com.starrocks.persist.AlterUserInfo; import com.starrocks.persist.AlterViewInfo; import com.starrocks.persist.AutoIncrementInfo; -import com.starrocks.persist.BackendIdsUpdateInfo; import com.starrocks.persist.BackendTabletsInfo; import com.starrocks.persist.BatchDeleteReplicaInfo; import com.starrocks.persist.BatchDropInfo; @@ -106,7 +100,6 @@ import com.starrocks.persist.DropStorageVolumeLog; import com.starrocks.persist.GlobalVarPersistInfo; import com.starrocks.persist.HbPackage; -import com.starrocks.persist.ImpersonatePrivInfo; import com.starrocks.persist.InsertOverwriteStateChangeInfo; import com.starrocks.persist.ModifyPartitionInfo; import com.starrocks.persist.ModifyTableColumnOperationLog; @@ -127,7 +120,6 @@ import com.starrocks.persist.RoutineLoadOperation; import com.starrocks.persist.SetDefaultStorageVolumeLog; import com.starrocks.persist.SetReplicaStatusOperationLog; -import com.starrocks.persist.ShardInfo; import com.starrocks.persist.SwapTableOperationLog; import com.starrocks.persist.TableAddOrDropColumnsInfo; import com.starrocks.persist.TableInfo; @@ -137,12 +129,10 @@ import com.starrocks.persist.UserPrivilegeCollectionInfo; import com.starrocks.persist.gson.GsonUtils; import com.starrocks.plugin.PluginInfo; -import com.starrocks.qe.SessionVariable; import com.starrocks.scheduler.Task; import com.starrocks.scheduler.mv.MVEpoch; import com.starrocks.scheduler.mv.MVMaintenanceJob; import com.starrocks.scheduler.persist.ArchiveTaskRunsLog; -import com.starrocks.scheduler.persist.DropTaskRunsLog; import com.starrocks.scheduler.persist.DropTasksLog; import com.starrocks.scheduler.persist.TaskRunPeriodStatusChange; import com.starrocks.scheduler.persist.TaskRunStatus; @@ -212,9 +202,7 @@ public void readFields(DataInput in) throws IOException { switch (opCode) { case OperationType.OP_SAVE_NEXTID: case OperationType.OP_ERASE_DB: - case OperationType.OP_ERASE_TABLE: case OperationType.OP_ERASE_PARTITION: - case OperationType.OP_META_VERSION: case OperationType.OP_DROP_ALL_BROKER: case OperationType.OP_DROP_REPOSITORY: { data = new Text(); @@ -244,13 +232,6 @@ public void readFields(DataInput in) throws IOException { isRead = true; break; } - case OperationType.OP_ALTER_DB: - case OperationType.OP_RENAME_DB: { - data = new DatabaseInfo(); - ((DatabaseInfo) data).readFields(in); - isRead = true; - break; - } case OperationType.OP_ALTER_DB_V2: case OperationType.OP_RENAME_DB_V2: { data = GsonUtils.GSON.fromJson(Text.readString(in), DatabaseInfo.class); @@ -262,13 +243,6 @@ public void readFields(DataInput in) throws IOException { isRead = true; break; } - case OperationType.OP_DROP_TABLE: - case OperationType.OP_DROP_ROLLUP: { - data = new DropInfo(); - ((DropInfo) data).readFields(in); - isRead = true; - break; - } case OperationType.OP_DROP_TABLE_V2: case OperationType.OP_DROP_ROLLUP_V2: { data = GsonUtils.GSON.fromJson(Text.readString(in), DropInfo.class); @@ -315,12 +289,6 @@ public void readFields(DataInput in) throws IOException { isRead = true; break; } - case OperationType.OP_MODIFY_PARTITION: { - data = new ModifyPartitionInfo(); - ((ModifyPartitionInfo) data).readFields(in); - isRead = true; - break; - } case OperationType.OP_MODIFY_PARTITION_V2: { data = GsonUtils.GSON.fromJson(Text.readString(in), ModifyPartitionInfo.class); isRead = true; @@ -331,14 +299,6 @@ public void readFields(DataInput in) throws IOException { isRead = true; break; } - case OperationType.OP_RECOVER_DB: - case OperationType.OP_RECOVER_TABLE: - case OperationType.OP_RECOVER_PARTITION: { - data = new RecoverInfo(); - ((RecoverInfo) data).readFields(in); - isRead = true; - break; - } case OperationType.OP_RECOVER_DB_V2: case OperationType.OP_RECOVER_TABLE_V2: case OperationType.OP_RECOVER_PARTITION_V2: { @@ -351,14 +311,6 @@ public void readFields(DataInput in) throws IOException { isRead = true; break; } - case OperationType.OP_RENAME_TABLE: - case OperationType.OP_RENAME_ROLLUP: - case OperationType.OP_RENAME_PARTITION: { - data = new TableInfo(); - ((TableInfo) data).readFields(in); - isRead = true; - break; - } case OperationType.OP_RENAME_TABLE_V2: case OperationType.OP_RENAME_ROLLUP_V2: case OperationType.OP_RENAME_PARTITION_V2: { @@ -396,21 +348,11 @@ public void readFields(DataInput in) throws IOException { data = AlterMaterializedViewBaseTableInfosLog.read(in); isRead = true; break; - case OperationType.OP_BACKUP_JOB: { - data = AbstractJob.read(in); - isRead = true; - break; - } case OperationType.OP_BACKUP_JOB_V2: { data = GsonUtils.GSON.fromJson(Text.readString(in), AbstractJob.class); isRead = true; break; } - case OperationType.OP_RESTORE_JOB: { - data = AbstractJob.read(in); - isRead = true; - break; - } case OperationType.OP_RESTORE_JOB_V2: { data = GsonUtils.GSON.fromJson(Text.readString(in), AbstractJob.class); isRead = true; @@ -427,47 +369,20 @@ public void readFields(DataInput in) throws IOException { isRead = true; break; } - case OperationType.OP_EXPORT_CREATE: - data = new ExportJob(); - ((ExportJob) data).readFields(in); - isRead = true; - break; case OperationType.OP_EXPORT_CREATE_V2: { data = GsonUtils.GSON.fromJson(Text.readString(in), ExportJob.class); isRead = true; break; } - case OperationType.OP_EXPORT_UPDATE_STATE: - data = new ExportJob.StateTransfer(); - ((ExportJob.StateTransfer) data).readFields(in); - isRead = true; - break; - case OperationType.OP_EXPORT_UPDATE_INFO: - data = ExportJob.ExportUpdateInfo.read(in); - isRead = true; - break; case OperationType.OP_EXPORT_UPDATE_INFO_V2: data = GsonUtils.GSON.fromJson(Text.readString(in), ExportJob.ExportUpdateInfo.class); isRead = true; break; - case OperationType.OP_FINISH_DELETE: - data = new DeleteInfo(); - ((DeleteInfo) data).readFields(in); - isRead = true; - break; case OperationType.OP_FINISH_MULTI_DELETE: { data = MultiDeleteInfo.read(in); isRead = true; break; } - case OperationType.OP_ADD_REPLICA: - case OperationType.OP_UPDATE_REPLICA: - case OperationType.OP_DELETE_REPLICA: - case OperationType.OP_CLEAR_ROLLUP_INFO: { - data = ReplicaPersistInfo.read(in); - isRead = true; - break; - } case OperationType.OP_BATCH_DELETE_REPLICA: { data = GsonUtils.GSON.fromJson(Text.readString(in), BatchDeleteReplicaInfo.class); isRead = true; @@ -480,14 +395,6 @@ public void readFields(DataInput in) throws IOException { isRead = true; break; } - case OperationType.OP_ADD_BACKEND: - case OperationType.OP_DROP_BACKEND: - case OperationType.OP_BACKEND_STATE_CHANGE: { - data = new Backend(); - ((Backend) data).readFields(in); - isRead = true; - break; - } case OperationType.OP_ADD_BACKEND_V2: case OperationType.OP_DROP_BACKEND_V2: case OperationType.OP_BACKEND_STATE_CHANGE_V2: { @@ -505,15 +412,6 @@ public void readFields(DataInput in) throws IOException { isRead = true; break; } - case OperationType.OP_ADD_FRONTEND: - case OperationType.OP_ADD_FIRST_FRONTEND: - case OperationType.OP_UPDATE_FRONTEND: - case OperationType.OP_REMOVE_FRONTEND: { - data = new Frontend(); - ((Frontend) data).readFields(in); - isRead = true; - break; - } case OperationType.OP_ADD_FRONTEND_V2: case OperationType.OP_ADD_FIRST_FRONTEND_V2: case OperationType.OP_UPDATE_FRONTEND_V2: @@ -522,39 +420,11 @@ public void readFields(DataInput in) throws IOException { isRead = true; break; } - case OperationType.OP_SET_LOAD_ERROR_HUB: { - data = new LoadErrorHub.Param(); - ((LoadErrorHub.Param) data).readFields(in); - isRead = true; - break; - } - case OperationType.OP_NEW_DROP_USER: { - data = UserIdentity.read(in); - isRead = true; - break; - } - case OperationType.OP_UPDATE_USER_PROPERTY: { - data = UserPropertyInfo.read(in); - isRead = true; - break; - } - case OperationType.OP_LEADER_INFO_CHANGE: { - data = new LeaderInfo(); - ((LeaderInfo) data).readFields(in); - isRead = true; - break; - } case OperationType.OP_LEADER_INFO_CHANGE_V2: { data = GsonUtils.GSON.fromJson(Text.readString(in), LeaderInfo.class); isRead = true; break; } - case OperationType.OP_TIMESTAMP: { - data = new Timestamp(); - ((Timestamp) data).readFields(in); - isRead = true; - break; - } case OperationType.OP_TIMESTAMP_V2: { data = GsonUtils.GSON.fromJson(Text.readString(in), Timestamp.class); isRead = true; @@ -565,36 +435,12 @@ public void readFields(DataInput in) throws IOException { isRead = true; break; } - case OperationType.OP_GLOBAL_VARIABLE: { - data = new SessionVariable(); - ((SessionVariable) data).readFields(in); - isRead = true; - break; - } - case OperationType.OP_CREATE_CLUSTER: { - data = Cluster.read(in); - isRead = true; - break; - } - case OperationType.OP_ADD_BROKER: - case OperationType.OP_DROP_BROKER: { - data = new BrokerMgr.ModifyBrokerInfo(); - ((BrokerMgr.ModifyBrokerInfo) data).readFields(in); - isRead = true; - break; - } case OperationType.OP_ADD_BROKER_V2: case OperationType.OP_DROP_BROKER_V2: { data = GsonUtils.GSON.fromJson(Text.readString(in), BrokerMgr.ModifyBrokerInfo.class); isRead = true; break; } - case OperationType.OP_UPDATE_CLUSTER_AND_BACKENDS: { - data = new BackendIdsUpdateInfo(); - ((BackendIdsUpdateInfo) data).readFields(in); - isRead = true; - break; - } case OperationType.OP_UPSERT_TRANSACTION_STATE_V2: { data = GsonUtils.GSON.fromJson(Text.readString(in), TransactionState.class); isRead = true; @@ -605,11 +451,6 @@ public void readFields(DataInput in) throws IOException { isRead = true; break; } - case OperationType.OP_CREATE_REPOSITORY: { - data = Repository.read(in); - isRead = true; - break; - } case OperationType.OP_CREATE_REPOSITORY_V2: { data = GsonUtils.GSON.fromJson(Text.readString(in), Repository.class); isRead = true; @@ -620,16 +461,6 @@ public void readFields(DataInput in) throws IOException { isRead = true; break; } - case OperationType.OP_COLOCATE_ADD_TABLE: - case OperationType.OP_COLOCATE_REMOVE_TABLE: - case OperationType.OP_COLOCATE_BACKENDS_PER_BUCKETSEQ: - case OperationType.OP_COLOCATE_MARK_UNSTABLE: - case OperationType.OP_COLOCATE_MARK_STABLE: { - data = new ColocatePersistInfo(); - ((ColocatePersistInfo) data).readFields(in); - isRead = true; - break; - } case OperationType.OP_COLOCATE_ADD_TABLE_V2: case OperationType.OP_COLOCATE_BACKENDS_PER_BUCKETSEQ_V2: case OperationType.OP_COLOCATE_MARK_UNSTABLE_V2: @@ -638,110 +469,58 @@ public void readFields(DataInput in) throws IOException { isRead = true; break; } - case OperationType.OP_MODIFY_TABLE_COLOCATE: { - data = new TablePropertyInfo(); - ((TablePropertyInfo) data).readFields(in); - isRead = true; - break; - } case OperationType.OP_MODIFY_TABLE_COLOCATE_V2: { data = GsonUtils.GSON.fromJson(Text.readString(in), TablePropertyInfo.class); isRead = true; break; } - case OperationType.OP_HEARTBEAT: { - data = HbPackage.read(in); - isRead = true; - break; - } case OperationType.OP_HEARTBEAT_V2: { data = HbPackage.readV2(in); isRead = true; break; } - case OperationType.OP_ADD_FUNCTION: { - data = Function.read(in); - isRead = true; - break; - } case OperationType.OP_ADD_FUNCTION_V2: { data = GsonUtils.GSON.fromJson(Text.readString(in), Function.class); isRead = true; break; } - case OperationType.OP_DROP_FUNCTION: { - data = FunctionSearchDesc.read(in); - isRead = true; - break; - } case OperationType.OP_DROP_FUNCTION_V2: { data = GsonUtils.GSON.fromJson(Text.readString(in), FunctionSearchDesc.class); isRead = true; break; } - case OperationType.OP_BACKEND_TABLETS_INFO: { - data = BackendTabletsInfo.read(in); - isRead = true; - break; - } case OperationType.OP_BACKEND_TABLETS_INFO_V2: { data = GsonUtils.GSON.fromJson(Text.readString(in), BackendTabletsInfo.class); isRead = true; break; } - case OperationType.OP_CREATE_ROUTINE_LOAD_JOB: { - data = RoutineLoadJob.read(in); - isRead = true; - break; - } case OperationType.OP_CREATE_ROUTINE_LOAD_JOB_V2: { data = GsonUtils.GSON.fromJson(Text.readString(in), RoutineLoadJob.class); isRead = true; break; } - case OperationType.OP_CHANGE_ROUTINE_LOAD_JOB: - case OperationType.OP_REMOVE_ROUTINE_LOAD_JOB: { - data = RoutineLoadOperation.read(in); - isRead = true; - break; - } case OperationType.OP_CHANGE_ROUTINE_LOAD_JOB_V2: { data = GsonUtils.GSON.fromJson(Text.readString(in), RoutineLoadOperation.class); isRead = true; break; } - case OperationType.OP_CREATE_STREAM_LOAD_TASK: { - data = StreamLoadTask.read(in); - isRead = true; - break; - } case OperationType.OP_CREATE_STREAM_LOAD_TASK_V2: { data = GsonUtils.GSON.fromJson(Text.readString(in), StreamLoadTask.class); isRead = true; break; } - case OperationType.OP_CREATE_LOAD_JOB: { - data = com.starrocks.load.loadv2.LoadJob.read(in); - isRead = true; - break; - } case OperationType.OP_CREATE_LOAD_JOB_V2: { data = GsonUtils.GSON.fromJson(Text.readString(in), LoadJob.class); isRead = true; break; } - case OperationType.OP_END_LOAD_JOB: { - data = LoadJobFinalOperation.read(in); - isRead = true; - break; - } case OperationType.OP_END_LOAD_JOB_V2: { data = GsonUtils.GSON.fromJson(Text.readString(in), LoadJobFinalOperation.class); isRead = true; break; } case OperationType.OP_UPDATE_LOAD_JOB: { - data = LoadJobStateUpdateInfo.read(in); + data = LoadJob.LoadJobStateUpdateInfo.read(in); isRead = true; break; } @@ -782,21 +561,11 @@ public void readFields(DataInput in) throws IOException { data = TaskRunPeriodStatusChange.read(in); isRead = true; break; - case OperationType.OP_DROP_TASK_RUNS: - data = DropTaskRunsLog.read(in); - isRead = true; - break; case OperationType.OP_ARCHIVE_TASK_RUNS: { data = ArchiveTaskRunsLog.read(in); isRead = true; break; } - case OperationType.OP_CREATE_SMALL_FILE: - case OperationType.OP_DROP_SMALL_FILE: { - data = SmallFile.read(in); - isRead = true; - break; - } case OperationType.OP_CREATE_SMALL_FILE_V2: case OperationType.OP_DROP_SMALL_FILE_V2: { data = GsonUtils.GSON.fromJson(Text.readString(in), SmallFile.class); @@ -808,21 +577,11 @@ public void readFields(DataInput in) throws IOException { isRead = true; break; } - case OperationType.OP_BATCH_ADD_ROLLUP: { - data = BatchAlterJobPersistInfo.read(in); - isRead = true; - break; - } case OperationType.OP_BATCH_ADD_ROLLUP_V2: { data = GsonUtils.GSON.fromJson(Text.readString(in), BatchAlterJobPersistInfo.class); isRead = true; break; } - case OperationType.OP_MODIFY_DISTRIBUTION_TYPE: { - data = TableInfo.read(in); - isRead = true; - break; - } case OperationType.OP_MODIFY_DISTRIBUTION_TYPE_V2: { data = GsonUtils.GSON.fromJson(Text.readString(in), TableInfo.class); isRead = true; @@ -872,11 +631,6 @@ public void readFields(DataInput in) throws IOException { isRead = true; break; } - case OperationType.OP_ALTER_ROUTINE_LOAD_JOB: { - data = AlterRoutineLoadJobOperationLog.read(in); - isRead = true; - break; - } case OperationType.OP_ALTER_LOAD_JOB: { data = AlterLoadJobOperationLog.read(in); isRead = true; @@ -977,16 +731,6 @@ public void readFields(DataInput in) throws IOException { isRead = true; break; } - case OperationType.OP_GRANT_IMPERSONATE: { - data = ImpersonatePrivInfo.read(in); - isRead = true; - break; - } - case OperationType.OP_REVOKE_IMPERSONATE: { - data = ImpersonatePrivInfo.read(in); - isRead = true; - break; - } case OperationType.OP_CREATE_CATALOG: { data = Catalog.read(in); isRead = true; @@ -1012,16 +756,6 @@ public void readFields(DataInput in) throws IOException { isRead = true; break; } - case OperationType.OP_ADD_UNUSED_SHARD: { // Deprecated - data = ShardInfo.read(in); - isRead = true; - break; - } - case OperationType.OP_DELETE_UNUSED_SHARD: { // Deprecated - data = ShardInfo.read(in); - isRead = true; - break; - } case OperationType.OP_STARMGR: { data = StarMgrJournal.read(in); isRead = true; @@ -1037,21 +771,11 @@ public void readFields(DataInput in) throws IOException { isRead = true; break; } - case OperationType.OP_UPDATE_USER_PROP_V2: { - data = UserPropertyInfo.read(in); - isRead = true; - break; - } case OperationType.OP_UPDATE_USER_PROP_V3: { data = GsonUtils.GSON.fromJson(Text.readString(in), UserPropertyInfo.class); isRead = true; break; } - case OperationType.OP_DROP_USER_V2: { - data = UserIdentity.read(in); - isRead = true; - break; - } case OperationType.OP_DROP_USER_V3: { data = GsonUtils.GSON.fromJson(Text.readString(in), UserIdentity.class); isRead = true; diff --git a/fe/fe-core/src/main/java/com/starrocks/journal/bdbje/Timestamp.java b/fe/fe-core/src/main/java/com/starrocks/journal/bdbje/Timestamp.java index 2514298bdb6cdc..23e9211781a6ee 100644 --- a/fe/fe-core/src/main/java/com/starrocks/journal/bdbje/Timestamp.java +++ b/fe/fe-core/src/main/java/com/starrocks/journal/bdbje/Timestamp.java @@ -18,9 +18,10 @@ package com.starrocks.journal.bdbje; import com.google.gson.annotations.SerializedName; +import com.starrocks.common.io.Text; import com.starrocks.common.io.Writable; +import com.starrocks.persist.gson.GsonUtils; -import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; @@ -39,11 +40,7 @@ public long getTimestamp() { @Override public void write(DataOutput out) throws IOException { - out.writeLong(timestamp); - } - - public void readFields(DataInput in) throws IOException { - timestamp = in.readLong(); + Text.writeString(out, GsonUtils.GSON.toJson(this)); } public String toString() { diff --git a/fe/fe-core/src/main/java/com/starrocks/load/DeleteInfo.java b/fe/fe-core/src/main/java/com/starrocks/load/DeleteInfo.java index fad9fb675a64ca..0949ba1ff19700 100644 --- a/fe/fe-core/src/main/java/com/starrocks/load/DeleteInfo.java +++ b/fe/fe-core/src/main/java/com/starrocks/load/DeleteInfo.java @@ -34,14 +34,13 @@ package com.starrocks.load; -import com.google.common.base.Preconditions; import com.google.common.collect.Lists; import com.google.gson.annotations.SerializedName; import com.starrocks.common.io.Text; import com.starrocks.common.io.Writable; import com.starrocks.persist.ReplicaPersistInfo; +import com.starrocks.persist.gson.GsonUtils; -import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import java.util.ArrayList; @@ -138,54 +137,6 @@ public void updatePartitionVersionInfo(long newVersion) { @Override public void write(DataOutput out) throws IOException { - out.writeLong(dbId); - out.writeLong(tableId); - out.writeLong(partitionId); - out.writeLong(partitionVersion); - out.writeLong(0); // write a version_hash for compatibility - out.writeInt(replicaInfos.size()); - for (ReplicaPersistInfo info : replicaInfos) { - info.write(out); - } - - Text.writeString(out, tableName); - Text.writeString(out, partitionName); - - out.writeInt(deleteConditions.size()); - for (String deleteCond : deleteConditions) { - Text.writeString(out, deleteCond); - } - - out.writeLong(createTimeMs); - - out.writeBoolean(false); - - } - - public void readFields(DataInput in) throws IOException { - dbId = in.readLong(); - tableId = in.readLong(); - partitionId = in.readLong(); - partitionVersion = in.readLong(); - in.readLong(); // read a version_hash for compatibility - int size = in.readInt(); - for (int i = 0; i < size; i++) { - ReplicaPersistInfo info = ReplicaPersistInfo.read(in); - replicaInfos.add(info); - } - - tableName = Text.readString(in); - partitionName = Text.readString(in); - - size = in.readInt(); - for (int i = 0; i < size; i++) { - String deleteCond = Text.readString(in); - deleteConditions.add(deleteCond); - } - - createTimeMs = in.readLong(); - - boolean hasAsyncDeleteJob = in.readBoolean(); - Preconditions.checkState(!hasAsyncDeleteJob, "async delete job is deprecated"); + Text.writeString(out, GsonUtils.GSON.toJson(this)); } } diff --git a/fe/fe-core/src/main/java/com/starrocks/load/ExportJob.java b/fe/fe-core/src/main/java/com/starrocks/load/ExportJob.java index 11fda3a296c472..66456220642b63 100644 --- a/fe/fe-core/src/main/java/com/starrocks/load/ExportJob.java +++ b/fe/fe-core/src/main/java/com/starrocks/load/ExportJob.java @@ -938,98 +938,7 @@ public String toString() { @Override public void write(DataOutput out) throws IOException { - // base infos - out.writeLong(id); - out.writeLong(dbId); - out.writeLong(tableId); - Text.writeString(out, exportPath); - Text.writeString(out, columnSeparator); - Text.writeString(out, rowDelimiter); - out.writeInt(properties.size()); - for (Map.Entry property : properties.entrySet()) { - Text.writeString(out, property.getKey()); - Text.writeString(out, property.getValue()); - } - - // partitions - boolean hasPartition = (partitions != null); - if (hasPartition) { - out.writeBoolean(true); - int partitionSize = partitions.size(); - out.writeInt(partitionSize); - for (String partitionName : partitions) { - Text.writeString(out, partitionName); - } - } else { - out.writeBoolean(false); - } - - // task info - Text.writeString(out, state.name()); - out.writeLong(createTimeMs); - out.writeLong(startTimeMs); - out.writeLong(finishTimeMs); - out.writeInt(progress); - failMsg.write(out); - - if (brokerDesc == null) { - out.writeBoolean(false); - } else { - out.writeBoolean(true); - brokerDesc.write(out); - } - - tableName.write(out); - } - - public void readFields(DataInput in) throws IOException { - isReplayed = true; - id = in.readLong(); - dbId = in.readLong(); - tableId = in.readLong(); - exportPath = Text.readString(in); - columnSeparator = Text.readString(in); - rowDelimiter = Text.readString(in); - - GlobalStateMgr stateMgr = GlobalStateMgr.getCurrentState(); - Database db = null; - if (stateMgr.getLocalMetastore() != null) { - db = stateMgr.getLocalMetastore().getDb(dbId); - } - if (db != null) { - exportTable = GlobalStateMgr.getCurrentState().getLocalMetastore().getTable(db.getId(), tableId); - } - - int count = in.readInt(); - for (int i = 0; i < count; i++) { - String propertyKey = Text.readString(in); - String propertyValue = Text.readString(in); - this.properties.put(propertyKey, propertyValue); - } - - boolean hasPartition = in.readBoolean(); - if (hasPartition) { - partitions = Lists.newArrayList(); - int partitionSize = in.readInt(); - for (int i = 0; i < partitionSize; ++i) { - String partitionName = Text.readString(in); - partitions.add(partitionName); - } - } - - state = JobState.valueOf(Text.readString(in)); - createTimeMs = in.readLong(); - startTimeMs = in.readLong(); - finishTimeMs = in.readLong(); - progress = in.readInt(); - failMsg.readFields(in); - - if (in.readBoolean()) { - brokerDesc = BrokerDesc.read(in); - } - - tableName = new TableName(); - tableName.readFields(in); + Text.writeString(out, GsonUtils.GSON.toJson(this)); } /** @@ -1122,11 +1031,6 @@ public void write(DataOutput out) throws IOException { out.writeLong(jobId); Text.writeString(out, state.name()); } - - public void readFields(DataInput in) throws IOException { - jobId = in.readLong(); - state = JobState.valueOf(Text.readString(in)); - } } public static class ExportUpdateInfo implements Writable { diff --git a/fe/fe-core/src/main/java/com/starrocks/persist/BackendTabletsInfo.java b/fe/fe-core/src/main/java/com/starrocks/persist/BackendTabletsInfo.java index b0c4cc244a34cd..c5828b55112f29 100644 --- a/fe/fe-core/src/main/java/com/starrocks/persist/BackendTabletsInfo.java +++ b/fe/fe-core/src/main/java/com/starrocks/persist/BackendTabletsInfo.java @@ -39,7 +39,6 @@ import com.starrocks.common.Pair; import com.starrocks.common.io.Writable; -import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import java.util.List; @@ -95,12 +94,6 @@ public boolean isEmpty() { return tabletSchemaHash.isEmpty() && replicaPersistInfos.isEmpty(); } - public static BackendTabletsInfo read(DataInput in) throws IOException { - BackendTabletsInfo backendTabletsInfo = new BackendTabletsInfo(); - backendTabletsInfo.readFields(in); - return backendTabletsInfo; - } - @Override public void write(DataOutput out) throws IOException { out.writeLong(backendId); @@ -121,28 +114,4 @@ public void write(DataOutput out) throws IOException { // this is for further extension out.writeBoolean(false); } - - public void readFields(DataInput in) throws IOException { - backendId = in.readLong(); - - int size = in.readInt(); - for (int i = 0; i < size; i++) { - long tabletId = in.readLong(); - int schemaHash = in.readInt(); - tabletSchemaHash.add(Pair.create(tabletId, schemaHash)); - } - - bad = in.readBoolean(); - - if (in.readBoolean()) { - size = in.readInt(); - for (int i = 0; i < size; i++) { - ReplicaPersistInfo replicaPersistInfo = ReplicaPersistInfo.read(in); - replicaPersistInfos.add(replicaPersistInfo); - } - } else { - replicaPersistInfos = Lists.newArrayList(); - } - } - } diff --git a/fe/fe-core/src/main/java/com/starrocks/persist/DatabaseInfo.java b/fe/fe-core/src/main/java/com/starrocks/persist/DatabaseInfo.java index 7ab02e6d9359eb..3a6d627a5e394e 100644 --- a/fe/fe-core/src/main/java/com/starrocks/persist/DatabaseInfo.java +++ b/fe/fe-core/src/main/java/com/starrocks/persist/DatabaseInfo.java @@ -35,12 +35,11 @@ package com.starrocks.persist; import com.google.gson.annotations.SerializedName; -import com.starrocks.cluster.ClusterNamespace; import com.starrocks.common.io.Text; import com.starrocks.common.io.Writable; +import com.starrocks.persist.gson.GsonUtils; import com.starrocks.sql.ast.AlterDatabaseQuotaStmt.QuotaType; -import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; @@ -86,36 +85,9 @@ public long getQuota() { return quota; } - public static DatabaseInfo read(DataInput in) throws IOException { - DatabaseInfo dbInfo = new DatabaseInfo(); - dbInfo.readFields(in); - return dbInfo; - } - @Override public void write(DataOutput out) throws IOException { - // compatible with old version - Text.writeString(out, ClusterNamespace.getFullName(dbName)); - if (newDbName.isEmpty()) { - Text.writeString(out, newDbName); - } else { - Text.writeString(out, ClusterNamespace.getFullName(newDbName)); - } - out.writeLong(quota); - Text.writeString(out, this.clusterName); - // compatible with dbState - Text.writeString(out, "NORMAL"); - Text.writeString(out, this.quotaType.name()); - } - - public void readFields(DataInput in) throws IOException { - this.dbName = ClusterNamespace.getNameFromFullName(Text.readString(in)); - newDbName = ClusterNamespace.getNameFromFullName(Text.readString(in)); - this.quota = in.readLong(); - this.clusterName = Text.readString(in); - // Compatible with dbState - Text.readString(in); - this.quotaType = QuotaType.valueOf(Text.readString(in)); + Text.writeString(out, GsonUtils.GSON.toJson(this)); } public String getClusterName() { diff --git a/fe/fe-core/src/main/java/com/starrocks/persist/EditLog.java b/fe/fe-core/src/main/java/com/starrocks/persist/EditLog.java index a1889b354bbff0..1453f39fd4eba0 100644 --- a/fe/fe-core/src/main/java/com/starrocks/persist/EditLog.java +++ b/fe/fe-core/src/main/java/com/starrocks/persist/EditLog.java @@ -64,12 +64,10 @@ import com.starrocks.journal.JournalInconsistentException; import com.starrocks.journal.JournalTask; import com.starrocks.journal.bdbje.Timestamp; -import com.starrocks.load.DeleteInfo; import com.starrocks.load.DeleteMgr; import com.starrocks.load.ExportFailMsg; import com.starrocks.load.ExportJob; import com.starrocks.load.ExportMgr; -import com.starrocks.load.LoadErrorHub; import com.starrocks.load.MultiDeleteInfo; import com.starrocks.load.loadv2.LoadJob.LoadJobStateUpdateInfo; import com.starrocks.load.loadv2.LoadJobFinalOperation; @@ -82,14 +80,12 @@ import com.starrocks.privilege.RolePrivilegeCollectionV2; import com.starrocks.privilege.UserPrivilegeCollectionV2; import com.starrocks.proto.EncryptionKeyPB; -import com.starrocks.qe.SessionVariable; import com.starrocks.qe.VariableMgr; import com.starrocks.replication.ReplicationJob; import com.starrocks.scheduler.Task; import com.starrocks.scheduler.mv.MVEpoch; import com.starrocks.scheduler.mv.MVMaintenanceJob; import com.starrocks.scheduler.persist.ArchiveTaskRunsLog; -import com.starrocks.scheduler.persist.DropTaskRunsLog; import com.starrocks.scheduler.persist.DropTasksLog; import com.starrocks.scheduler.persist.TaskRunPeriodStatusChange; import com.starrocks.scheduler.persist.TaskRunStatus; @@ -143,9 +139,7 @@ public EditLog(BlockingQueue journalQueue) { public void loadJournal(GlobalStateMgr globalStateMgr, JournalEntity journal) throws JournalInconsistentException { short opCode = journal.getOpCode(); - if (opCode != OperationType.OP_SAVE_NEXTID - && opCode != OperationType.OP_TIMESTAMP - && opCode != OperationType.OP_TIMESTAMP_V2) { + if (opCode != OperationType.OP_SAVE_NEXTID && opCode != OperationType.OP_TIMESTAMP_V2) { LOG.debug("replay journal op code: {}", opCode); } try { @@ -185,9 +179,7 @@ public void loadJournal(GlobalStateMgr globalStateMgr, JournalEntity journal) metastore.replayDropDb(dropDbInfo.getDbName(), dropDbInfo.isForceDrop()); break; } - case OperationType.OP_ALTER_DB: case OperationType.OP_ALTER_DB_V2: { - DatabaseInfo dbInfo = (DatabaseInfo) journal.getData(); globalStateMgr.getLocalMetastore().replayAlterDatabaseQuota(dbInfo); break; @@ -197,13 +189,11 @@ public void loadJournal(GlobalStateMgr globalStateMgr, JournalEntity journal) globalStateMgr.getLocalMetastore().replayEraseDatabase(Long.parseLong(dbId.toString())); break; } - case OperationType.OP_RECOVER_DB: case OperationType.OP_RECOVER_DB_V2: { RecoverInfo info = (RecoverInfo) journal.getData(); globalStateMgr.getLocalMetastore().replayRecoverDatabase(info); break; } - case OperationType.OP_RENAME_DB: case OperationType.OP_RENAME_DB_V2: { DatabaseInfo dbInfo = (DatabaseInfo) journal.getData(); String dbName = dbInfo.getDbName(); @@ -225,7 +215,6 @@ public void loadJournal(GlobalStateMgr globalStateMgr, JournalEntity journal) globalStateMgr.getLocalMetastore().replayCreateTable(info); break; } - case OperationType.OP_DROP_TABLE: case OperationType.OP_DROP_TABLE_V2: { DropInfo info = (DropInfo) journal.getData(); Database db = globalStateMgr.getLocalMetastore().getDb(info.getDbId()); @@ -273,7 +262,6 @@ public void loadJournal(GlobalStateMgr globalStateMgr, JournalEntity journal) globalStateMgr.getLocalMetastore().replayDropPartitions(info); break; } - case OperationType.OP_MODIFY_PARTITION: case OperationType.OP_MODIFY_PARTITION_V2: { ModifyPartitionInfo info = (ModifyPartitionInfo) journal.getData(); LOG.info("Begin to unprotect modify partition. db = " + info.getDbId() @@ -288,11 +276,6 @@ public void loadJournal(GlobalStateMgr globalStateMgr, JournalEntity journal) } break; } - case OperationType.OP_ERASE_TABLE: { - Text tableId = (Text) journal.getData(); - globalStateMgr.getLocalMetastore().replayEraseTable(Long.parseLong(tableId.toString())); - break; - } case OperationType.OP_ERASE_MULTI_TABLES: { MultiEraseTableInfo multiEraseTableInfo = (MultiEraseTableInfo) journal.getData(); globalStateMgr.getLocalMetastore().replayEraseMultiTables(multiEraseTableInfo); @@ -313,19 +296,16 @@ public void loadJournal(GlobalStateMgr globalStateMgr, JournalEntity journal) globalStateMgr.getLocalMetastore().replayErasePartition(Long.parseLong(partitionId.toString())); break; } - case OperationType.OP_RECOVER_TABLE: case OperationType.OP_RECOVER_TABLE_V2: { RecoverInfo info = (RecoverInfo) journal.getData(); globalStateMgr.getLocalMetastore().replayRecoverTable(info); break; } - case OperationType.OP_RECOVER_PARTITION: case OperationType.OP_RECOVER_PARTITION_V2: { RecoverInfo info = (RecoverInfo) journal.getData(); globalStateMgr.getLocalMetastore().replayRecoverPartition(info); break; } - case OperationType.OP_RENAME_TABLE: case OperationType.OP_RENAME_TABLE_V2: { TableInfo info = (TableInfo) journal.getData(); globalStateMgr.getLocalMetastore().replayRenameTable(info); @@ -365,7 +345,6 @@ public void loadJournal(GlobalStateMgr globalStateMgr, JournalEntity journal) globalStateMgr.getAlterJobMgr().alterView(info); break; } - case OperationType.OP_RENAME_PARTITION: case OperationType.OP_RENAME_PARTITION_V2: { TableInfo info = (TableInfo) journal.getData(); globalStateMgr.getLocalMetastore().replayRenamePartition(info); @@ -376,20 +355,17 @@ public void loadJournal(GlobalStateMgr globalStateMgr, JournalEntity journal) globalStateMgr.getLocalMetastore().replayRenameColumn(info); break; } - case OperationType.OP_BACKUP_JOB: case OperationType.OP_BACKUP_JOB_V2: { BackupJob job = (BackupJob) journal.getData(); globalStateMgr.getBackupHandler().replayAddJob(job); break; } - case OperationType.OP_RESTORE_JOB: case OperationType.OP_RESTORE_JOB_V2: { RestoreJob job = (RestoreJob) journal.getData(); job.setGlobalStateMgr(globalStateMgr); globalStateMgr.getBackupHandler().replayAddJob(job); break; } - case OperationType.OP_DROP_ROLLUP: case OperationType.OP_DROP_ROLLUP_V2: { DropInfo info = (DropInfo) journal.getData(); globalStateMgr.getRollupHandler().replayDropRollup(info, globalStateMgr); @@ -410,58 +386,37 @@ public void loadJournal(GlobalStateMgr globalStateMgr, JournalEntity journal) globalStateMgr.getConsistencyChecker().replayFinishConsistencyCheck(info, globalStateMgr); break; } - case OperationType.OP_CLEAR_ROLLUP_INFO: { - // Nothing to do - break; - } - case OperationType.OP_RENAME_ROLLUP: case OperationType.OP_RENAME_ROLLUP_V2: { TableInfo info = (TableInfo) journal.getData(); globalStateMgr.getLocalMetastore().replayRenameRollup(info); break; } - case OperationType.OP_EXPORT_CREATE: case OperationType.OP_EXPORT_CREATE_V2: { ExportJob job = (ExportJob) journal.getData(); ExportMgr exportMgr = globalStateMgr.getExportMgr(); exportMgr.replayCreateExportJob(job); break; } - case OperationType.OP_EXPORT_UPDATE_STATE: - ExportJob.StateTransfer op = (ExportJob.StateTransfer) journal.getData(); - ExportMgr exportMgr = globalStateMgr.getExportMgr(); - exportMgr.replayUpdateJobState(op.getJobId(), op.getState()); - break; case OperationType.OP_EXPORT_UPDATE_INFO_V2: - case OperationType.OP_EXPORT_UPDATE_INFO: ExportJob.ExportUpdateInfo exportUpdateInfo = (ExportJob.ExportUpdateInfo) journal.getData(); globalStateMgr.getExportMgr().replayUpdateJobInfo(exportUpdateInfo); break; - case OperationType.OP_FINISH_DELETE: { - DeleteInfo info = (DeleteInfo) journal.getData(); - DeleteMgr deleteHandler = globalStateMgr.getDeleteMgr(); - deleteHandler.replayDelete(info, globalStateMgr); - break; - } case OperationType.OP_FINISH_MULTI_DELETE: { MultiDeleteInfo info = (MultiDeleteInfo) journal.getData(); DeleteMgr deleteHandler = globalStateMgr.getDeleteMgr(); deleteHandler.replayMultiDelete(info, globalStateMgr); break; } - case OperationType.OP_ADD_REPLICA: case OperationType.OP_ADD_REPLICA_V2: { ReplicaPersistInfo info = (ReplicaPersistInfo) journal.getData(); globalStateMgr.getLocalMetastore().replayAddReplica(info); break; } - case OperationType.OP_UPDATE_REPLICA: case OperationType.OP_UPDATE_REPLICA_V2: { ReplicaPersistInfo info = (ReplicaPersistInfo) journal.getData(); globalStateMgr.getLocalMetastore().replayUpdateReplica(info); break; } - case OperationType.OP_DELETE_REPLICA: case OperationType.OP_DELETE_REPLICA_V2: { ReplicaPersistInfo info = (ReplicaPersistInfo) journal.getData(); globalStateMgr.getLocalMetastore().replayDeleteReplica(info); @@ -483,33 +438,27 @@ public void loadJournal(GlobalStateMgr globalStateMgr, JournalEntity journal) .replayDropComputeNode(dropComputeNodeLog.getComputeNodeId()); break; } - case OperationType.OP_ADD_BACKEND: case OperationType.OP_ADD_BACKEND_V2: { Backend be = (Backend) journal.getData(); GlobalStateMgr.getCurrentState().getNodeMgr().getClusterInfo().replayAddBackend(be); break; } - case OperationType.OP_DROP_BACKEND: case OperationType.OP_DROP_BACKEND_V2: { Backend be = (Backend) journal.getData(); GlobalStateMgr.getCurrentState().getNodeMgr().getClusterInfo().replayDropBackend(be); break; } - case OperationType.OP_BACKEND_STATE_CHANGE: case OperationType.OP_BACKEND_STATE_CHANGE_V2: { Backend be = (Backend) journal.getData(); GlobalStateMgr.getCurrentState().getNodeMgr().getClusterInfo().updateInMemoryStateBackend(be); break; } - case OperationType.OP_ADD_FIRST_FRONTEND: case OperationType.OP_ADD_FIRST_FRONTEND_V2: - case OperationType.OP_ADD_FRONTEND: case OperationType.OP_ADD_FRONTEND_V2: { Frontend fe = (Frontend) journal.getData(); globalStateMgr.getNodeMgr().replayAddFrontend(fe); break; } - case OperationType.OP_REMOVE_FRONTEND: case OperationType.OP_REMOVE_FRONTEND_V2: { Frontend fe = (Frontend) journal.getData(); globalStateMgr.getNodeMgr().replayDropFrontend(fe); @@ -518,28 +467,21 @@ public void loadJournal(GlobalStateMgr globalStateMgr, JournalEntity journal) } break; } - case OperationType.OP_UPDATE_FRONTEND: case OperationType.OP_UPDATE_FRONTEND_V2: { Frontend fe = (Frontend) journal.getData(); globalStateMgr.getNodeMgr().replayUpdateFrontend(fe); break; } - case OperationType.OP_TIMESTAMP: case OperationType.OP_TIMESTAMP_V2: { Timestamp stamp = (Timestamp) journal.getData(); globalStateMgr.setSynchronizedTime(stamp.getTimestamp()); break; } - case OperationType.OP_LEADER_INFO_CHANGE: case OperationType.OP_LEADER_INFO_CHANGE_V2: { LeaderInfo info = (LeaderInfo) journal.getData(); globalStateMgr.setLeader(info); break; } - //compatible with old community meta, newly added log using OP_META_VERSION_V2 - case OperationType.OP_META_VERSION: { - break; - } case OperationType.OP_META_VERSION_V2: { MetaVersion metaVersion = (MetaVersion) journal.getData(); if (!MetaVersion.isCompatible(metaVersion.getStarRocksVersion(), FeConstants.STARROCKS_META_VERSION)) { @@ -550,17 +492,11 @@ public void loadJournal(GlobalStateMgr globalStateMgr, JournalEntity journal) MetaContext.get().setStarRocksMetaVersion(metaVersion.getStarRocksVersion()); break; } - case OperationType.OP_CREATE_CLUSTER: { - // ignore - break; - } - case OperationType.OP_ADD_BROKER: case OperationType.OP_ADD_BROKER_V2: { final BrokerMgr.ModifyBrokerInfo param = (BrokerMgr.ModifyBrokerInfo) journal.getData(); globalStateMgr.getBrokerMgr().replayAddBrokers(param.brokerName, param.brokerAddresses); break; } - case OperationType.OP_DROP_BROKER: case OperationType.OP_DROP_BROKER_V2: { final BrokerMgr.ModifyBrokerInfo param = (BrokerMgr.ModifyBrokerInfo) journal.getData(); globalStateMgr.getBrokerMgr().replayDropBrokers(param.brokerName, param.brokerAddresses); @@ -571,16 +507,6 @@ public void loadJournal(GlobalStateMgr globalStateMgr, JournalEntity journal) globalStateMgr.getBrokerMgr().replayDropAllBroker(param); break; } - case OperationType.OP_SET_LOAD_ERROR_HUB: { - final LoadErrorHub.Param param = (LoadErrorHub.Param) journal.getData(); - globalStateMgr.getLoadInstance().setLoadErrorHubInfo(param); - break; - } - case OperationType.OP_UPDATE_CLUSTER_AND_BACKENDS: { - final BackendIdsUpdateInfo info = (BackendIdsUpdateInfo) journal.getData(); - globalStateMgr.replayUpdateClusterAndBackends(info); - break; - } case OperationType.OP_UPSERT_TRANSACTION_STATE_V2: { final TransactionState state = (TransactionState) journal.getData(); GlobalStateMgr.getCurrentState().getGlobalTransactionMgr().replayUpsertTransactionState(state); @@ -593,7 +519,6 @@ public void loadJournal(GlobalStateMgr globalStateMgr, JournalEntity journal) LOG.debug("opcode: {}, txn ids: {}", opCode, stateBatch.getTxnIds()); break; } - case OperationType.OP_CREATE_REPOSITORY: case OperationType.OP_CREATE_REPOSITORY_V2: { Repository repository = (Repository) journal.getData(); globalStateMgr.getBackupHandler().getRepoMgr().addAndInitRepoIfNotExist(repository, true); @@ -609,48 +534,36 @@ public void loadJournal(GlobalStateMgr globalStateMgr, JournalEntity journal) globalStateMgr.getLocalMetastore().replayTruncateTable(info); break; } - case OperationType.OP_COLOCATE_ADD_TABLE: case OperationType.OP_COLOCATE_ADD_TABLE_V2: { final ColocatePersistInfo info = (ColocatePersistInfo) journal.getData(); globalStateMgr.getColocateTableIndex().replayAddTableToGroup(info); break; } - case OperationType.OP_COLOCATE_REMOVE_TABLE: { - final ColocatePersistInfo info = (ColocatePersistInfo) journal.getData(); - globalStateMgr.getColocateTableIndex().replayRemoveTable(info); - break; - } - case OperationType.OP_COLOCATE_BACKENDS_PER_BUCKETSEQ: case OperationType.OP_COLOCATE_BACKENDS_PER_BUCKETSEQ_V2: { final ColocatePersistInfo info = (ColocatePersistInfo) journal.getData(); globalStateMgr.getColocateTableIndex().replayAddBackendsPerBucketSeq(info); break; } - case OperationType.OP_COLOCATE_MARK_UNSTABLE: case OperationType.OP_COLOCATE_MARK_UNSTABLE_V2: { final ColocatePersistInfo info = (ColocatePersistInfo) journal.getData(); globalStateMgr.getColocateTableIndex().replayMarkGroupUnstable(info); break; } - case OperationType.OP_COLOCATE_MARK_STABLE: case OperationType.OP_COLOCATE_MARK_STABLE_V2: { final ColocatePersistInfo info = (ColocatePersistInfo) journal.getData(); globalStateMgr.getColocateTableIndex().replayMarkGroupStable(info); break; } - case OperationType.OP_MODIFY_TABLE_COLOCATE: case OperationType.OP_MODIFY_TABLE_COLOCATE_V2: { final TablePropertyInfo info = (TablePropertyInfo) journal.getData(); globalStateMgr.getColocateTableIndex().replayModifyTableColocate(info); break; } - case OperationType.OP_HEARTBEAT_V2: - case OperationType.OP_HEARTBEAT: { + case OperationType.OP_HEARTBEAT_V2: { final HbPackage hbPackage = (HbPackage) journal.getData(); GlobalStateMgr.getCurrentState().getHeartbeatMgr().replayHearbeat(hbPackage); break; } - case OperationType.OP_ADD_FUNCTION: case OperationType.OP_ADD_FUNCTION_V2: { final Function function = (Function) journal.getData(); if (function.getFunctionName().isGlobalFunction()) { @@ -660,7 +573,6 @@ public void loadJournal(GlobalStateMgr globalStateMgr, JournalEntity journal) } break; } - case OperationType.OP_DROP_FUNCTION: case OperationType.OP_DROP_FUNCTION_V2: { FunctionSearchDesc function = (FunctionSearchDesc) journal.getData(); if (function.getName().isGlobalFunction()) { @@ -670,44 +582,33 @@ public void loadJournal(GlobalStateMgr globalStateMgr, JournalEntity journal) } break; } - case OperationType.OP_BACKEND_TABLETS_INFO: case OperationType.OP_BACKEND_TABLETS_INFO_V2: { BackendTabletsInfo backendTabletsInfo = (BackendTabletsInfo) journal.getData(); GlobalStateMgr.getCurrentState().getLocalMetastore().replayBackendTabletsInfo(backendTabletsInfo); break; } - case OperationType.OP_CREATE_ROUTINE_LOAD_JOB_V2: - case OperationType.OP_CREATE_ROUTINE_LOAD_JOB: { + case OperationType.OP_CREATE_ROUTINE_LOAD_JOB_V2: { RoutineLoadJob routineLoadJob = (RoutineLoadJob) journal.getData(); GlobalStateMgr.getCurrentState().getRoutineLoadMgr().replayCreateRoutineLoadJob(routineLoadJob); break; } - case OperationType.OP_CHANGE_ROUTINE_LOAD_JOB_V2: - case OperationType.OP_CHANGE_ROUTINE_LOAD_JOB: { + case OperationType.OP_CHANGE_ROUTINE_LOAD_JOB_V2: { RoutineLoadOperation operation = (RoutineLoadOperation) journal.getData(); GlobalStateMgr.getCurrentState().getRoutineLoadMgr().replayChangeRoutineLoadJob(operation); break; } - case OperationType.OP_REMOVE_ROUTINE_LOAD_JOB: { - RoutineLoadOperation operation = (RoutineLoadOperation) journal.getData(); - globalStateMgr.getRoutineLoadMgr().replayRemoveOldRoutineLoad(operation); - break; - } - case OperationType.OP_CREATE_STREAM_LOAD_TASK: case OperationType.OP_CREATE_STREAM_LOAD_TASK_V2: { StreamLoadTask streamLoadTask = (StreamLoadTask) journal.getData(); globalStateMgr.getStreamLoadMgr().replayCreateLoadTask(streamLoadTask); break; } - case OperationType.OP_CREATE_LOAD_JOB_V2: - case OperationType.OP_CREATE_LOAD_JOB: { + case OperationType.OP_CREATE_LOAD_JOB_V2: { com.starrocks.load.loadv2.LoadJob loadJob = (com.starrocks.load.loadv2.LoadJob) journal.getData(); globalStateMgr.getLoadMgr().replayCreateLoadJob(loadJob); break; } - case OperationType.OP_END_LOAD_JOB_V2: - case OperationType.OP_END_LOAD_JOB: { + case OperationType.OP_END_LOAD_JOB_V2: { LoadJobFinalOperation operation = (LoadJobFinalOperation) journal.getData(); globalStateMgr.getLoadMgr().replayEndLoadJob(operation); break; @@ -758,11 +659,6 @@ public void loadJournal(GlobalStateMgr globalStateMgr, JournalEntity journal) globalStateMgr.getTaskManager().replayUpdateTaskRun(statusChange); break; } - case OperationType.OP_DROP_TASK_RUNS: { - DropTaskRunsLog dropTaskRunsLog = (DropTaskRunsLog) journal.getData(); - globalStateMgr.getTaskManager().replayDropTaskRuns(dropTaskRunsLog.getQueryIdList()); - break; - } case OperationType.OP_UPDATE_TASK_RUN_STATE: { TaskRunPeriodStatusChange taskRunPeriodStatusChange = (TaskRunPeriodStatusChange) journal.getData(); globalStateMgr.getTaskManager().replayAlterRunningTaskRunProgress( @@ -774,13 +670,11 @@ public void loadJournal(GlobalStateMgr globalStateMgr, JournalEntity journal) globalStateMgr.getTaskManager().replayArchiveTaskRuns(log); break; } - case OperationType.OP_CREATE_SMALL_FILE: case OperationType.OP_CREATE_SMALL_FILE_V2: { SmallFile smallFile = (SmallFile) journal.getData(); globalStateMgr.getSmallFileMgr().replayCreateFile(smallFile); break; } - case OperationType.OP_DROP_SMALL_FILE: case OperationType.OP_DROP_SMALL_FILE_V2: { SmallFile smallFile = (SmallFile) journal.getData(); globalStateMgr.getSmallFileMgr().replayRemoveFile(smallFile); @@ -801,7 +695,6 @@ public void loadJournal(GlobalStateMgr globalStateMgr, JournalEntity journal) } break; } - case OperationType.OP_BATCH_ADD_ROLLUP: case OperationType.OP_BATCH_ADD_ROLLUP_V2: { BatchAlterJobPersistInfo batchAlterJobV2 = (BatchAlterJobPersistInfo) journal.getData(); for (AlterJobV2 alterJobV2 : batchAlterJobV2.getAlterJobV2List()) { @@ -809,7 +702,6 @@ public void loadJournal(GlobalStateMgr globalStateMgr, JournalEntity journal) } break; } - case OperationType.OP_MODIFY_DISTRIBUTION_TYPE: case OperationType.OP_MODIFY_DISTRIBUTION_TYPE_V2: { TableInfo tableInfo = (TableInfo) journal.getData(); globalStateMgr.getLocalMetastore().replayConvertDistributionType(tableInfo); @@ -882,11 +774,6 @@ public void loadJournal(GlobalStateMgr globalStateMgr, JournalEntity journal) } break; } - case OperationType.OP_ALTER_ROUTINE_LOAD_JOB: { - AlterRoutineLoadJobOperationLog log = (AlterRoutineLoadJobOperationLog) journal.getData(); - globalStateMgr.getRoutineLoadMgr().replayAlterRoutineLoadJob(log); - break; - } case OperationType.OP_ALTER_LOAD_JOB: { AlterLoadJobOperationLog log = (AlterLoadJobOperationLog) journal.getData(); globalStateMgr.getLoadMgr().replayAlterLoadJob(log); @@ -1045,10 +932,6 @@ public void loadJournal(GlobalStateMgr globalStateMgr, JournalEntity journal) globalStateMgr.getInsertOverwriteJobMgr().replayInsertOverwriteStateChange(stateChangeInfo); break; } - case OperationType.OP_ADD_UNUSED_SHARD: - case OperationType.OP_DELETE_UNUSED_SHARD: - // Deprecated: Nothing to do - break; case OperationType.OP_STARMGR: { StarMgrJournal j = (StarMgrJournal) journal.getData(); StarMgrServer.getCurrentState().getStarMgr().replay(j.getJournal()); @@ -1080,13 +963,11 @@ public void loadJournal(GlobalStateMgr globalStateMgr, JournalEntity journal) info.getUserIdentity(), info.getAuthenticationInfo(), info.getProperties()); break; } - case OperationType.OP_UPDATE_USER_PROP_V2: case OperationType.OP_UPDATE_USER_PROP_V3: { UserPropertyInfo info = (UserPropertyInfo) journal.getData(); globalStateMgr.getAuthenticationMgr().replayUpdateUserProperty(info); break; } - case OperationType.OP_DROP_USER_V2: case OperationType.OP_DROP_USER_V3: { UserIdentity userIdentity = (UserIdentity) journal.getData(); globalStateMgr.getAuthenticationMgr().replayDropUser(userIdentity); @@ -1538,10 +1419,6 @@ public void logPartitionRename(TableInfo tableInfo) { logJsonObject(OperationType.OP_RENAME_PARTITION_V2, tableInfo); } - public void logGlobalVariable(SessionVariable variable) { - logEdit(OperationType.OP_GLOBAL_VARIABLE, variable); - } - public void logAddBroker(BrokerMgr.ModifyBrokerInfo info) { logJsonObject(OperationType.OP_ADD_BROKER_V2, info); } @@ -1554,10 +1431,6 @@ public void logDropAllBroker(String brokerName) { logEdit(OperationType.OP_DROP_ALL_BROKER, new Text(brokerName)); } - public void logSetLoadErrorHub(LoadErrorHub.Param param) { - logEdit(OperationType.OP_SET_LOAD_ERROR_HUB, param); - } - public void logExportCreate(ExportJob job) { logJsonObject(OperationType.OP_EXPORT_CREATE_V2, job); } diff --git a/fe/fe-core/src/main/java/com/starrocks/persist/ModifyPartitionInfo.java b/fe/fe-core/src/main/java/com/starrocks/persist/ModifyPartitionInfo.java index ccb8584853ce24..39259106161a16 100644 --- a/fe/fe-core/src/main/java/com/starrocks/persist/ModifyPartitionInfo.java +++ b/fe/fe-core/src/main/java/com/starrocks/persist/ModifyPartitionInfo.java @@ -37,9 +37,10 @@ import com.google.common.base.Objects; import com.google.gson.annotations.SerializedName; import com.starrocks.catalog.DataProperty; +import com.starrocks.common.io.Text; import com.starrocks.common.io.Writable; +import com.starrocks.persist.gson.GsonUtils; -import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; @@ -97,12 +98,6 @@ public boolean isInMemory() { return isInMemory; } - public static ModifyPartitionInfo read(DataInput in) throws IOException { - ModifyPartitionInfo info = new ModifyPartitionInfo(); - info.readFields(in); - return info; - } - @Override public int hashCode() { return Objects.hashCode(dbId, tableId); @@ -124,35 +119,6 @@ public boolean equals(Object other) { @Override public void write(DataOutput out) throws IOException { - out.writeLong(dbId); - out.writeLong(tableId); - out.writeLong(partitionId); - - if (dataProperty == null) { - out.writeBoolean(false); - } else { - out.writeBoolean(true); - dataProperty.write(out); - } - - out.writeShort(replicationNum); - out.writeBoolean(isInMemory); - } - - public void readFields(DataInput in) throws IOException { - dbId = in.readLong(); - tableId = in.readLong(); - partitionId = in.readLong(); - - boolean hasDataProperty = in.readBoolean(); - if (hasDataProperty) { - dataProperty = DataProperty.read(in); - } else { - dataProperty = null; - } - - replicationNum = in.readShort(); - isInMemory = in.readBoolean(); + Text.writeString(out, GsonUtils.GSON.toJson(this)); } - } diff --git a/fe/fe-core/src/main/java/com/starrocks/persist/OperationType.java b/fe/fe-core/src/main/java/com/starrocks/persist/OperationType.java index 2a3a8fc81a8145..83d4a896386964 100644 --- a/fe/fe-core/src/main/java/com/starrocks/persist/OperationType.java +++ b/fe/fe-core/src/main/java/com/starrocks/persist/OperationType.java @@ -51,74 +51,20 @@ public class OperationType { public static final short OP_SAVE_NEXTID = 0; - @Deprecated - //Added OP_CREATE_DB_V2 in version 3.1, can be removed in version 3.2 - public static final short OP_CREATE_DB = 1; - @IgnorableOnReplayFailed public static final short OP_DROP_DB = 2; - @Deprecated - @IgnorableOnReplayFailed - public static final short OP_ALTER_DB = 3; - @IgnorableOnReplayFailed public static final short OP_ERASE_DB = 4; - @Deprecated - public static final short OP_RECOVER_DB = 5; - - @Deprecated - @IgnorableOnReplayFailed - public static final short OP_RENAME_DB = 6; - - // 10~19 110~119 210~219 ... - - @Deprecated - //Added OP_CREATE_TABLE_V2 in version 3.1, can be removed in version 3.2 - public static final short OP_CREATE_TABLE = 10; - - @Deprecated - @IgnorableOnReplayFailed - public static final short OP_DROP_TABLE = 11; - - @Deprecated - public static final short OP_ADD_PARTITION = 12; - @IgnorableOnReplayFailed public static final short OP_DROP_PARTITION = 13; - @Deprecated - @IgnorableOnReplayFailed - public static final short OP_MODIFY_PARTITION = 14; - - @Deprecated - @IgnorableOnReplayFailed - public static final short OP_ERASE_TABLE = 15; - @IgnorableOnReplayFailed public static final short OP_ERASE_PARTITION = 16; - @Deprecated - public static final short OP_RECOVER_TABLE = 17; - - @Deprecated - public static final short OP_RECOVER_PARTITION = 18; - - @Deprecated - @IgnorableOnReplayFailed - public static final short OP_RENAME_TABLE = 19; - - @Deprecated - @IgnorableOnReplayFailed - public static final short OP_RENAME_PARTITION = 110; - - @Deprecated @IgnorableOnReplayFailed - public static final short OP_BACKUP_JOB = 116; - - @Deprecated - public static final short OP_RESTORE_JOB = 117; + public static final short OP_FINISH_CONSISTENCY_CHECK = 29; public static final short OP_TRUNCATE_TABLE = 118; @@ -130,245 +76,28 @@ public class OperationType { @IgnorableOnReplayFailed public static final short OP_BATCH_MODIFY_PARTITION = 211; - // 20~29 120~129 220~229 ... - @Deprecated - public static final short OP_START_ROLLUP = 20; - - @Deprecated - public static final short OP_FINISH_ROLLUP = 21; - - @Deprecated - public static final short OP_CANCEL_ROLLUP = 23; - - @Deprecated - @IgnorableOnReplayFailed - public static final short OP_DROP_ROLLUP = 24; - - @Deprecated - public static final short OP_START_SCHEMA_CHANGE = 25; - - @Deprecated - public static final short OP_FINISH_SCHEMA_CHANGE = 26; - - @Deprecated - public static final short OP_CANCEL_SCHEMA_CHANGE = 27; - - @Deprecated - @IgnorableOnReplayFailed - public static final short OP_CLEAR_ROLLUP_INFO = 28; - - @Deprecated - @IgnorableOnReplayFailed - public static final short OP_FINISH_CONSISTENCY_CHECK = 29; - - @Deprecated - @IgnorableOnReplayFailed - public static final short OP_RENAME_ROLLUP = 120; - public static final short OP_ALTER_JOB_V2 = 121; - @Deprecated - @IgnorableOnReplayFailed - public static final short OP_MODIFY_DISTRIBUTION_TYPE = 122; - - @Deprecated - @IgnorableOnReplayFailed - public static final short OP_BATCH_ADD_ROLLUP = 123; - @IgnorableOnReplayFailed public static final short OP_BATCH_DROP_ROLLUP = 124; @IgnorableOnReplayFailed public static final short OP_REMOVE_ALTER_JOB_V2 = 125; - // 30~39 130~139 230~239 ... - // load job for only hadoop load - @Deprecated - @IgnorableOnReplayFailed - public static final short OP_EXPORT_CREATE = 36; - - @Deprecated - @IgnorableOnReplayFailed - public static final short OP_EXPORT_UPDATE_STATE = 37; - - @Deprecated - @IgnorableOnReplayFailed - public static final short OP_EXPORT_UPDATE_INFO = 38; - - @Deprecated - public static final short OP_FINISH_SYNC_DELETE = 40; - - @Deprecated - public static final short OP_FINISH_DELETE = 41; - @Deprecated public static final short OP_ADD_REPLICA = 42; - @Deprecated - @IgnorableOnReplayFailed - public static final short OP_DELETE_REPLICA = 43; - - @Deprecated - public static final short OP_FINISH_ASYNC_DELETE = 44; - - @Deprecated - public static final short OP_UPDATE_REPLICA = 45; - - @Deprecated - public static final short OP_BACKEND_TABLETS_INFO = 46; - public static final short OP_SET_REPLICA_STATUS = 47; - @Deprecated - public static final short OP_ADD_BACKEND = 50; - - @Deprecated - @IgnorableOnReplayFailed - public static final short OP_DROP_BACKEND = 51; - - @Deprecated - @IgnorableOnReplayFailed - public static final short OP_BACKEND_STATE_CHANGE = 52; - - @Deprecated - public static final short OP_START_DECOMMISSION_BACKEND = 53; - - @Deprecated - public static final short OP_FINISH_DECOMMISSION_BACKEND = 54; - - @Deprecated - public static final short OP_ADD_FRONTEND = 55; - - @Deprecated - public static final short OP_ADD_FIRST_FRONTEND = 56; - - @Deprecated - @IgnorableOnReplayFailed - public static final short OP_REMOVE_FRONTEND = 57; - - @Deprecated - @IgnorableOnReplayFailed - public static final short OP_SET_LOAD_ERROR_HUB = 58; - - @Deprecated - @IgnorableOnReplayFailed - public static final short OP_HEARTBEAT = 59; - - @Deprecated - public static final short OP_CREATE_USER = 62; - - @Deprecated - @IgnorableOnReplayFailed - public static final short OP_NEW_DROP_USER = 63; - - @Deprecated - @IgnorableOnReplayFailed - public static final short OP_GRANT_PRIV = 64; - - @Deprecated - @IgnorableOnReplayFailed - public static final short OP_REVOKE_PRIV = 65; - - @Deprecated - @IgnorableOnReplayFailed - public static final short OP_SET_PASSWORD = 66; - - @Deprecated - @IgnorableOnReplayFailed - public static final short OP_CREATE_ROLE = 67; - - @Deprecated - @IgnorableOnReplayFailed - public static final short OP_DROP_ROLE = 68; - - @Deprecated - @IgnorableOnReplayFailed - public static final short OP_UPDATE_USER_PROPERTY = 69; - - @Deprecated - @IgnorableOnReplayFailed - public static final short OP_TIMESTAMP = 70; - - @Deprecated - public static final short OP_LEADER_INFO_CHANGE = 71; - @Deprecated - - public static final short OP_META_VERSION = 72; - - @Deprecated - // replaced by OP_GLOBAL_VARIABLE_V2 - @IgnorableOnReplayFailed - public static final short OP_GLOBAL_VARIABLE = 73; - - @Deprecated - public static final short OP_CREATE_CLUSTER = 74; - @IgnorableOnReplayFailed public static final short OP_GLOBAL_VARIABLE_V2 = 84; - @Deprecated - @IgnorableOnReplayFailed - public static final short OP_ADD_BROKER = 85; - - @Deprecated - @IgnorableOnReplayFailed - public static final short OP_DROP_BROKER = 86; - @IgnorableOnReplayFailed public static final short OP_DROP_ALL_BROKER = 87; - @Deprecated - public static final short OP_UPDATE_CLUSTER_AND_BACKENDS = 88; - - @Deprecated - @IgnorableOnReplayFailed - public static final short OP_CREATE_REPOSITORY = 89; - @IgnorableOnReplayFailed public static final short OP_DROP_REPOSITORY = 90; - //colocate table - @Deprecated - @IgnorableOnReplayFailed - public static final short OP_COLOCATE_ADD_TABLE = 94; - - @Deprecated - @IgnorableOnReplayFailed - public static final short OP_COLOCATE_REMOVE_TABLE = 95; - - @Deprecated - @IgnorableOnReplayFailed - public static final short OP_COLOCATE_BACKENDS_PER_BUCKETSEQ = 96; - - @Deprecated - @IgnorableOnReplayFailed - public static final short OP_COLOCATE_MARK_UNSTABLE = 97; - - @Deprecated - @IgnorableOnReplayFailed - public static final short OP_COLOCATE_MARK_STABLE = 98; - - @Deprecated - @IgnorableOnReplayFailed - public static final short OP_MODIFY_TABLE_COLOCATE = 99; - - //real time load 100 -108 - @Deprecated - public static final short OP_UPSERT_TRANSACTION_STATE = 100; - - @Deprecated - @IgnorableOnReplayFailed - public static final short OP_DELETE_TRANSACTION_STATE = 101; - - @Deprecated - public static final short OP_FINISHING_ROLLUP = 102; - - @Deprecated - public static final short OP_FINISHING_SCHEMA_CHANGE = 103; - - @Deprecated - public static final short OP_SAVE_TRANSACTION_ID = 104; - public static final short OP_SAVE_AUTO_INCREMENT_ID = 105; @IgnorableOnReplayFailed @@ -377,56 +106,13 @@ public class OperationType { // light schema change for add and drop columns public static final short OP_MODIFY_TABLE_ADD_OR_DROP_COLUMNS = 107; - @Deprecated @IgnorableOnReplayFailed public static final short OP_ALTER_ROUTINE_LOAD_JOB = 111; - // UDF 130-140 - @Deprecated - @IgnorableOnReplayFailed - public static final short OP_ADD_FUNCTION = 130; - - @Deprecated - @IgnorableOnReplayFailed - public static final short OP_DROP_FUNCTION = 131; - - // routine load 200 - @Deprecated - @IgnorableOnReplayFailed - public static final short OP_CREATE_ROUTINE_LOAD_JOB = 200; - - @Deprecated - @IgnorableOnReplayFailed - public static final short OP_CHANGE_ROUTINE_LOAD_JOB = 201; - - @Deprecated - @IgnorableOnReplayFailed - public static final short OP_REMOVE_ROUTINE_LOAD_JOB = 202; - - // load job v2 for broker load 230~250 - @Deprecated - @IgnorableOnReplayFailed - public static final short OP_CREATE_LOAD_JOB = 230; - - // this finish op include finished and cancelled - @Deprecated - @IgnorableOnReplayFailed - public static final short OP_END_LOAD_JOB = 231; - // update job info, used by spark load - @Deprecated @IgnorableOnReplayFailed public static final short OP_UPDATE_LOAD_JOB = 232; - // small files 251~260 - @Deprecated - @IgnorableOnReplayFailed - public static final short OP_CREATE_SMALL_FILE = 251; - - @Deprecated - @IgnorableOnReplayFailed - public static final short OP_DROP_SMALL_FILE = 252; - // dynamic partition 261~265 @IgnorableOnReplayFailed public static final short OP_DYNAMIC_PARTITION = 261; @@ -464,9 +150,6 @@ public class OperationType { @IgnorableOnReplayFailed public static final short OP_SWAP_TABLE = 10001; - @Deprecated - public static final short OP_ADD_PARTITIONS = 10002; - @IgnorableOnReplayFailed public static final short OP_FINISH_MULTI_DELETE = 10003; @@ -533,23 +216,6 @@ public class OperationType { @IgnorableOnReplayFailed public static final short OP_DROP_CATALOG = 10061; - // grant & revoke impersonate - @Deprecated - @IgnorableOnReplayFailed - public static final short OP_GRANT_IMPERSONATE = 10062; - - @Deprecated - @IgnorableOnReplayFailed - public static final short OP_REVOKE_IMPERSONATE = 10063; - - @Deprecated - @IgnorableOnReplayFailed - public static final short OP_GRANT_ROLE = 10064; - - @Deprecated - @IgnorableOnReplayFailed - public static final short OP_REVOKE_ROLE = 10065; - // task 10071 ~ 10090 @IgnorableOnReplayFailed public static final short OP_CREATE_TASK = 10071; @@ -563,10 +229,6 @@ public class OperationType { @IgnorableOnReplayFailed public static final short OP_UPDATE_TASK_RUN = 10082; - @Deprecated - @IgnorableOnReplayFailed - public static final short OP_DROP_TASK_RUNS = 10083; - @IgnorableOnReplayFailed public static final short OP_UPDATE_TASK_RUN_STATE = 10084; @@ -586,23 +248,14 @@ public class OperationType { @IgnorableOnReplayFailed public static final short OP_ALTER_MATERIALIZED_VIEW_PROPERTIES = 10093; - @Deprecated - @IgnorableOnReplayFailed - public static final short OP_CREATE_MATERIALIZED_VIEW = 10094; - public static final short OP_CREATE_INSERT_OVERWRITE = 10095; public static final short OP_INSERT_OVERWRITE_STATE_CHANGE = 10096; @IgnorableOnReplayFailed public static final short OP_ALTER_MATERIALIZED_VIEW_STATUS = 10097; - public static final short OP_ALTER_MATERIALIZED_VIEW_BASE_TABLE_INFOS = 10098; - - // manage system node info 10101 ~ 10120 - @Deprecated - public static final short OP_UPDATE_FRONTEND = 10101; - // manage compute node 10201 ~ 10220 + public static final short OP_ALTER_MATERIALIZED_VIEW_BASE_TABLE_INFOS = 10098; @IgnorableOnReplayFailed public static final short OP_ADD_COMPUTE_NODE = 10201; @@ -610,12 +263,6 @@ public class OperationType { @IgnorableOnReplayFailed public static final short OP_DROP_COMPUTE_NODE = 10202; - // shard operate 10221 ~ 10240. Deprecated - @Deprecated - public static final short OP_ADD_UNUSED_SHARD = 10221; - @Deprecated - public static final short OP_DELETE_UNUSED_SHARD = 10222; - // new operator for partition 10241 ~ 10260 public static final short OP_ADD_PARTITION_V2 = 10241; public static final short OP_ADD_PARTITIONS_V2 = 10242; @@ -637,9 +284,6 @@ public class OperationType { @IgnorableOnReplayFailed public static final short OP_ALTER_USER_V2 = 10263; - @Deprecated - public static final short OP_DROP_USER_V2 = 10264; - @IgnorableOnReplayFailed public static final short OP_UPDATE_ROLE_PRIVILEGE_V2 = 10265; @@ -648,21 +292,12 @@ public class OperationType { public static final short OP_AUTH_UPGRADE_V2 = 10267; - @Deprecated - @IgnorableOnReplayFailed - public static final short OP_UPDATE_USER_PROP_V2 = 10268; - @IgnorableOnReplayFailed public static final short OP_CREATE_SECURITY_INTEGRATION = 10269; // integrate with starmgr public static final short OP_STARMGR = 11000; - // stream load - @Deprecated - @IgnorableOnReplayFailed - public static final short OP_CREATE_STREAM_LOAD_TASK = 11020; - // MaterializedView Maintenance @IgnorableOnReplayFailed diff --git a/fe/fe-core/src/main/java/com/starrocks/persist/RecoverInfo.java b/fe/fe-core/src/main/java/com/starrocks/persist/RecoverInfo.java index 9779054817c27b..8e71e38884218e 100644 --- a/fe/fe-core/src/main/java/com/starrocks/persist/RecoverInfo.java +++ b/fe/fe-core/src/main/java/com/starrocks/persist/RecoverInfo.java @@ -18,9 +18,10 @@ package com.starrocks.persist; import com.google.gson.annotations.SerializedName; +import com.starrocks.common.io.Text; import com.starrocks.common.io.Writable; +import com.starrocks.persist.gson.GsonUtils; -import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; @@ -56,15 +57,6 @@ public long getPartitionId() { @Override public void write(DataOutput out) throws IOException { - out.writeLong(dbId); - out.writeLong(tableId); - out.writeLong(partitionId); + Text.writeString(out, GsonUtils.GSON.toJson(this)); } - - public void readFields(DataInput in) throws IOException { - dbId = in.readLong(); - tableId = in.readLong(); - partitionId = in.readLong(); - } - } diff --git a/fe/fe-core/src/main/java/com/starrocks/persist/TableInfo.java b/fe/fe-core/src/main/java/com/starrocks/persist/TableInfo.java index 907c04b1c45ec4..3ef35c6bde5a97 100644 --- a/fe/fe-core/src/main/java/com/starrocks/persist/TableInfo.java +++ b/fe/fe-core/src/main/java/com/starrocks/persist/TableInfo.java @@ -20,8 +20,8 @@ import com.google.gson.annotations.SerializedName; import com.starrocks.common.io.Text; import com.starrocks.common.io.Writable; +import com.starrocks.persist.gson.GsonUtils; -import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; @@ -106,30 +106,6 @@ public String getNewPartitionName() { @Override public void write(DataOutput out) throws IOException { - out.writeLong(dbId); - out.writeLong(tableId); - out.writeLong(indexId); - out.writeLong(partitionId); - - Text.writeString(out, newTableName); - Text.writeString(out, newRollupName); - Text.writeString(out, newPartitionName); - } - - public void readFields(DataInput in) throws IOException { - dbId = in.readLong(); - tableId = in.readLong(); - indexId = in.readLong(); - partitionId = in.readLong(); - - newTableName = Text.readString(in); - newRollupName = Text.readString(in); - newPartitionName = Text.readString(in); - } - - public static TableInfo read(DataInput in) throws IOException { - TableInfo info = new TableInfo(); - info.readFields(in); - return info; + Text.writeString(out, GsonUtils.GSON.toJson(this)); } } diff --git a/fe/fe-core/src/main/java/com/starrocks/sql/ast/UserIdentity.java b/fe/fe-core/src/main/java/com/starrocks/sql/ast/UserIdentity.java index 52822b690b2085..41e3611ae1c3ea 100644 --- a/fe/fe-core/src/main/java/com/starrocks/sql/ast/UserIdentity.java +++ b/fe/fe-core/src/main/java/com/starrocks/sql/ast/UserIdentity.java @@ -44,12 +44,12 @@ import com.starrocks.common.io.Text; import com.starrocks.common.io.Writable; import com.starrocks.persist.gson.GsonPostProcessable; +import com.starrocks.persist.gson.GsonUtils; import com.starrocks.sql.analyzer.FeNameFormat; import com.starrocks.sql.analyzer.SemanticException; import com.starrocks.sql.parser.NodePosition; import com.starrocks.thrift.TUserIdentity; -import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; @@ -220,25 +220,9 @@ public String toString() { return sb.toString(); } - // change user to default_cluster:user for write - // and change default_cluster:user to user after read @Override public void write(DataOutput out) throws IOException { - Text.writeString(out, ClusterNamespace.getFullName(user)); - Text.writeString(out, host); - out.writeBoolean(isDomain); - } - - public static UserIdentity read(DataInput in) throws IOException { - UserIdentity userIdentity = new UserIdentity(); - userIdentity.readFields(in); - return userIdentity; - } - - public void readFields(DataInput in) throws IOException { - user = ClusterNamespace.getNameFromFullName(Text.readString(in)); - host = Text.readString(in); - isDomain = in.readBoolean(); + Text.writeString(out, GsonUtils.GSON.toJson(this)); } @Override diff --git a/fe/fe-core/src/main/java/com/starrocks/system/Frontend.java b/fe/fe-core/src/main/java/com/starrocks/system/Frontend.java index 6b7bd0757fae0c..844e882043854d 100644 --- a/fe/fe-core/src/main/java/com/starrocks/system/Frontend.java +++ b/fe/fe-core/src/main/java/com/starrocks/system/Frontend.java @@ -41,10 +41,10 @@ import com.starrocks.common.io.Writable; import com.starrocks.ha.BDBHA; import com.starrocks.ha.FrontendNodeType; +import com.starrocks.persist.gson.GsonUtils; import com.starrocks.server.GlobalStateMgr; import com.starrocks.system.HeartbeatResponse.HbStatus; -import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; @@ -212,23 +212,7 @@ public boolean handleHbResponse(FrontendHbResponse hbResponse, boolean isReplay) @Override public void write(DataOutput out) throws IOException { - Text.writeString(out, role.name()); - Text.writeString(out, host); - out.writeInt(editLogPort); - Text.writeString(out, nodeName); - } - - public void readFields(DataInput in) throws IOException { - role = FrontendNodeType.valueOf(Text.readString(in)); - host = Text.readString(in); - editLogPort = in.readInt(); - nodeName = Text.readString(in); - } - - public static Frontend read(DataInput in) throws IOException { - Frontend frontend = new Frontend(); - frontend.readFields(in); - return frontend; + Text.writeString(out, GsonUtils.GSON.toJson(this)); } @Override diff --git a/fe/fe-core/src/test/java/com/starrocks/catalog/BrokerMgrTest.java b/fe/fe-core/src/test/java/com/starrocks/catalog/BrokerMgrTest.java index 84cfb137eab6ca..8b471341d5759c 100644 --- a/fe/fe-core/src/test/java/com/starrocks/catalog/BrokerMgrTest.java +++ b/fe/fe-core/src/test/java/com/starrocks/catalog/BrokerMgrTest.java @@ -19,7 +19,6 @@ import com.starrocks.common.Pair; import com.starrocks.persist.EditLog; import com.starrocks.persist.gson.GsonUtils; -import com.starrocks.qe.SessionVariable; import com.starrocks.server.GlobalStateMgr; import com.starrocks.utframe.UtFrameUtils; import mockit.Expectations; @@ -45,9 +44,6 @@ public void setUp() throws Exception { globalStateMgr.getEditLog(); minTimes = 0; result = editLog; - - editLog.logGlobalVariable((SessionVariable) any); - minTimes = 0; } }; } diff --git a/fe/fe-core/src/test/java/com/starrocks/persist/EditLogTest.java b/fe/fe-core/src/test/java/com/starrocks/persist/EditLogTest.java index 868bf8dd06bbbc..dbf78ede14e266 100644 --- a/fe/fe-core/src/test/java/com/starrocks/persist/EditLogTest.java +++ b/fe/fe-core/src/test/java/com/starrocks/persist/EditLogTest.java @@ -165,23 +165,6 @@ private GlobalStateMgr mockGlobalStateMgr() throws Exception { return globalStateMgr; } - @Test - public void testOpUpdateFrontend() throws Exception { - GlobalStateMgr mgr = mockGlobalStateMgr(); - List frontends = mgr.getNodeMgr().getFrontends(null); - Frontend fe = frontends.get(0); - fe.updateHostAndEditLogPort("testHost", 1000); - JournalEntity journal = new JournalEntity(); - journal.setData(fe); - journal.setOpCode(OperationType.OP_UPDATE_FRONTEND); - EditLog editLog = new EditLog(null); - editLog.loadJournal(mgr, journal); - List updatedFrontends = mgr.getNodeMgr().getFrontends(null); - Frontend updatedfFe = updatedFrontends.get(0); - Assert.assertEquals("testHost", updatedfFe.getHost()); - Assert.assertTrue(updatedfFe.getEditLogPort() == 1000); - } - @Test public void testOpAddKeyJournalEntity() throws Exception { EncryptionKeyPB pb = new EncryptionKeyPB(); diff --git a/fe/fe-core/src/test/java/com/starrocks/persist/OperationTypeTest.java b/fe/fe-core/src/test/java/com/starrocks/persist/OperationTypeTest.java index 541d9aab41b531..8708512f30c286 100644 --- a/fe/fe-core/src/test/java/com/starrocks/persist/OperationTypeTest.java +++ b/fe/fe-core/src/test/java/com/starrocks/persist/OperationTypeTest.java @@ -21,70 +21,17 @@ public class OperationTypeTest { @Test public void testRecoverableOperations() { - Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_ALTER_DB)); Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_ERASE_DB)); - Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_RENAME_DB)); - Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_DROP_TABLE)); Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_DROP_PARTITION)); - Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_MODIFY_PARTITION)); - Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_ERASE_TABLE)); Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_ERASE_PARTITION)); - Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_RENAME_TABLE)); - Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_RENAME_PARTITION)); - Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_BACKUP_JOB)); Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_MODIFY_VIEW_DEF)); Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_BATCH_MODIFY_PARTITION)); - Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_DROP_ROLLUP)); - Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_CLEAR_ROLLUP_INFO)); - Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_FINISH_CONSISTENCY_CHECK)); - Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_RENAME_ROLLUP)); - Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_MODIFY_DISTRIBUTION_TYPE)); - Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_BATCH_ADD_ROLLUP)); Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_BATCH_DROP_ROLLUP)); Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_REMOVE_ALTER_JOB_V2)); - Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_EXPORT_CREATE)); - Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_EXPORT_UPDATE_STATE)); - Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_EXPORT_UPDATE_INFO)); - Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_DELETE_REPLICA)); - Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_DROP_BACKEND)); - Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_BACKEND_STATE_CHANGE)); - Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_REMOVE_FRONTEND)); - Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_SET_LOAD_ERROR_HUB)); - Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_HEARTBEAT)); - Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_NEW_DROP_USER)); - Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_GRANT_PRIV)); - Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_REVOKE_PRIV)); - Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_SET_PASSWORD)); - Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_CREATE_ROLE)); - Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_DROP_ROLE)); - Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_UPDATE_USER_PROPERTY)); - Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_TIMESTAMP)); - Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_GLOBAL_VARIABLE)); Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_GLOBAL_VARIABLE_V2)); - Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_ADD_BROKER)); - Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_DROP_BROKER)); Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_DROP_ALL_BROKER)); - Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_CREATE_REPOSITORY)); Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_DROP_REPOSITORY)); - Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_COLOCATE_ADD_TABLE)); - Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_COLOCATE_REMOVE_TABLE)); - Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_COLOCATE_BACKENDS_PER_BUCKETSEQ)); - Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_COLOCATE_MARK_UNSTABLE)); - Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_COLOCATE_MARK_STABLE)); - Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_MODIFY_TABLE_COLOCATE)); - Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_DELETE_TRANSACTION_STATE)); Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_DELETE_AUTO_INCREMENT_ID)); - Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_ALTER_ROUTINE_LOAD_JOB)); - Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_ADD_FUNCTION)); - Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_DROP_FUNCTION)); - Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_CREATE_ROUTINE_LOAD_JOB)); - Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_CHANGE_ROUTINE_LOAD_JOB)); - Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_REMOVE_ROUTINE_LOAD_JOB)); - Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_CREATE_LOAD_JOB)); - Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_END_LOAD_JOB)); - Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_UPDATE_LOAD_JOB)); - Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_CREATE_SMALL_FILE)); - Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_DROP_SMALL_FILE)); Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_DYNAMIC_PARTITION)); Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_MODIFY_REPLICATION_NUM)); Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_MODIFY_IN_MEMORY)); @@ -114,22 +61,16 @@ public void testRecoverableOperations() { Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_HEARTBEAT_V2)); Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_CREATE_CATALOG)); Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_DROP_CATALOG)); - Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_GRANT_IMPERSONATE)); - Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_REVOKE_IMPERSONATE)); - Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_GRANT_ROLE)); - Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_REVOKE_ROLE)); Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_CREATE_TASK)); Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_DROP_TASKS)); Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_CREATE_TASK_RUN)); Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_UPDATE_TASK_RUN)); - Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_DROP_TASK_RUNS)); Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_UPDATE_TASK_RUN_STATE)); Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_ALTER_TASK)); Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_RENAME_MATERIALIZED_VIEW)); Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains( OperationType.OP_CHANGE_MATERIALIZED_VIEW_REFRESH_SCHEME)); Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_ALTER_MATERIALIZED_VIEW_PROPERTIES)); - Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_CREATE_MATERIALIZED_VIEW)); Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_ALTER_MATERIALIZED_VIEW_STATUS)); Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_ADD_COMPUTE_NODE)); Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_DROP_COMPUTE_NODE)); @@ -138,8 +79,6 @@ public void testRecoverableOperations() { Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_ALTER_USER_V2)); Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_UPDATE_ROLE_PRIVILEGE_V2)); Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_DROP_ROLE_V2)); - Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_UPDATE_USER_PROP_V2)); - Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_CREATE_STREAM_LOAD_TASK)); Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_MV_EPOCH_UPDATE)); Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_MV_JOB_STATE)); Assert.assertTrue(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_ALTER_LOAD_JOB)); @@ -212,78 +151,40 @@ public void testRecoverableOperations() { @Test public void testUnRecoverableOperations() { - Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_ADD_BACKEND)); Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_ADD_BACKEND_V2)); - Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_ADD_FIRST_FRONTEND)); Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_ADD_FIRST_FRONTEND_V2)); - Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_ADD_FRONTEND)); Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_ADD_FRONTEND_V2)); - Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_ADD_PARTITION)); - Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_ADD_PARTITIONS)); Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_ADD_PARTITIONS_V2)); Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_ADD_PARTITION_V2)); - Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_ADD_REPLICA)); Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_ADD_REPLICA_V2)); Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_ADD_SUB_PARTITIONS_V2)); - Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_ADD_UNUSED_SHARD)); Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_ALTER_JOB_V2)); - Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_BACKEND_TABLETS_INFO)); Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_BACKEND_TABLETS_INFO_V2)); Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_BATCH_DELETE_REPLICA)); - Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_CANCEL_ROLLUP)); - Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_CANCEL_SCHEMA_CHANGE)); - Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_CREATE_CLUSTER)); - Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_CREATE_DB)); Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_CREATE_DB_V2)); Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_CREATE_INSERT_OVERWRITE)); - Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_CREATE_TABLE)); Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_CREATE_TABLE_V2)); - Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_CREATE_USER)); Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_CREATE_USER_V2)); - Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_DELETE_UNUSED_SHARD)); - Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_DROP_USER_V2)); Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_DROP_USER_V3)); - Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_FINISH_ASYNC_DELETE)); - Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_FINISH_DECOMMISSION_BACKEND)); - Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_FINISH_DELETE)); - Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_FINISHING_ROLLUP)); - Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_FINISHING_SCHEMA_CHANGE)); - Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_FINISH_ROLLUP)); - Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_FINISH_SCHEMA_CHANGE)); - Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_FINISH_SYNC_DELETE)); Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_INSERT_OVERWRITE_STATE_CHANGE)); Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_INVALID)); - Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_LEADER_INFO_CHANGE)); Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_LEADER_INFO_CHANGE_V2)); - Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_META_VERSION)); Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_META_VERSION_V2)); Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_MODIFY_TABLE_ADD_OR_DROP_COLUMNS)); - Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_RECOVER_DB)); Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_RECOVER_DB_V2)); - Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_RECOVER_PARTITION)); Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_RECOVER_PARTITION_V2)); - Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_RECOVER_TABLE)); Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_RECOVER_TABLE_V2)); Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_REPLACE_TEMP_PARTITION)); - Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_RESTORE_JOB)); Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_RESTORE_JOB_V2)); Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_SAVE_AUTO_INCREMENT_ID)); Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_SAVE_NEXTID)); - Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_SAVE_TRANSACTION_ID)); Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_SAVE_TRANSACTION_ID_V2)); Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_SET_REPLICA_STATUS)); Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_STARMGR)); - Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_START_DECOMMISSION_BACKEND)); - Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_START_ROLLUP)); - Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_START_SCHEMA_CHANGE)); Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_TRUNCATE_TABLE)); Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_TYPE_EOF)); - Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_UPDATE_CLUSTER_AND_BACKENDS)); - Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_UPDATE_FRONTEND)); Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_UPDATE_FRONTEND_V2)); - Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_UPDATE_REPLICA)); Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_UPDATE_REPLICA_V2)); - Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_UPSERT_TRANSACTION_STATE)); Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_UPSERT_TRANSACTION_STATE_BATCH)); Assert.assertFalse(OperationType.IGNORABLE_OPERATIONS.contains(OperationType.OP_UPSERT_TRANSACTION_STATE_V2)); } diff --git a/fe/fe-core/src/test/java/com/starrocks/qe/VariableMgrTest.java b/fe/fe-core/src/test/java/com/starrocks/qe/VariableMgrTest.java index 2a5f2bc02b9a14..2e195ad81dba21 100644 --- a/fe/fe-core/src/test/java/com/starrocks/qe/VariableMgrTest.java +++ b/fe/fe-core/src/test/java/com/starrocks/qe/VariableMgrTest.java @@ -72,9 +72,6 @@ public void setUp() { globalStateMgr.getEditLog(); minTimes = 0; result = editLog; - - editLog.logGlobalVariable((SessionVariable) any); - minTimes = 0; } };