-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Analysis Fixes #1289
Analysis Fixes #1289
Conversation
...even if SoundSources should limit the requested amount if needed.
This allows to conditionally create a DbConnectionPooler within a nested scope.
The initialization of the AnalysisDao with the thread-local database connection was missing. The restricted design of the analyzer API required to move the AnalysisDao from AnalyzeWaveform to AnalyzerQueue.
This fixes both bugs with the waveform analyses for me. Thanks. |
There is a new issue which is minor and not reliably reproducable. Sometimes, I see the waveform loaded from cache immediately, then it seems to be regenerated with a new analysis:
|
The implementation of AnalyzerQueue is not thread-safe. Small changes in timings between the threads might have unintended side effects. Unfortunately this is not the only piece of code in Mixxx that needs to be fixed eventually. |
src/analyzer/analyzerqueue.cpp
Outdated
mixxx::DbConnectionPooler dbConnectionPooler; | ||
if (m_pAnalysisDao) { | ||
// Only create/open a new database connection for when needed | ||
// for storing waveform analyses |
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.
How about:
// m_pAnalysisDao ramains null if no analyzer needs database access.
// currently only waveform analyses makes use of it.
src/util/db/dbconnectionpooler.cpp
Outdated
m_pDbConnectionPool = std::move(other.m_pDbConnectionPool); | ||
// Move assignment should transfer ownership by invalidating | ||
// the other instance. | ||
DEBUG_ASSERT(!other); |
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.
This is hard to understand here, the drawback of operator overloads.
How about replace it by a named function like
DEBUG_ASSERT(!other.initalized());
Or just by
DEBUG_ASSERT(!other.m_pDbConnectionPool)
or just remove the Assert, because it is obvious that it works.
src/analyzer/analyzerqueue.cpp
Outdated
@@ -302,21 +302,22 @@ void AnalyzerQueue::run() { | |||
} | |||
|
|||
void AnalyzerQueue::execThread() { | |||
// The thread-local database connection for waveform anylsis must not | |||
// be closed before returning from this function. Therefore the | |||
// DbConnectionPooler is defined at the outher function scope, |
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.
Typo here. Did you mean "other" or "outer"?
Thank you very much! LGTM |
Fixes the following bugs that have recently been reported:
Might also fix the following bug if it is related to missing waveform analysis:
I wasn't able to reproduce the reported behavior, which might depend on user preference settings.