This commit is contained in:
morningman
2020-05-14 09:25:51 +08:00
parent 47bce081d2
commit b08e08b3ba
2 changed files with 16 additions and 11 deletions

View File

@ -56,6 +56,7 @@ public class AuditEventProcessor {
public void start() {
workerThread = new Thread(new Worker(), "AuditEventProcessor");
workerThread.setDaemon(true);
workerThread.start();
}

View File

@ -79,11 +79,15 @@ public class GlobalTransactionMgr implements Writable {
}
public void addDatabaseTransactionMgr(Long dbId) {
dbIdToDatabaseTransactionMgrs.putIfAbsent(dbId, new DatabaseTransactionMgr(dbId, catalog, idGenerator));
if (dbIdToDatabaseTransactionMgrs.putIfAbsent(dbId, new DatabaseTransactionMgr(dbId, catalog, idGenerator)) == null) {
LOG.debug("add database transaction manager for db {}", dbId);
}
}
public void removeDatabaseTransactionMgr(Long dbId) {
dbIdToDatabaseTransactionMgrs.remove(dbId);
if (dbIdToDatabaseTransactionMgrs.remove(dbId) != null) {
LOG.debug("remove database transaction manager for db {}", dbId);
}
}
public long beginTransaction(long dbId, List<Long> tableIdList, String label, TxnCoordinator coordinator, LoadJobSourceType sourceType,
@ -355,19 +359,19 @@ public class GlobalTransactionMgr implements Writable {
}
public void readFields(DataInput in) throws IOException {
try {
int numTransactions = in.readInt();
for (int i = 0; i < numTransactions; ++i) {
TransactionState transactionState = new TransactionState();
transactionState.readFields(in);
int numTransactions = in.readInt();
for (int i = 0; i < numTransactions; ++i) {
TransactionState transactionState = new TransactionState();
transactionState.readFields(in);
try {
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) {