Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions fe/src/main/java/org/apache/doris/catalog/Catalog.java
Original file line number Diff line number Diff line change
Expand Up @@ -1803,15 +1803,10 @@ public long loadTransactionState(DataInputStream dis, long checksum) throws IOEx

public long loadRecycleBin(DataInputStream dis, long checksum) throws IOException {
if (Catalog.getCurrentCatalogJournalVersion() >= FeMetaVersion.VERSION_10) {
recycleBin.readFields(dis);
Catalog.getCurrentRecycleBin().readFields(dis);
if (!isCheckpointThread()) {
// add tablet in Recycle bin to TabletInvertedIndex
recycleBin.addTabletToInvertedIndex();
}
// create DatabaseTransactionMgr for db in recycle bin.
// these dbs do not exist in `idToDb` of the catalog.
for (Long dbId : recycleBin.getAllDbIds()) {
globalTransactionMgr.addDatabaseTransactionMgr(dbId);
Catalog.getCurrentRecycleBin().addTabletToInvertedIndex();
}
}
return checksum;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
import org.apache.doris.thrift.TStorageMedium;

import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Range;
import com.google.common.collect.Sets;
Expand Down Expand Up @@ -173,9 +172,6 @@ private synchronized void eraseDatabaseWithSameName(String dbName) {
iterator.remove();
idToRecycleTime.remove(entry.getKey());

// remove database transaction manager
Catalog.getCurrentCatalog().getGlobalTransactionMgr().removeDatabaseTransactionMgr(db.getId());

LOG.info("erase database[{}] name: {}", db.getId(), dbName);
}
}
Expand Down Expand Up @@ -891,9 +887,4 @@ public void readFields(DataInput in) throws IOException {
}
}
}

// currently only used when loading image. So no synchronized protected.
public List<Long> getAllDbIds() {
return Lists.newArrayList(idToDatabase.keySet());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ public AuditEventProcessor(PluginMgr pluginMgr) {

public void start() {
workerThread = new Thread(new Worker(), "AuditEventProcessor");
workerThread.setDaemon(true);
workerThread.start();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,11 @@ public DatabaseTransactionMgr getDatabaseTransactionMgr(long dbId) throws Analys
}

public void addDatabaseTransactionMgr(Long dbId) {
if (dbIdToDatabaseTransactionMgrs.putIfAbsent(dbId, new DatabaseTransactionMgr(dbId, catalog, idGenerator)) == null) {
LOG.debug("add database transaction manager for db {}", dbId);
}
dbIdToDatabaseTransactionMgrs.putIfAbsent(dbId, new DatabaseTransactionMgr(dbId, catalog, idGenerator));
}

public void removeDatabaseTransactionMgr(Long dbId) {
if (dbIdToDatabaseTransactionMgrs.remove(dbId) != null) {
LOG.debug("remove database transaction manager for db {}", dbId);
}
dbIdToDatabaseTransactionMgrs.remove(dbId);
}

public long beginTransaction(long dbId, List<Long> tableIdList, String label, TxnCoordinator coordinator, LoadJobSourceType sourceType,
Expand Down Expand Up @@ -359,19 +355,19 @@ public void write(DataOutput out) throws IOException {
}

public void readFields(DataInput in) throws IOException {
int numTransactions = in.readInt();
for (int i = 0; i < numTransactions; ++i) {
TransactionState transactionState = new TransactionState();
transactionState.readFields(in);
try {
try {
int numTransactions = in.readInt();
for (int i = 0; i < numTransactions; ++i) {
TransactionState transactionState = new TransactionState();
transactionState.readFields(in);
DatabaseTransactionMgr dbTransactionMgr = getDatabaseTransactionMgr(transactionState.getDbId());
dbTransactionMgr.unprotectUpsertTransactionState(transactionState, true);
} catch (AnalysisException e) {
LOG.warn("failed to get db transaction manager for txn: {}", transactionState);
throw new IOException("Read transaction states failed", e);
}
idGenerator.readFields(in);
} catch (AnalysisException e) {
throw new IOException("Read transaction states failed", e);
}
idGenerator.readFields(in);

}

public TransactionState getTransactionStateByCallbackIdAndStatus(long dbId, long callbackId, Set<TransactionStatus> status) {
Expand Down