You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by ca...@apache.org on 2023/12/28 03:21:42 UTC
(doris) branch editlog_bug created (now 79c06b0130d)
This is an automated email from the ASF dual-hosted git repository.
caiconghui pushed a change to branch editlog_bug
in repository https://gitbox.apache.org/repos/asf/doris.git
at 79c06b0130d [fix](DatabaseTransactionMgr) fix clean label bug which may cause inconsitent editlog operation
This branch includes the following new commits:
new 79c06b0130d [fix](DatabaseTransactionMgr) fix clean label bug which may cause inconsitent editlog operation
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
(doris) 01/01: [fix](DatabaseTransactionMgr) fix clean label bug which may cause inconsitent editlog operation
Posted by ca...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
caiconghui pushed a commit to branch editlog_bug
in repository https://gitbox.apache.org/repos/asf/doris.git
commit 79c06b0130dbe975f49563ab2443e055d1fc6a80
Author: caiconghui1 <ca...@jd.com>
AuthorDate: Thu Dec 28 11:19:49 2023 +0800
[fix](DatabaseTransactionMgr) fix clean label bug which may cause inconsitent editlog operation
---
.../main/java/org/apache/doris/load/loadv2/LoadManager.java | 12 +++---------
.../org/apache/doris/transaction/DatabaseTransactionMgr.java | 10 +++++++---
.../org/apache/doris/transaction/GlobalTransactionMgr.java | 4 ++--
3 files changed, 12 insertions(+), 14 deletions(-)
diff --git a/fe/fe-core/src/main/java/org/apache/doris/load/loadv2/LoadManager.java b/fe/fe-core/src/main/java/org/apache/doris/load/loadv2/LoadManager.java
index 3909ff5d784..35968139ec8 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/load/loadv2/LoadManager.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/load/loadv2/LoadManager.java
@@ -786,22 +786,16 @@ public class LoadManager implements Writable {
} finally {
writeUnlock();
}
- LOG.info("clean {} labels on db {} with label '{}' in load mgr.", counter, dbId, label);
-
// 2. Remove from DatabaseTransactionMgr
try {
- Env.getCurrentGlobalTransactionMgr().cleanLabel(dbId, label);
+ Env.getCurrentGlobalTransactionMgr().cleanLabel(dbId, label, isReplay);
} catch (AnalysisException e) {
// just ignore, because we don't want to throw any exception here.
LOG.warn("Exception:", e);
}
- // 3. Log
- if (!isReplay) {
- CleanLabelOperationLog log = new CleanLabelOperationLog(dbId, label);
- Env.getCurrentEnv().getEditLog().logCleanLabel(log);
- }
- LOG.info("finished to clean label on db {} with label {}. is replay: {}", dbId, label, isReplay);
+ LOG.info("finished to clean {} labels on db {} with label '{}' in load mgr. is replay: {}",
+ counter, dbId, label, isReplay);
}
private void readLock() {
diff --git a/fe/fe-core/src/main/java/org/apache/doris/transaction/DatabaseTransactionMgr.java b/fe/fe-core/src/main/java/org/apache/doris/transaction/DatabaseTransactionMgr.java
index 29471255f29..5bb954289cc 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/transaction/DatabaseTransactionMgr.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/transaction/DatabaseTransactionMgr.java
@@ -50,6 +50,7 @@ import org.apache.doris.common.util.TimeUtils;
import org.apache.doris.metric.MetricRepo;
import org.apache.doris.mysql.privilege.PrivPredicate;
import org.apache.doris.persist.BatchRemoveTransactionsOperationV2;
+import org.apache.doris.persist.CleanLabelOperationLog;
import org.apache.doris.persist.EditLog;
import org.apache.doris.qe.ConnectContext;
import org.apache.doris.statistics.AnalysisManager;
@@ -2072,7 +2073,7 @@ public class DatabaseTransactionMgr {
}
}
- protected void cleanLabel(String label) {
+ protected void cleanLabel(String label, boolean isReplay) {
Set<Long> removedTxnIds = Sets.newHashSet();
writeLock();
try {
@@ -2113,11 +2114,14 @@ public class DatabaseTransactionMgr {
// So that we can keep consistency in meta image
finalStatusTransactionStateDequeShort.removeIf(txn -> removedTxnIds.contains(txn.getTransactionId()));
finalStatusTransactionStateDequeLong.removeIf(txn -> removedTxnIds.contains(txn.getTransactionId()));
+
+ if (!isReplay) {
+ CleanLabelOperationLog log = new CleanLabelOperationLog(dbId, label);
+ Env.getCurrentEnv().getEditLog().logCleanLabel(log);
+ }
} finally {
writeUnlock();
}
- LOG.info("clean {} labels on db {} with label '{}' in database transaction mgr.", removedTxnIds.size(), dbId,
- label);
}
public long getTxnNumByStatus(TransactionStatus status) {
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 ee228a10fc8..4832d66bedb 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
@@ -754,8 +754,8 @@ public class GlobalTransactionMgr implements Writable {
return getDatabaseTransactionMgr(dbId).getPreCommittedTxnList();
}
- public void cleanLabel(Long dbId, String label) throws AnalysisException {
- getDatabaseTransactionMgr(dbId).cleanLabel(label);
+ public void cleanLabel(Long dbId, String label, boolean isReplay) throws AnalysisException {
+ getDatabaseTransactionMgr(dbId).cleanLabel(label, isReplay);
}
public Long getTransactionIdByLabel(Long dbId, String label, List<TransactionStatus> statusList)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org