-
-
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
Library concurency refactoring #629
Conversation
Conflicts: src/dlgautodj.cpp src/library/bundledsongswebview.cpp src/library/dao/playlistdao.cpp src/library/featuredartistswebview.h src/library/library.cpp src/library/library.h src/library/playlisttablemodel.cpp src/mixxx.cpp src/trackinfoobject.cpp
Conflicts: src/library/analysisfeature.cpp src/library/autodjfeature.cpp src/library/baseexternallibraryfeature.cpp src/library/cratefeature.cpp src/library/libraryfeature.h src/library/mixxxlibraryfeature.cpp src/library/previewbuttondelegate.h src/library/sidebarmodel.cpp src/mixxx.h src/trackinfoobject.cpp
Library-Scanner not working, everything else compiles
This won't compile because of the Library-Scanner. It is not reworked now, as I don't understand It yet. It uses its own DAOs - why? And sometimes it uses those from TrackCollection - Why? |
@troyane would you mind to look at my questions about your LibraryScanner changes? Some are not clear to me. |
Because it uses currently a different thread. This way sq-light allows concurrent access. |
My be it is a good idea to remove the extra instance for the library scanner and use always the lambda. |
I'm currently facing some nested callSync calls which cause a deadlock. Need to investigate this to get it running again |
This seams to be also a common issue that may happens later as well. |
There is one. |
well those nested calls get tricky... that will take a while |
Can you give an example? |
Maybe look at 3add7af there is one of them fixed |
Not its segfaulting. What a crappy little thing |
Well in fact it is a infinite loop in lookupCachedTrack, happening as soon as a track is in the library. screw... |
Do you have the deadlocks in the original files as well? Are you able to single step into the Qt code? If not it might be worth to set it up. An other thought: |
Does any of your commit build? I would like to test. |
It builds. Just Start it. You will geht some Kind Of race condition to a segfault at the Moment i think if im not wrong. Cant look into it right now Am 17. Juni 2015 22:47:21 MESZ, schrieb "Daniel Schürmann" [email protected]:
Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail gesendet. |
Building fails on my site:
|
…oncurencyRefactoring
…oncurencyRefactoring
…oncurencyRefactoring
…oncurencyRefactoring
…oncurencyRefactoring
…oncurencyRefactoring
…oncurencyRefactoring
…oncurencyRefactoring
…oncurencyRefactoring
…oncurencyRefactoring
…oncurencyRefactoring
…oncurencyRefactoring
…oncurencyRefactoring
…oncurencyRefactoring
…oncurencyRefactoring
…oncurencyRefactoring
…oncurencyRefactoring
…439819eb7c080404f852f49ce1fa16' into LibraryConcurencyRefactoring
…oncurencyRefactoring
…oncurencyRefactoring
…oncurencyRefactoring
We will see, how hard it is to fix all bugs. Have this branch in place can't hurt. Squashing all merge commits to one, in a second branch is a good idea. Finally no one needs these hug number of merge commits in the master branch. |
Looking back at this.. wow. From my current perspective, I think its not feasible to go that way with merging further without loosing the head in there. IIRC, the library scanner and other stuff is already heavily broken by that merging here, as one is not able to test that stuff after each merge. IIRC we have to make sure that only a single thread accesses QSql related stuff, and allow to put some more work in asyncronous ways out of the GUI-thread. Maybe we should think about a more step-by-step approach. This PR is aiming to push the db-access to a single thread and also introducing async db access. Maybe we should do it step by step, first consolidate the db-access in a single entry point somewhere in the code, and after that is proven to work implement some asynchronous access methods where needed. I think that will also make the diff smaller and easier to review. Looking at @uklotzde's work on the crate database access in #1099, it could also be a possible solution, to handle the threading problems inside of the FwdSqlQuery or subclasses of it. We could move the execution of that query into a dedicated Database-thread, introduce proper locking there, and get the rest of the code use such derived QSqlQuery classes. Probably not that much has to change, as we can keep the api stable for the query (as long as we stay with syncronus access). We only need to make sure that the code doesn't use plain QSqlQueries from that point on. That point could be merged as is, making smaller steps into master, keeping the diff small. After that is done, we could introduce a Async(Fwd)SqlQuery, that tells it's caller when it is done (probably via callback), and allow him to fetch the data then. I don't know if the real bottleneck for the current responsibility issues with mass-actions is the sql-query or the postprocessing of it. If its postprocessing, we could also allow other code than sql-queries (lambdas?) to be queued into the library-thread, to allow sorting, building tables and stuff from non-gui-thread. For that, trojans queuing and locking code could be reused. Btw.: as 2.1 is on i'ts way I don't want to get anything in there, and don't want to bind dev-ressources anywhere non-necessary for 2.1. But starting to think on that and get to a conclusion how to do it in small, master-mergeble steps would be good I think. |
I don't think that there is a chance to merge this PR. And I'm not convinced that the approach will work as expected. |
Yes, this one was rotting for too long, I am really sorry. |
Even with lambdas you still need to care about thread-safety and concurrency issues. Wrapping arbitrary code with references to GUI classes into lambdas and executing them in another thread's context sometimes later does not sound like a good idea to me. It may be fast, but is is correct and safe? Qt's queued signal/slot connections might be useful here. Passing immutable data from one thread is at least safe, albeit with some overhead. I already started to separate the main track select query with such an approach, but didn't have time to complete it, yet. Stay tuned ;) |
This pull request has not been updated in years, has accumulated tons of merge conflicts, and there seem to be concerns about its fundamental approach so I am closing it to reduce the clutter of open PRs. |
#73
Trojans GSOC project (Async DB access) reworked to split TrackCollection to public and private part.