Fix long transactions blocking _feed table#5574
Conversation
Can you post of the link to the extension you are using? I cannot accept the approach of this PR as it risks breaking other things, such as the detection of gone articles, count of unread articles, etc. (However, you can put this code in the extension itself, or in another extension, if you accept the drawbacks) It would be interesting to test whether the lock comes from articles that have been updated, as opposed to new articles. We should make sure that our transaction do not block the other operations. See https://dev.mysql.com/doc/refman/8.1/en/innodb-transaction-isolation-levels.html |
The detection of modified articles was wrong for feeds using loadCompleteContent. Indeed, the hash is supposed to computed on the content provided by the server of the RSS feed, excluding further modifications. Furthermore, read hash from database instead of recomputing it all the time. Slightly related to FreshRSS#5574
When the transaction is started, the <user_name>_feed table will be blocked, and any related modification and update operations will be blocked. I used the xExtension-Readable plugin here, for getting the full text. According to the logic of the feedController, the entry_before_insert hook will be executed whether it is updating an article or getting a new article, so both operations will be affected. Both of the following may be time-consuming operations, making the transaction slow. FreshRSS/app/Controllers/feedController.php Line 490 in 6d8a542 FreshRSS/app/Controllers/feedController.php Line 517 in 6d8a542 |
* Fix hash of articles with loadCompleteContent The detection of modified articles was wrong for feeds using loadCompleteContent. Indeed, the hash is supposed to computed on the content provided by the server of the RSS feed, excluding further modifications. Furthermore, read hash from database instead of recomputing it all the time. Slightly related to #5574 * Explicit SQL alias * PHPDocs
|
I am running a test at the moment with PostgreSQL on a use-case resembling yours, with a refresh process that takes several hours due to many entries calling I have also checked the code from https://github.com/printfuck/xExtension-Readable can cannot see anything significantly different than my own teste. So what remains to be done is to compare with MySQL / MariaDB and SQLite. |
Thanks for your test, I test in sqlite, MySQL, PostgreSQL, where sqlite and MySQL block other operations like Toggle favorite or Toggle read. And PostgreSQL is fine. If it is convenient, please help to test sqlite and MySQL. |
Remove `updateTTL` function used to help migration to 5+ year-old FreshRSS 1.10 and FreshRSS 0.7.3 FreshRSS#1750 This function contributed to locking the database FreshRSS#5574 Subset of FreshRSS#3558
Changes proposed in this pull request:
How to test the feature manually:
Pull request checklist:
~~ - [ ] unit tests written (optional if too hard)~~
~~ - [ ] documentation updated~~