-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Support txn management in db level isolation and use ArrayDeque to improve txn task performance #3369
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
fe/src/main/java/org/apache/doris/transaction/DatabaseTransactionMgr.java
Show resolved
Hide resolved
fe/src/main/java/org/apache/doris/transaction/DatabaseTransactionMgr.java
Show resolved
Hide resolved
fe/src/main/java/org/apache/doris/transaction/GlobalTransactionMgr.java
Outdated
Show resolved
Hide resolved
fe/src/main/java/org/apache/doris/transaction/GlobalTransactionMgr.java
Outdated
Show resolved
Hide resolved
| } | ||
|
|
||
| Catalog.getCurrentGlobalTransactionMgr().abortTransaction(request.getTxnId(), | ||
| long dbId = Catalog.getInstance().getDb(request.getDb()).getId(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getDb() may return null if database does not exist yet.
| public DatabaseTransactionMgr getDatabaseTransactioMgr(long dbId) { | ||
| DatabaseTransactionMgr dbTransactionMgr = dbIdToDatabaseTransactionMgrs.get(dbId); | ||
| if (dbTransactionMgr == null) { | ||
| throw new NullPointerException("databaseTransactionMgr[" + dbId + "] does not exist"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not using NullPointerException, you can use TransactionException
| } | ||
|
|
||
| public void addDatabaseTransactionMgr(Long dbId, EditLog editLog) { | ||
| dbIdToDatabaseTransactionMgrs.put(dbId, new DatabaseTransactionMgr(dbId, editLog)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it more safe to use putIfAbsent() method?
| } | ||
|
|
||
| checkRunningTxnExceedLimit(dbId, sourceType); | ||
| checkRunningTxnExceedLimit(dbTransactionMgr, sourceType); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think checkRunningTxnExceedLimit() this method can be moved into the DbTransactionMgr
fe/src/main/java/org/apache/doris/transaction/GlobalTransactionMgr.java
Outdated
Show resolved
Hide resolved
|
@caiconghui I have some comments left. And could you please resolve the conflicts? |
c6fb244 to
4f38eb0
Compare
fe/src/main/java/org/apache/doris/transaction/GlobalTransactionMgr.java
Outdated
Show resolved
Hide resolved
| public DatabaseTransactionMgr getDatabaseTransactioMgr(long dbId) throws AnalysisException { | ||
| DatabaseTransactionMgr dbTransactionMgr = dbIdToDatabaseTransactionMgrs.get(dbId); | ||
| if (dbTransactionMgr == null) { | ||
| throw new AnalysisException("databaseTransactionMgr[" + dbId + "] does not exist"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AnalysisException is not suitable here.
But it can be modified next time
fe/src/main/java/org/apache/doris/transaction/GlobalTransactionMgr.java
Outdated
Show resolved
Hide resolved
fe/src/main/java/org/apache/doris/transaction/GlobalTransactionMgr.java
Outdated
Show resolved
Hide resolved
fe/src/main/java/org/apache/doris/transaction/GlobalTransactionMgr.java
Outdated
Show resolved
Hide resolved
fe/src/main/java/org/apache/doris/transaction/GlobalTransactionMgr.java
Outdated
Show resolved
Hide resolved
| } | ||
| } | ||
| return txnIds; | ||
| return txnInfos.size() > limit ? new ArrayList<>(txnInfos.subList(0, limit)) : txnInfos; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| return txnInfos.size() > limit ? new ArrayList<>(txnInfos.subList(0, limit)) : txnInfos; | |
| return txnInfos.size() > limit ? txnInfos.subList(0, limit) : txnInfos; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@morningman subList is a view of origin list, so is it a good way to directly return sublist?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's OK, cause no one will modify that list.
fe/src/main/java/org/apache/doris/transaction/GlobalTransactionMgr.java
Outdated
Show resolved
Hide resolved
morningman
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…rove txn task performance (apache#3369) This PR is the first step to make Doris stream load more robust with higher concurrent performance(apache#3368),the main work is to support txn management in db level isolation and use ArrayDeque to stored final status txns.
This PR is the first step to make doris stream load more robust with higher concurrent performance(#3368),the main work is to support txn management in db level isolation,and use ArrayDeque to stored final status txns