Database: buffer.lastseenmsgid is greater than the most recent messageid actually recorded for said buffer.
While working on fixing #1249, I discovered that buffer.lastseenmsgid will often be set to a value higher than the most recent actual message.
This causes the unread messages backlog fetcher to be much slower than it would otherwise be.
This issue has been confirmed by me to exist in both my current PostgreSQL database, as well as in an SQLite3 database dump of my core from 2016-02-28.
Others in #quassel have reported the same thing.
You can check if this is the case in your database with the following query (works in both SQLite and PostgreSQL):
SELECT * FROM buffer WHERE lastseenmsgid > (SELECT messageid FROM backlog WHERE backlog.bufferid = buffer.bufferid ORDER BY messageid DESC LIMIT 1);
If that query returns any rows, your database suffers from this issue.
#2 Updated by EgS about 2 years ago
- Subject changed from Database: buffer.lastseenmsgid is greater than the most recent messageid actually recoeded for said buffer. to Database: buffer.lastseenmsgid is greater than the most recent messageid actually recorded for said buffer.
From a functional point of view, this is not a bug. At least, to the best of my knowledge. :)
If I recall correctly, the lastseenmsgid is simply set according to the largest value of the message model in the client. At the time this is done, all messages in the respective buffer have been seen, and since message ids are monotonically increasing, no new message with a lower message id can be added to /any/ buffer. Accordingly, this will not lead to incorrectly mark messages as already seen.
However, I from a performance point of view it makes sense as the index will not match. So, perhaps someone cough want's to supply a patch for this. :) I'm happy to merge an according pull request. Just give me a poke here, via mail, or via github.