Repository navigation
Conversation
A client kept every record of every thread it had visited for its whole lifetime. It now keeps replicas for the selected thread and the four threads left most recently, and drops a deleted thread's at once. A thread that is not selected receives no records, so holding it longer only saves one baseline window. Pages read far above the tail are dropped once the reader has stayed at the tail for 30 seconds, or leaves the thread. The pages the tail itself needed are kept, so nothing dropped is fetched again and the list does not move. Closes #525
archiving_the_viewed_child_returns_to_its_parent waited only for the parent's status, which arrives on its own topic, so on a slow runner the child was opened before any parent record was held and there was nothing to keep. The driver now waits for the conversation to be on screen, as a user would see it, and the test also requires the parent to resume from its cursor.
|
Linux x64 failed |
|
Folded into #591, which carries this commit unchanged as one PR for the whole storage phase. |
Summary
Fourth slice of the storage work in #535, stacked on #588. Closes #525. Client only: no host or protocol change.
The client store no longer holds every thread it has ever visited, nor every page it has ever scrolled up to.
Why a count, not the issue's 5-minute TTL. A thread that is not selected receives no records, so keeping it only saves one baseline window of at most 512 KB on return. A TTL bounds age, not memory: 50 threads visited inside five minutes are all held. A count needs no clock.
Not changed: prepending a page still refolds the held window (0.12 ms at the tail, 38 ms with every page of a 17 MB thread held). What is bounded now is what happens afterwards: returning to the tail, re-selecting and the next scroll-up start from the tail window again. Records arriving live while one thread stays selected for hours are not trimmed. The
Timeline::upsert_itemforward scan (about 57 % of a large fold) is shared with the host and the compaction gate and is left for a separate change.Evidence
Scripted run through the real store and a real host, 50 threads of 0.93 MB each:
visiting_many_threads_keeps_the_replicas_of_the_last_few(real host) andpages_read_far_up_are_released_once_the_reader_stays_at_the_tail(realChatView, phone geometry: rows stay on screen at every step, a 20 s glance keeps the pages, after 30 s the replica equals the tail window with the last row's position unchanged and no refetch). Seven mutations (keep all threads, no drop on delete, no cursor on re-select, no trim, trim the tail's pages too, …) each fail one of the two.An intermittent nextest LEAK report on unrelated
tcode-uiunit tests reproduces on the parent commit (2 of 8 runs) and is not from this change.Merge Danger
Door: two-way
In-memory client state only. Reverting restores the unbounded cache.
Blast Radius: chat-scrolling
phoneexample (needs a paired host), Android, Windows, Linux.