Skip to content

Conversation

@caiconghui
Copy link
Contributor

@caiconghui caiconghui commented Apr 21, 2020

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

}

Catalog.getCurrentGlobalTransactionMgr().abortTransaction(request.getTxnId(),
long dbId = Catalog.getInstance().getDb(request.getDb()).getId();
Copy link
Contributor

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");
Copy link
Contributor

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));
Copy link
Contributor

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);
Copy link
Contributor

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

@morningman
Copy link
Contributor

@caiconghui I have some comments left. And could you please resolve the conflicts?

@morningman morningman self-assigned this May 5, 2020
@caiconghui caiconghui force-pushed the db_txn branch 2 times, most recently from c6fb244 to 4f38eb0 Compare May 6, 2020 11:03
@morningman morningman added area/load Issues or PRs related to all kinds of load area/catalog Issues or PRs related to catalog management labels May 7, 2020
public DatabaseTransactionMgr getDatabaseTransactioMgr(long dbId) throws AnalysisException {
DatabaseTransactionMgr dbTransactionMgr = dbIdToDatabaseTransactionMgrs.get(dbId);
if (dbTransactionMgr == null) {
throw new AnalysisException("databaseTransactionMgr[" + dbId + "] does not exist");
Copy link
Contributor

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

}
}
return txnIds;
return txnInfos.size() > limit ? new ArrayList<>(txnInfos.subList(0, limit)) : txnInfos;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return txnInfos.size() > limit ? new ArrayList<>(txnInfos.subList(0, limit)) : txnInfos;
return txnInfos.size() > limit ? txnInfos.subList(0, limit) : txnInfos;

Copy link
Contributor Author

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?

Copy link
Contributor

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.

Copy link
Contributor

@morningman morningman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@morningman morningman added the approved Indicates a PR has been approved by one committer. label May 10, 2020
@morningman morningman merged commit b648734 into apache:master May 11, 2020
@caiconghui caiconghui deleted the db_txn branch May 25, 2020 03:07
@EmmyMiao87 EmmyMiao87 mentioned this pull request Aug 17, 2020
acelyc111 pushed a commit to acelyc111/incubator-doris that referenced this pull request Jan 20, 2021
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by one committer. area/catalog Issues or PRs related to catalog management area/load Issues or PRs related to all kinds of load kind/improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Proposal] Making doris stream load more robust with higher concurrent performance

3 participants