morningman commented on a change in pull request #3293: [Transaction]Cancel all txns whose coordinate be is down. URL: https://github.com/apache/incubator-doris/pull/3293#discussion_r407060372
########## File path: fe/src/main/java/org/apache/doris/transaction/GlobalTransactionMgr.java ########## @@ -1389,4 +1389,33 @@ public TransactionState getTransactionStateByCallbackId(long callbackId) { } return null; } + + public List<Long> getTransactionIdByCoordinateBe(String coordinateHost, int limit) { + ArrayList<Long> txnIds = new ArrayList<>(); + readLock(); + try { + idToTransactionState.values().stream() + .filter(t -> (t.getCoordinator().contains(coordinateHost) && (!t.getTransactionStatus().isFinalStatus()))) Review comment: In some clusters, FE and BE are deployed together. So only by checking `t.getCoordinator().contains(coordinateHost)` will also abort those transactions which the coordinator is FE, not the BE, which is not expected. The current value of the `coordinator` is an informal value, it is just for displaying the job information. If we want to use this `coordinator` field to do some logic control, we should make it formal, for example, by creating a new class "TxnCoordinator" to save the coordinator info. Currently, the `coordinator` is either "FE: 192.168.0.1" or "BE: 192.168.0.1". So the new class "TxnCoordinator" may looks like: ``` class TxnCoordinator { private String source; // "FE" or "BE" private String ip; // the ip } ``` And in `getTransactionIdByCoordinateBe`, we should get all transactions with the specified IP and source is BE. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org