From 2acf634f84f797cd8ea59f719e083d1b5dc93a0b Mon Sep 17 00:00:00 2001 From: jakevin Date: Wed, 18 Jan 2023 22:25:41 +0800 Subject: [PATCH] [CleanUp](FE): cleanup useless code in FE. (#16058) --- .../org/apache/doris/clone/BackendInfo.java | 96 ----------------- .../apache/doris/clone/CloneTabletInfo.java | 100 ------------------ .../apache/doris/rpc/AttachmentRequest.java | 55 ---------- .../transaction/GlobalTransactionMgr.java | 1 - .../IllegalTransactionParameterException.java | 33 ------ .../transaction/TxnStateChangeCallback.java | 4 - 6 files changed, 289 deletions(-) delete mode 100644 fe/fe-core/src/main/java/org/apache/doris/clone/BackendInfo.java delete mode 100644 fe/fe-core/src/main/java/org/apache/doris/clone/CloneTabletInfo.java delete mode 100644 fe/fe-core/src/main/java/org/apache/doris/rpc/AttachmentRequest.java delete mode 100644 fe/fe-core/src/main/java/org/apache/doris/transaction/IllegalTransactionParameterException.java diff --git a/fe/fe-core/src/main/java/org/apache/doris/clone/BackendInfo.java b/fe/fe-core/src/main/java/org/apache/doris/clone/BackendInfo.java deleted file mode 100644 index 060b140663..0000000000 --- a/fe/fe-core/src/main/java/org/apache/doris/clone/BackendInfo.java +++ /dev/null @@ -1,96 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -package org.apache.doris.clone; - -public class BackendInfo { - private long backendId; - private String host; - - private long totalCapacityB; - private long availableCapacityB; - // capacity for clone - private long cloneCapacityB; - - private int tableReplicaNum; - // replica num for clone - private int cloneReplicaNum; - - public BackendInfo(String host, long backendId, long totalCapacityB, long availableCapacityB) { - this.backendId = backendId; - this.totalCapacityB = totalCapacityB; - this.availableCapacityB = availableCapacityB; - this.host = host; - this.cloneCapacityB = 0L; - this.tableReplicaNum = 0; - this.cloneReplicaNum = 0; - } - - public String getHost() { - return host; - } - - public long getBackendId() { - return backendId; - } - - public long getTotalCapacityB() { - return totalCapacityB; - } - - public long getAvailableCapacityB() { - return availableCapacityB; - } - - public void setCloneCapacityB(long cloneCapacityB) { - this.cloneCapacityB = cloneCapacityB; - } - - public boolean canCloneByCapacity(long tabletSizeB) { - if (cloneCapacityB <= tabletSizeB) { - return false; - } - return true; - } - - public void decreaseCloneCapacityB(long tabletSizeB) { - cloneCapacityB -= tabletSizeB; - } - - public int getTableReplicaNum() { - return tableReplicaNum; - } - - public void setTableReplicaNum(int tableReplicaNum) { - this.tableReplicaNum = tableReplicaNum; - } - - public void setCloneReplicaNum(int cloneReplicaNum) { - this.cloneReplicaNum = cloneReplicaNum; - } - - public boolean canCloneByDistribution() { - if (cloneReplicaNum <= 1) { - return false; - } - return true; - } - - public void decreaseCloneReplicaNum() { - cloneReplicaNum -= 1; - } -} diff --git a/fe/fe-core/src/main/java/org/apache/doris/clone/CloneTabletInfo.java b/fe/fe-core/src/main/java/org/apache/doris/clone/CloneTabletInfo.java deleted file mode 100644 index f16affe8c3..0000000000 --- a/fe/fe-core/src/main/java/org/apache/doris/clone/CloneTabletInfo.java +++ /dev/null @@ -1,100 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -package org.apache.doris.clone; - -import org.apache.doris.catalog.Database; - -import java.util.Set; - -public class CloneTabletInfo { - private long dbId; - private long tableId; - private long partitionId; - private long indexId; - private long tabletId; - private short replicationNum; - private short onlineReplicaNum; - private long tabletSizeB; - private Set backendIds; - private Database.DbState dbState; - - public CloneTabletInfo(long dbId, long tableId, long partitionId, long indexId, long tabletId, short replicationNum, - short onlineReplicaNum, long tabletSizeB, Set backendIds) { - this.dbId = dbId; - this.tableId = tableId; - this.partitionId = partitionId; - this.indexId = indexId; - this.tabletId = tabletId; - this.replicationNum = replicationNum; - this.onlineReplicaNum = onlineReplicaNum; - this.tabletSizeB = tabletSizeB; - this.backendIds = backendIds; - this.dbState = Database.DbState.NORMAL; - } - - public long getDbId() { - return dbId; - } - - public long getTableId() { - return tableId; - } - - public long getPartitionId() { - return partitionId; - } - - public long getIndexId() { - return indexId; - } - - public long getTabletId() { - return tabletId; - } - - public short getReplicationNum() { - return replicationNum; - } - - public short getOnlineReplicaNum() { - return onlineReplicaNum; - } - - public long getTabletSizeB() { - return tabletSizeB; - } - - public Set getBackendIds() { - return backendIds; - } - - @Override - public String toString() { - return "TabletInfo [dbId=" + dbId + ", tableId=" + tableId + ", partitionId=" + partitionId + ", indexId=" - + indexId + ", tabletId=" + tabletId + ", replicationNum=" + replicationNum + ", onlineReplicaNum=" - + onlineReplicaNum + ", tabletSizeB=" + tabletSizeB + ", backendIds=" + backendIds + "]"; - } - - public Database.DbState getDbState() { - return dbState; - } - - public void setDbState(Database.DbState dbState) { - this.dbState = dbState; - } -} diff --git a/fe/fe-core/src/main/java/org/apache/doris/rpc/AttachmentRequest.java b/fe/fe-core/src/main/java/org/apache/doris/rpc/AttachmentRequest.java deleted file mode 100644 index a67e56c4b1..0000000000 --- a/fe/fe-core/src/main/java/org/apache/doris/rpc/AttachmentRequest.java +++ /dev/null @@ -1,55 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -package org.apache.doris.rpc; - -import org.apache.thrift.TBase; -import org.apache.thrift.TDeserializer; -import org.apache.thrift.TException; -import org.apache.thrift.TSerializer; - -// used to compatible with our older thrift protocol -public class AttachmentRequest { - protected byte[] serializedRequest; - protected byte[] serializedResult; - - public void setRequest(TBase request) throws TException { - TSerializer serializer = new TSerializer(); - serializedRequest = serializer.serialize(request); - } - - public void setSerializedRequest(byte[] request) { - this.serializedRequest = request; - } - - public byte[] getSerializedRequest() { - return serializedRequest; - } - - public void setSerializedResult(byte[] result) { - this.serializedResult = result; - } - - public byte[] getSerializedResult() { - return serializedResult; - } - - public void getResult(TBase result) throws TException { - TDeserializer deserializer = new TDeserializer(); - deserializer.deserialize(result, serializedResult); - } -} diff --git a/fe/fe-core/src/main/java/org/apache/doris/transaction/GlobalTransactionMgr.java b/fe/fe-core/src/main/java/org/apache/doris/transaction/GlobalTransactionMgr.java index 691b0eb249..f12e219771 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/transaction/GlobalTransactionMgr.java +++ b/fe/fe-core/src/main/java/org/apache/doris/transaction/GlobalTransactionMgr.java @@ -125,7 +125,6 @@ public class GlobalTransactionMgr implements Writable { * @param coordinator * @throws BeginTransactionException * @throws DuplicatedRequestException - * @throws IllegalTransactionParameterException */ public long beginTransaction(long dbId, List tableIdList, String label, TUniqueId requestId, TxnCoordinator coordinator, LoadJobSourceType sourceType, long listenerId, long timeoutSecond) diff --git a/fe/fe-core/src/main/java/org/apache/doris/transaction/IllegalTransactionParameterException.java b/fe/fe-core/src/main/java/org/apache/doris/transaction/IllegalTransactionParameterException.java deleted file mode 100644 index a1be66239e..0000000000 --- a/fe/fe-core/src/main/java/org/apache/doris/transaction/IllegalTransactionParameterException.java +++ /dev/null @@ -1,33 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -package org.apache.doris.transaction; - -import org.apache.doris.common.UserException; - -public class IllegalTransactionParameterException extends UserException { - - private static final long serialVersionUID = 1L; - - public IllegalTransactionParameterException(String msg) { - super(msg); - } - - public IllegalTransactionParameterException(String msg, Throwable e) { - super(msg, e); - } -} diff --git a/fe/fe-core/src/main/java/org/apache/doris/transaction/TxnStateChangeCallback.java b/fe/fe-core/src/main/java/org/apache/doris/transaction/TxnStateChangeCallback.java index a368c54d6a..0a08819df0 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/transaction/TxnStateChangeCallback.java +++ b/fe/fe-core/src/main/java/org/apache/doris/transaction/TxnStateChangeCallback.java @@ -25,7 +25,6 @@ public interface TxnStateChangeCallback { /** * this interface is executed before txn committed, it will check if txn could be commit - * @param txnState * @throws TransactionException if transaction could not be commit or there are some exception before committed, * it will throw this exception. The txn will be committed failed. */ @@ -34,7 +33,6 @@ public interface TxnStateChangeCallback { /** * this interface is executed before txn aborted, it will check if txn could be abort * - * @param txnState * @throws TransactionException if transaction could not be abort or there are some exception before aborted, * it will throw this exception. The txn will be aborted failed. */ @@ -52,10 +50,8 @@ public interface TxnStateChangeCallback { /** * this interface is executed when transaction has been aborted * - * @param txnState * @param txnStatusChangeReason * maybe null - * @return */ void afterAborted(TransactionState txnState, boolean txnOperated, String txnStatusChangeReason) throws UserException;