w41ter commented on code in PR #46769:
URL: https://github.com/apache/doris/pull/46769#discussion_r1916366381


##########
fe/fe-core/src/main/java/org/apache/doris/binlog/BinlogLagInfo.java:
##########
@@ -0,0 +1,69 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.doris.binlog;
+
+public class BinlogLagInfo {
+    private long lag;
+    private long firstCommitSeq;
+    private long lastCommitSeq;
+    private long firstCommitTs;
+    private long lastCommitTs;
+
+    public BinlogLagInfo(long lag, long firstCommitSeq, long lastCommitSeq, 
long firstCommitTs, long lastCommitTs) {
+        this.lag = lag;
+        this.firstCommitSeq = firstCommitSeq;
+        this.lastCommitSeq = lastCommitSeq;
+        this.firstCommitTs = firstCommitTs;
+        this.lastCommitTs = lastCommitTs;
+    }
+
+    public BinlogLagInfo(long lag, long lastCommitSeq, long lastCommitTs) {
+        this.lag = lag;
+        this.lastCommitSeq = lastCommitSeq;
+        this.lastCommitTs = lastCommitTs;
+    }
+

Review Comment:
   ```suggestion
   ```



##########
fe/fe-core/src/main/java/org/apache/doris/binlog/BinlogUtils.java:
##########
@@ -50,25 +50,37 @@ public static Pair<TStatus, TBinlog> 
getBinlog(TreeSet<TBinlog> binlogs, long pr
         }
     }
 
-    public static Pair<TStatus, Long> getBinlogLag(TreeSet<TBinlog> binlogs, 
long prevCommitSeq) {
+    public static Pair<TStatus, BinlogLagInfo> getBinlogLag(TreeSet<TBinlog> 
binlogs, long prevCommitSeq) {
         TStatus status = new TStatus(TStatusCode.OK);
         TBinlog firstBinlog = binlogs.first();
+        TBinlog lastBinlog = binlogs.last();
 
         if (firstBinlog.getCommitSeq() > prevCommitSeq) {
-            return Pair.of(status, Long.valueOf(binlogs.size()));
+            BinlogLagInfo lagInfo = new BinlogLagInfo(binlogs.size(), 
firstBinlog.getCommitSeq(),
+                    firstBinlog.getTimestamp(), lastBinlog.getCommitSeq(), 
lastBinlog.getTimestamp());
+            return Pair.of(status, lagInfo);
         }
 
         // find first binlog whose commitSeq > commitSeq
         TBinlog guard = new TBinlog();
         guard.setCommitSeq(prevCommitSeq);
-        TBinlog binlog = binlogs.higher(guard);
+        TBinlog firstTBinlog = binlogs.higher(guard);

Review Comment:
   `firstTBinlog`, how about changing it to `binlog`?



-- 
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

Reply via email to