Read a page of chat history without counting the whole session

Fixkamo-shared-library
Ya
16 Agosti 2026, 01:13 UTC
Mwandishi
Kamo
Ahadi ya
3cc8b30

Spring Data derives a second statement for every Page it returns, and the chat history read asked for one it never looked at: MediaController takes page.getContent() and then reports messages.size() as the count. The derived statement was SELECT COUNT(m1_0.id) FROM media_objs m1_0 LEFT JOIN media_objs_msg m3_0 ON m1_0.id = m3_0.obj_id WHERE m1_0.session_id = ? AND m1_0.is_removed = false — an unindexed aggregate over every object in the session, issued after the transaction had already read, which is precisely the shape YugabyteDB cannot recover from. It can only transparently restart a read that is the FIRST statement in its transaction; a later one raises SQLState 40001 "Restart read required", the transaction is marked rollback-only, and the request 500s. So an open chat window that happened to reload while somebody was writing to the same session showed no history at all, on account of a number that was discarded. The rows now come back as a List, which issues no count. Same query, same order, same page; one statement instead of two. The Page-returning method stays for MediaStreamController, which genuinely serves **************** to the social feed. Every other caller was taking .getContent() and throwing the total away, so the two public-chat sites move across too (MediaService, separate commit).

Mabadiliko yote

Je, unaona nini kuhusu usafiri?

Kila moja ya hizi updates ardhi katika nafasi yako ya kazi moja kwa moja. Kuanza bure na kuangalia kukua wiki baada ya wiki.

Kuwa Huru MileleMtazamo wa bei