yujun777 commented on code in PR #32980: URL: https://github.com/apache/doris/pull/32980#discussion_r1577621060
########## fe/fe-core/src/main/java/org/apache/doris/transaction/TransactionState.java: ########## @@ -695,41 +730,21 @@ public void prolongPublishTimeout() { @Override public void write(DataOutput out) throws IOException { - out.writeLong(transactionId); - Text.writeString(out, label); - out.writeLong(dbId); - out.writeInt(idToTableCommitInfos.size()); - for (TableCommitInfo info : idToTableCommitInfos.values()) { - info.write(out); - } - out.writeInt(txnCoordinator.sourceType.value()); - Text.writeString(out, txnCoordinator.ip); - out.writeInt(transactionStatus.value()); - out.writeInt(sourceType.value()); - out.writeLong(prepareTime); - out.writeLong(preCommitTime); - out.writeLong(commitTime); - out.writeLong(finishTime); - Text.writeString(out, reason); - out.writeInt(errorReplicas.size()); - for (long errorReplciaId : errorReplicas) { - out.writeLong(errorReplciaId); - } - - if (txnCommitAttachment == null) { - out.writeBoolean(false); + Text.writeString(out, GsonUtils.GSON.toJson(this)); + } + + public static TransactionState read(DataInput in) throws IOException { + if (Env.getCurrentEnvJournalVersion() < FeMetaVersion.VERSION_132) { + TransactionState transactionState = new TransactionState(); + transactionState.readFields(in); + return transactionState; } else { - out.writeBoolean(true); - txnCommitAttachment.write(out); - } - out.writeLong(callbackId); - out.writeLong(timeoutMs); - out.writeInt(tableIdList.size()); - for (Long aLong : tableIdList) { - out.writeLong(aLong); + String json = Text.readString(in); Review Comment: suppose fe has some history txns, upgrade fe. at the first time fe upgrade and restart, can it read the history txns with json format ? -- 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. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org