Skip to content

Commit ef564b1

Browse files
authored
[fix](group commit) Fix group commit error log when decommission (#39899)
Decommission backend will check the group commit wal num is 0. But there is a small bug of log: ``` boolean hasWal = checkWal(backend); // the hasWal should be empty wal hasWal ? "; and has unfinished WALs" : "" // so if log print 'and has unfinished WALs', the wal is 0 actually ```
1 parent 05596da commit ef564b1

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

fe/fe-core/src/main/java/org/apache/doris/alter/SystemHandler.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ private void runAlterJobV2() {
9595
}
9696

9797
List<Long> backendTabletIds = invertedIndex.getTabletIdsByBackendId(beId);
98-
boolean hasWal = checkWal(backend);
99-
if (Config.drop_backend_after_decommission && checkTablets(beId, backendTabletIds) && hasWal) {
98+
long walNum = Env.getCurrentEnv().getGroupCommitManager().getAllWalQueueSize(backend);
99+
if (Config.drop_backend_after_decommission && checkTablets(beId, backendTabletIds) && walNum == 0) {
100100
try {
101101
systemInfoService.dropBackend(beId);
102102
LOG.info("no available tablet on decommission backend {}, drop it", beId);
@@ -109,7 +109,7 @@ private void runAlterJobV2() {
109109

110110
LOG.info("backend {} lefts {} replicas to decommission: {}{}", beId, backendTabletIds.size(),
111111
backendTabletIds.subList(0, Math.min(10, backendTabletIds.size())),
112-
hasWal ? "; and has unfinished WALs" : "");
112+
walNum > 0 ? "; and has " + walNum + " unfinished WALs" : "");
113113
}
114114
}
115115

@@ -210,10 +210,6 @@ private boolean checkTablets(Long beId, List<Long> backendTabletIds) {
210210
return false;
211211
}
212212

213-
private boolean checkWal(Backend backend) {
214-
return Env.getCurrentEnv().getGroupCommitManager().getAllWalQueueSize(backend) == 0;
215-
}
216-
217213
private List<Backend> checkDecommission(DecommissionBackendClause decommissionBackendClause)
218214
throws DdlException {
219215
if (decommissionBackendClause.getHostInfos().isEmpty()) {

fe/fe-core/src/main/java/org/apache/doris/load/GroupCommitManager.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public void waitWalFinished(long tableId) {
106106
/**
107107
* Check the wal before the endTransactionId is finished or not.
108108
*/
109-
public boolean isPreviousWalFinished(long tableId, List<Long> aliveBeIds) {
109+
private boolean isPreviousWalFinished(long tableId, List<Long> aliveBeIds) {
110110
boolean empty = true;
111111
for (int i = 0; i < aliveBeIds.size(); i++) {
112112
Backend backend = Env.getCurrentSystemInfo().getBackend(aliveBeIds.get(i));
@@ -137,7 +137,7 @@ public long getAllWalQueueSize(Backend backend) {
137137
return size;
138138
}
139139

140-
public long getWalQueueSize(Backend backend, PGetWalQueueSizeRequest request) {
140+
private long getWalQueueSize(Backend backend, PGetWalQueueSizeRequest request) {
141141
PGetWalQueueSizeResponse response = null;
142142
long expireTime = System.currentTimeMillis() + Config.check_wal_queue_timeout_threshold;
143143
long size = 0;
@@ -376,7 +376,7 @@ public void updateLoadData(long tableId, long receiveData) {
376376
}
377377
}
378378

379-
public void updateLoadDataInternal(long tableId, long receiveData) {
379+
private void updateLoadDataInternal(long tableId, long receiveData) {
380380
if (tableToPressureMap.containsKey(tableId)) {
381381
tableToPressureMap.get(tableId).add(receiveData);
382382
LOG.info("Update load data for table{}, receiveData {}, tablePressureMap {}", tableId, receiveData,

0 commit comments

Comments
 (0)