Skip to content
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

Closes #2374: Deadlock when creating HistoryEvents from many connecti… #2424

Closed
wants to merge 1 commit into from

Conversation

gitgoodjhe
Copy link
Contributor

…ons simultaneously

-Write operations are now performed with the regular TaskanEngine and its' SqlSession and TransactionFactory which provides the needed transactionality and doesn't open multiple connections -Read operations are still performed by the TaskanaHistoryEngine

Some additional info on this PR:

for this new check in the TaskanaEngineImpl:
if (transactionFactory.getClass().getSimpleName().equals("SpringManagedTransactionFactory")) {
sessionManager.startManagedSession();
}

SONAR would like to use "instanceof" instead of comparing the class name with a String. Problem is, that we have no dependency at this point in the core, so the SpringManagedTransactionFactory.class is not known

The JobScheduler gets initialized in the TaskanaEngineImpl. Unfortunately, it currently creates its' own TaskanaEngineImpl:
if (this.taskanaConfiguration.isJobSchedulerEnabled()) {
TaskanaConfiguration configuration =
new TaskanaConfiguration.Builder(this.taskanaConfiguration)
.jobSchedulerEnabled(false)
.build();
TaskanaEngine taskanaEngine =
TaskanaEngine.buildTaskanaEngine(configuration, EXPLICIT, transactionFactory);

Issue: The HistoryEventManager (and all other SPis) initialization logic follows at the end of the TaskanaEngineImpl constructor. Therefore the initialize() will get called twice and therefore we need the if checks when adding the mappers in the new initialization logic of the SimpleHistoryServiceImpl, e.g.:
if (!sqlSession
.getConfiguration()
.getMapperRegistry()
.hasMapper(TaskHistoryEventMapper.class)) {
sqlSession.getConfiguration().addMapper(TaskHistoryEventMapper.class);
}


Release Notes:


For the submitter:

Verified by the reviewer:

…onnections simultaneously

-Write operations are now performed with the regular TaskanEngine and its' SqlSession and TransactionFactory which provides the needed transactionality and doesn't open multiple connections
-Read operations are still performed by the TaskanaHistoryEngine
@arolfes
Copy link
Contributor

arolfes commented Nov 17, 2023

Hallo @gitgoodjhe , please sync fork with current master and rebase this PR.

@gitgoodjhe gitgoodjhe closed this Jul 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Commit Hooks won't work without JIRA Tickets
2 participants