This is an automated email from the git hooks/post-receive script.
git pushed a commit to reference refs/pull/73/head
in repository terminology.
View the commit online.
commit ce4c8a60d638b575f24b0facaf48d02a34864661
Author: Cedric BAIL <[email protected]>
AuthorDate: Sat Nov 21 01:05:08 2026 -0600
backlog_store: never wait for a head compression to append
An append to a head whose compression job was running took the head
back with _job_abandon(), which blocks the main loop until the worker
is done reading the cells: a terminal printing again right after it
went quiet stalled for as long as zlib took on up to a whole page.
The job only reads the cells before the newest entry, and appends write
after them, so an append now only discards the job: its end leaves the
head RAW, frees the blob, and the head waits to be quiet again before
another try. Only a growth could move the mapping under the worker.
The head then gets a new mapping and the job keeps the old one, which
it unmaps at its end. An ANON head copies its cells. A MEMFD head maps
its own memfd again, with mremap() of an old size of 0, rather than a
new memfd: a client sent the head's fd during the compression keeps
following the appends. Reading the newest entry no longer waits either;
pop and page_dirty still do.
---
src/bin/backlog_store.c | 505 +++++++++++++++++++++++++++++++++++++++++++++++-
src/bin/backlog_store.h | 15 +-
src/bin/tytest.c | 6 +
src/bin/unit_tests.h | 3 +
4 files changed, 517 insertions(+), 12 deletions(-)
diff --git a/src/bin/backlog_store.c b/src/bin/backlog_store.c
index 30c4c283..39c26942 100644
--- a/src/bin/backlog_store.c
+++ b/src/bin/backlog_store.c
@@ -123,8 +123,8 @@ typedef struct
BacklogStore *bs; /* NULL once the store is gone */
uint32_t page_id;
/* the worker reads the cells through the page mapping: when the store
- * goes first, it hands that mapping over, and the job unmaps it once it
- * ends */
+ * goes first, or the head grows away from it, it hands that mapping
+ * over, and the job unmaps it once it ends */
const TermSrvCell *cells;
void *orphan_map;
size_t orphan_size;
@@ -132,6 +132,8 @@ typedef struct
/* started to free a memfd: what compression does not help is copied */
Eina_Bool pressure;
Eina_Bool copy_only;
+ /* the head was appended to: its job ends with the page RAW */
+ Eina_Bool discarded;
Eina_Bool poor; /* compression was not worth it */
Eina_Binbuf *blob;
Eina_Binbuf *raw; /* the copy of the cells, if poor under pressure */
@@ -557,6 +559,9 @@ _map_resize(void *map, size_t size, size_t new_size, int fd)
return got;
}
+static void *_head_grow_aside(BacklogStore *bs, BacklogStorePage *head,
+ size_t size);
+
/* Makes the head map at least its first bytes, doubling what it maps up to
* a whole page. Its mapping may move; the moved callback is told of every
* growth. */
@@ -584,6 +589,8 @@ _page_grow(BacklogStore *bs, BacklogStorePage *page, size_t bytes)
map = NULL;
}
}
+ else if (page->state == PAGE_COMPRESSING)
+ map = _head_grow_aside(bs, page, size);
else
map = _map_resize(page->header, page->map_size, size, page->fd);
if (!map)
@@ -649,6 +656,9 @@ static Eina_Bool _test_fail_page, _test_fail_refs;
* be released, if there is one. */
static Eina_Semaphore *_test_restore_hold;
static _Atomic int _test_restore_running;
+/* The same, for a compression worker once it claimed its job. */
+static Eina_Semaphore *_test_job_hold;
+static _Atomic int _test_job_running;
void
backlog_store_test_fail_next_page(void)
@@ -1064,6 +1074,8 @@ backlog_store_free(BacklogStore *bs)
BacklogStorePage *page = _page_find(bs, job->page_id);
job->bs = NULL;
+ if (job->orphan_map)
+ continue;
if (!page)
{
ERR("no page %u for its compression job", job->page_id);
@@ -1108,10 +1120,13 @@ static BacklogStoreRestore *_restore_new(BacklogStore *bs,
BacklogStorePage *page);
static void _restore_run(BacklogStoreRestore *restore);
+static void _job_discard(BacklogStore *bs, BacklogStorePage *page);
+
/* Make the head writable, its newest entry readable, before it is written
- * to or read: a compressed head starts its restore, the cells before its
- * newest entry come back later. This waits for a running compression job,
- * or if the restore cannot start, expands the head on the main loop. */
+ * to or read: a head being compressed is left to its job, whose result
+ * will be discarded, a compressed head starts its restore, the cells
+ * before its newest entry come back later. If the restore cannot start,
+ * this expands the head on the main loop. */
static Eina_Bool
_head_restore(BacklogStore *bs, BacklogStorePage *head)
{
@@ -1120,6 +1135,11 @@ _head_restore(BacklogStore *bs, BacklogStorePage *head)
if (EINA_LIKELY(head->state == PAGE_RAW) ||
(head->state == PAGE_RESTORING))
return EINA_TRUE;
+ if (head->state == PAGE_COMPRESSING)
+ {
+ _job_discard(bs, head);
+ return EINA_TRUE;
+ }
if (head->state == PAGE_COMPRESSED)
{
restore = _restore_new(bs, head);
@@ -2182,6 +2202,11 @@ _job_worker(void *data, Ecore_Thread *thread EINA_UNUSED)
if (!atomic_compare_exchange_strong(&job->claim, &queued, JOB_RUNNING))
return;
+#if defined(BINARY_TYTEST)
+ atomic_store(&_test_job_running, 1);
+ if (_test_job_hold)
+ eina_semaphore_lock(_test_job_hold);
+#endif
if (job->copy_only)
job->poor = EINA_TRUE;
else
@@ -2220,7 +2245,10 @@ _job_end(void *data, Ecore_Thread *thread EINA_UNUSED)
BacklogStorePage *page = _page_find(bs, job->page_id);
bs->jobs = eina_list_remove(bs->jobs, job);
- if (page && page->state == PAGE_COMPRESSING)
+ /* the head was appended to meanwhile: the blob is stale */
+ if (page && (page->state == PAGE_COMPRESSING) && job->discarded)
+ page->state = PAGE_RAW;
+ else if (page && page->state == PAGE_COMPRESSING)
{
page->state = PAGE_RAW;
if (job->poor)
@@ -2384,6 +2412,99 @@ _job_abandon(BacklogStore *bs, BacklogStorePage *page)
return EINA_TRUE;
}
+static BacklogStoreJob *
+_job_find(BacklogStore *bs, uint32_t page_id)
+{
+ BacklogStoreJob *job;
+ Eina_List *l;
+
+ EINA_LIST_FOREACH(bs->jobs, l, job)
+ {
+ if (job->page_id == page_id)
+ return job;
+ }
+ ERR("no compression job for page %u", page_id);
+ return NULL;
+}
+
+/* An append to a head being compressed makes its job's result stale: the
+ * job ends with the head RAW. The appends write after the cells the
+ * worker reads, so nothing waits for it. The tail copy goes at once: the
+ * newest entry may change, and the mapping holds it. */
+static void
+_job_discard(BacklogStore *bs, BacklogStorePage *page)
+{
+ BacklogStoreJob *job;
+
+ /* only a job that was not discarded yet has a tail copy */
+ if (!page->tail)
+ return;
+ _page_tail_drop(page);
+ job = _job_find(bs, page->id);
+ if (job)
+ job->discarded = EINA_TRUE;
+}
+
+/* A new mapping of size bytes of the head, the old one left as it is: a
+ * MEMFD head maps its memfd again, which clients keep following, an ANON
+ * head copies its cells. Returns NULL on failure. */
+static void *
+_head_map_aside(const BacklogStore *bs, const BacklogStorePage *head,
+ size_t size)
+{
+ void *map;
+
+#if defined(BINARY_TYTEST)
+ if (_test_fail_page)
+ {
+ _test_fail_page = EINA_FALSE;
+ ERR("cannot map page %u of '%s' aside", head->id, bs->name);
+ return NULL;
+ }
+#endif
+ if (bs->backing == BACKLOG_STORE_MEMFD)
+ {
+#if defined(__linux__)
+ /* an old size of 0 maps the pages of a shared mapping again, with
+ * its write access: the memfd is sealed against a new one */
+ map = mremap(head->header, 0, size, MREMAP_MAYMOVE);
+ if (map != MAP_FAILED)
+ return map;
+ ERR("mremap: %s", strerror(errno));
+#endif
+ return NULL;
+ }
+ map = _page_anon_map(size);
+ if (map)
+ memcpy(map, head->header, head->header_size +
+ (size_t)bs->head_cells * sizeof(TermSrvCell));
+ return map;
+}
+
+/* Grow a head being compressed to size bytes without moving the mapping
+ * that its worker reads: the head gets a new mapping, and the job the old
+ * one, to unmap once it ends. If that cannot be done, this waits for the
+ * worker and grows the head as usual. */
+static void *
+_head_grow_aside(BacklogStore *bs, BacklogStorePage *head, size_t size)
+{
+ BacklogStoreJob *job = _job_find(bs, head->id);
+ void *map;
+
+ if (!job || job->orphan_map)
+ return _map_resize(head->header, head->map_size, size, head->fd);
+ map = _head_map_aside(bs, head, size);
+ if (!map)
+ {
+ if (!_job_abandon(bs, head))
+ return NULL;
+ return _map_resize(head->header, head->map_size, size, head->fd);
+ }
+ job->orphan_map = head->header;
+ job->orphan_size = head->map_size;
+ return map;
+}
+
/* Make a sealed page writable again, to be the head, or a head RAW. A
* COMPRESSED page takes its rebuilt page as its own, which those it was
* handed to keep reading. This waits for zlib. */
@@ -6523,4 +6644,376 @@ tytest_backlog_store_head_restore_sealed(void)
_test_backings_run(_test_head_restore_sealed);
return 0;
}
+
+/* Holds the next compression worker once it claimed its job: the worker
+ * then reads the cells only once the hold is released. A watchdog
+ * releases it after a few seconds and sets fired, so that a main loop
+ * waiting for that worker fails the test instead of hanging it. */
+typedef struct
+{
+ Eina_Semaphore sem;
+ Eina_Thread watchdog;
+ _Atomic int released;
+ _Atomic int fired;
+} Test_Job_Hold;
+
+static void *
+_test_job_watchdog(void *data, Eina_Thread t EINA_UNUSED)
+{
+ Test_Job_Hold *hold = data;
+ int i;
+
+ for (i = 0; i < 500 && !atomic_load(&hold->released); i++)
+ usleep(10000);
+ if (!atomic_load(&hold->released))
+ {
+ atomic_store(&hold->fired, 1);
+ eina_semaphore_release(&hold->sem, 1);
+ }
+ return NULL;
+}
+
+static void
+_test_job_hold_start(Test_Job_Hold *hold)
+{
+ memset(hold, 0, sizeof(*hold));
+ assert(eina_semaphore_new(&hold->sem, 0));
+ atomic_store(&_test_job_running, 0);
+ _test_job_hold = &hold->sem;
+ assert(eina_thread_create(&hold->watchdog, EINA_THREAD_NORMAL, -1,
+ _test_job_watchdog, hold));
+}
+
+static void
+_test_job_hold_wait_running(void)
+{
+ double until = ecore_time_get() + 10.0;
+
+ while (!atomic_load(&_test_job_running))
+ {
+ assert(ecore_time_get() < until);
+ usleep(100);
+ }
+}
+
+static void
+_test_job_hold_end(Test_Job_Hold *hold)
+{
+ if (!atomic_load(&hold->fired))
+ eina_semaphore_release(&hold->sem, 1);
+ atomic_store(&hold->released, 1);
+ eina_thread_join(hold->watchdog);
+}
+
+static void
+_test_job_hold_free(Test_Job_Hold *hold)
+{
+ _test_job_hold = NULL;
+ eina_semaphore_free(&hold->sem);
+}
+
+/* A single page store whose head holds TEST_RESTORE_ENTRIES entries of
+ * _test_head_fill(), being compressed by a worker held by hold. */
+static BacklogStore *
+_test_head_compressing_new(BacklogStoreBacking backing, Test_Job_Hold *hold)
+{
+ BacklogStore *bs = backlog_store_new("test", backing,
+ TEST_RESTORE_SCROLLBACK);
+ double now = ecore_loop_time_get();
+
+ assert(bs);
+ _test_head_fill(bs, 0, TEST_RESTORE_ENTRIES);
+ _test_job_hold_start(hold);
+ backlog_store_maintain(bs, now);
+ backlog_store_maintain(bs, now + BACKLOG_QUIET_SECONDS);
+ assert(eina_list_count(bs->jobs) == 1);
+ assert(_page_find(bs, 0)->state == PAGE_COMPRESSING);
+ _test_job_hold_wait_running();
+ return bs;
+}
+
+/* Test: getting the newest entry of a head being compressed, which may be
+ * written to, and appending to it, return without waiting for the worker.
+ * Either discards the job, whose end leaves the head RAW, its entries
+ * intact, and not compressed again before it is quiet. */
+static void
+_test_head_compressing_append(BacklogStoreBacking backing)
+{
+ const uint32_t n = TEST_RESTORE_ENTRIES;
+ const TermSrvBacklogPage *mapped;
+ BacklogStorePage *head;
+ Test_Job_Hold hold;
+ BacklogStore *bs;
+ Termcell *newest;
+ uint32_t w, page_id;
+ double now;
+
+ ecore_init();
+ bs = _test_head_compressing_new(backing, &hold);
+ head = _page_find(bs, 0);
+ mapped = head->header;
+ newest = backlog_store_newest_get(bs, &w, &page_id);
+ assert(!atomic_load(&hold.fired));
+ assert((w == TEST_HEAD_ROW_W) && (page_id == 0));
+ assert(newest ==
+ (Termcell *)_test_page_cells(mapped) + (n - 1) * TEST_HEAD_ROW_W);
+ assert((head->state == PAGE_COMPRESSING) && !head->tail);
+ assert(_test_job_find(bs, 0)->discarded);
+ _test_head_tail_check(bs, n - 1);
+
+ _test_head_fill(bs, n, 1);
+ assert(!atomic_load(&hold.fired));
+ head = _page_find(bs, 0);
+ assert((head->state == PAGE_COMPRESSING) && !head->tail);
+ assert(head->header == mapped);
+ _test_head_tail_check(bs, n);
+ _test_head_rows_check(mapped, n + 1);
+
+ _test_job_hold_end(&hold);
+ _test_jobs_wait(bs);
+ _test_job_hold_free(&hold);
+ head = _page_find(bs, 0);
+ assert(head->state == PAGE_RAW);
+ assert(!head->blob && !head->tail);
+ assert((head->attempts == 0) && !head->compress_poor);
+ _test_head_check(bs, n + 1);
+ assert(_page_find(bs, 0)->header == mapped);
+
+ now = ecore_loop_time_get();
+ backlog_store_maintain(bs, now);
+ backlog_store_maintain(bs, now + BACKLOG_QUIET_SECONDS - 1.0);
+ assert(!bs->jobs);
+ backlog_store_maintain(bs, now + BACKLOG_QUIET_SECONDS);
+ assert(eina_list_count(bs->jobs) == 1);
+ _test_jobs_wait(bs);
+ assert(_page_find(bs, 0)->state == PAGE_COMPRESSED);
+ _test_head_check(bs, n + 1);
+ backlog_store_free(bs);
+
+ /* newest_get alone discards the job too */
+ bs = _test_head_compressing_new(backing, &hold);
+ assert(backlog_store_newest_get(bs, &w, &page_id));
+ assert(!atomic_load(&hold.fired));
+ _test_job_hold_end(&hold);
+ _test_jobs_wait(bs);
+ _test_job_hold_free(&hold);
+ head = _page_find(bs, 0);
+ assert((head->state == PAGE_RAW) && !head->blob && !head->tail);
+ _test_head_check(bs, n);
+ backlog_store_free(bs);
+ ecore_shutdown();
+}
+
+int
+tytest_backlog_store_head_compressing_append(void)
+{
+ _test_backings_run(_test_head_compressing_append);
+ return 0;
+}
+
+/* Append rows of _test_big_row() from *k on until the head grows. */
+static void
+_test_head_big_fill_until_grown(BacklogStore *bs, Termcell *big, uint32_t *k)
+{
+ size_t map_size = _page_find(bs, 0)->map_size;
+
+ do
+ {
+ _test_big_row(big, *k);
+ assert(backlog_store_append(bs, big, TEST_RESTORE_BIG_W,
+ BACKLOG_STORE_NEW, EINA_TRUE, NULL));
+ (*k)++;
+ }
+ while (_page_find(bs, 0)->map_size == map_size);
+ assert(backlog_store_count(bs) == 1);
+}
+
+/* Compare page with what _test_head_compressing_grow() appended: the
+ * entries of _test_head_fill(), then count of _test_big_row(), the last
+ * one extended by ext more. */
+static void
+_test_head_big_check(const TermSrvBacklogPage *page, uint32_t count,
+ uint32_t ext)
+{
+ const TermSrvCell *cells = _test_page_cells(page);
+ uint32_t j, entry = TEST_RESTORE_ENTRIES + count - 1, off;
+
+ assert(atomic_load(&page->num_entries) == TEST_RESTORE_ENTRIES + count);
+ _test_head_entries_check(page, 0, TEST_RESTORE_ENTRIES);
+ _test_big_rows_check(page, count - 1);
+ off = _test_off(page)[entry];
+ assert(off == TEST_RESTORE_ENTRIES * TEST_HEAD_ROW_W +
+ (count - 1) * TEST_RESTORE_BIG_W);
+ assert(atomic_load(&_test_w(page)[entry]) ==
+ (1 + ext) * TEST_RESTORE_BIG_W);
+ for (j = 0; j < (1 + ext) * TEST_RESTORE_BIG_W; j++)
+ assert(cells[off + j].codepoint ==
+ 0x100000 + (count - 1) * TEST_RESTORE_BIG_W + j);
+}
+
+/* Test: a head that must grow while it is being compressed moves to a new
+ * mapping of its cells without waiting for the worker, which keeps
+ * reading the old one and unmaps it once it ends. The growth after that
+ * leaves the old mapping alone. Clients of a MEMFD store keep following
+ * the head in the memfd they got. */
+static void
+_test_head_compressing_grow(BacklogStoreBacking backing)
+{
+ const uint32_t n = TEST_RESTORE_ENTRIES;
+ const TermSrvBacklogPage *old, *moved, *client = NULL;
+ Test_Blockers blockers;
+ BacklogStoreJob *job;
+ Test_Job_Hold hold;
+ BacklogStore *bs;
+ Termcell *big;
+ size_t old_size, moved_size;
+ uint32_t k = 0, ext = 0, memfds;
+ int fd;
+
+ ecore_init();
+ big = malloc(TEST_RESTORE_BIG_W * sizeof(Termcell));
+ assert(big);
+ bs = _test_head_compressing_new(backing, &hold);
+ job = _test_job_find(bs, 0);
+ assert(job);
+ old = _page_find(bs, 0)->header;
+ old_size = _page_find(bs, 0)->map_size;
+ fd = _page_find(bs, 0)->fd;
+#if defined(__linux__)
+ if (backing == BACKLOG_STORE_MEMFD)
+ {
+ assert(backlog_store_page_fd(bs, 0) == fd);
+ client = mmap(NULL, bs->geo.page_size, PROT_READ, MAP_SHARED, fd, 0);
+ assert(client != MAP_FAILED);
+ }
+#endif
+ memfds = _memfds;
+ _test_moved_calls = 0;
+ backlog_store_moved_cb_set(bs, _test_moved_cb, NULL);
+
+ _test_head_big_fill_until_grown(bs, big, &k);
+ assert(!atomic_load(&hold.fired));
+ moved = _page_find(bs, 0)->header;
+ assert(moved != old);
+ moved_size = _page_find(bs, 0)->map_size;
+ assert(_page_find(bs, 0)->state == PAGE_COMPRESSING);
+ assert(moved_size > old_size);
+ assert((job->orphan_map == old) && (job->orphan_size == old_size));
+ assert((_test_moved_calls >= 1) && (_test_moved_id == 0));
+ assert(_memfds == memfds);
+ assert(_page_find(bs, 0)->fd == fd);
+ assert(backlog_store_page_get(bs, 0) == moved);
+ assert(atomic_load(&moved->num_entries) == n + k);
+ _test_head_entries_check(moved, 0, n);
+ _test_big_rows_check(moved, k);
+ /* the worker still reads it */
+ _test_head_entries_check(old, 0, n);
+ if (client)
+ _test_big_rows_check(client, k);
+
+ /* later growth is the usual one; the newest entry grows, as a page
+ * holds too few entries for another growth */
+ while (_page_find(bs, 0)->map_size == moved_size)
+ {
+ _test_big_row(big, k + ext);
+ assert(backlog_store_append(bs, big, TEST_RESTORE_BIG_W,
+ BACKLOG_STORE_EXTEND, EINA_TRUE, NULL));
+ ext++;
+ }
+ assert(!atomic_load(&hold.fired));
+ assert(backlog_store_count(bs) == 1);
+ assert((job->orphan_map == old) && (job->orphan_size == old_size));
+ moved = _page_find(bs, 0)->header;
+
+ _test_job_hold_end(&hold);
+ _test_jobs_wait(bs);
+ _test_job_hold_free(&hold);
+ assert(_page_find(bs, 0)->state == PAGE_RAW);
+ assert(!_page_find(bs, 0)->blob);
+ assert(_page_find(bs, 0)->header == moved);
+ assert(_memfds == memfds);
+ _test_head_big_check(moved, k, ext);
+ if (client)
+ {
+ _test_head_big_check(client, k, ext);
+ munmap((void *)client, bs->geo.page_size);
+ }
+ backlog_store_free(bs);
+
+ /* without a new mapping, the growth takes the head back from its job,
+ * which has not started */
+ bs = backlog_store_new("test", backing, TEST_RESTORE_SCROLLBACK);
+ assert(bs);
+ _test_head_fill(bs, 0, n);
+ _test_blockers_start(&blockers);
+ backlog_store_maintain(bs, ecore_loop_time_get());
+ backlog_store_maintain(bs, ecore_loop_time_get() + BACKLOG_QUIET_SECONDS);
+ job = _test_job_find(bs, 0);
+ assert(job);
+ k = 0;
+ backlog_store_test_fail_next_page();
+ _test_head_big_fill_until_grown(bs, big, &k);
+ assert(!_test_fail_page);
+ assert((job->claim == JOB_ABANDONED) && !job->bs && !job->orphan_map);
+ assert(_page_find(bs, 0)->state == PAGE_RAW);
+ assert(!_page_find(bs, 0)->tail);
+ _test_head_big_check(_page_find(bs, 0)->header, k, 0);
+ _test_blockers_end(&blockers);
+ _test_jobs_wait(NULL);
+ assert(_page_find(bs, 0)->state == PAGE_RAW);
+ _test_head_big_check(_page_find(bs, 0)->header, k, 0);
+ backlog_store_free(bs);
+ free(big);
+ ecore_shutdown();
+}
+
+int
+tytest_backlog_store_head_compressing_grow(void)
+{
+ _test_backings_run(_test_head_compressing_grow);
+ return 0;
+}
+
+/* Test: a store freed while its head is being compressed leaves the
+ * mapping the worker reads to the job, whether the head was left alone,
+ * appended to, or moved by a growth. */
+static void
+_test_head_compressing_free(BacklogStoreBacking backing)
+{
+ unsigned int jobs_alive = _jobs_alive;
+ Test_Job_Hold hold;
+ BacklogStore *bs;
+ Termcell *big;
+ uint32_t k = 0;
+ int pass;
+
+ ecore_init();
+ big = malloc(TEST_RESTORE_BIG_W * sizeof(Termcell));
+ assert(big);
+ for (pass = 0; pass < 3; pass++)
+ {
+ bs = _test_head_compressing_new(backing, &hold);
+ if (pass >= 1)
+ _test_head_fill(bs, TEST_RESTORE_ENTRIES, 1);
+ if (pass == 2)
+ _test_head_big_fill_until_grown(bs, big, &k);
+ assert(!atomic_load(&hold.fired));
+ backlog_store_free(bs);
+ assert(_jobs_alive == jobs_alive + 1);
+ _test_job_hold_end(&hold);
+ _test_jobs_wait(NULL);
+ _test_job_hold_free(&hold);
+ assert(_jobs_alive == jobs_alive);
+ }
+ assert(backlog_store_raw_fds_get() == 0);
+ free(big);
+ ecore_shutdown();
+}
+
+int
+tytest_backlog_store_head_compressing_free(void)
+{
+ _test_backings_run(_test_head_compressing_free);
+ return 0;
+}
#endif
diff --git a/src/bin/backlog_store.h b/src/bin/backlog_store.h
index ef4b3221..6098f241 100644
--- a/src/bin/backlog_store.h
+++ b/src/bin/backlog_store.h
@@ -69,11 +69,13 @@ typedef enum
* starts a new one: it does when backlog_store_pop() emptied the head.
* refs tells whether the cells may hold hyperlink ids or blocks, which the
* store then counts: without, they are not looked at, and must hold none.
- * What was done is told in *saved, unless it is NULL. Appending to a
- * compressed head starts its restore: if its thread cannot start, the
- * restore ends at once, and the prefetch callback and the waiters of
- * backlog_store_page_fd_async() are called from within this call, as they
- * may be from page_get, newest_get, page_prefetch and page_fd_async.
+ * What was done is told in *saved, unless it is NULL. Appending to a head
+ * being compressed never waits for the compression, whose result is then
+ * dropped. Appending to a compressed head starts its restore: if its
+ * thread cannot start, the restore ends at once, and the prefetch callback
+ * and the waiters of backlog_store_page_fd_async() are called from within
+ * this call, as they may be from page_get, newest_get, page_prefetch and
+ * page_fd_async.
* Returns EINA_FALSE if the row could not be stored. */
Eina_Bool backlog_store_append(BacklogStore *bs, const Termcell *cells,
ssize_t w, BacklogStoreJoin join,
@@ -115,7 +117,8 @@ const Termcell *backlog_store_head_tail_get(const BacklogStore *bs,
/* Tell the store that cells of page_id were written to, through a mapping
* that backlog_store_page_get() returned: a compressed copy of the page is
- * stale, and is dropped. A head being restored is waited for. */
+ * stale, and is dropped. A head being compressed or restored is waited
+ * for. */
void backlog_store_page_dirty(BacklogStore *bs, uint32_t page_id);
/* The bytes that the store's pages use: the cells and headers of the raw
diff --git a/src/bin/tytest.c b/src/bin/tytest.c
index 4ea7797f..b7fd9be4 100644
--- a/src/bin/tytest.c
+++ b/src/bin/tytest.c
@@ -210,6 +210,12 @@ static struct {
tytest_backlog_store_head_restore_free},
{ "backlog_store_head_restore_sealed",
tytest_backlog_store_head_restore_sealed},
+ { "backlog_store_head_compressing_append",
+ tytest_backlog_store_head_compressing_append},
+ { "backlog_store_head_compressing_grow",
+ tytest_backlog_store_head_compressing_grow},
+ { "backlog_store_head_compressing_free",
+ tytest_backlog_store_head_compressing_free},
{ "backlog_view_sync", tytest_backlog_view_sync},
{ "backlog_view_ring_full", tytest_backlog_view_ring_full},
{ "backlog_view_map_again", tytest_backlog_view_map_again},
diff --git a/src/bin/unit_tests.h b/src/bin/unit_tests.h
index 32530687..9459a49b 100644
--- a/src/bin/unit_tests.h
+++ b/src/bin/unit_tests.h
@@ -154,6 +154,9 @@ int tytest_backlog_store_head_restore_request(void);
int tytest_backlog_store_head_restore_extend(void);
int tytest_backlog_store_head_restore_free(void);
int tytest_backlog_store_head_restore_sealed(void);
+int tytest_backlog_store_head_compressing_append(void);
+int tytest_backlog_store_head_compressing_grow(void);
+int tytest_backlog_store_head_compressing_free(void);
int tytest_backlog_view_sync(void);
int tytest_backlog_view_ring_full(void);
int tytest_backlog_view_map_again(void);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.