title | target-version |
---|---|
housekeeping |
0.2.1 |
We provide Garbage Collection to purge tombstones and prevent the problem of documents growing.
However, when there are clients that has been editing old documents but have not been used for a long time, garbage collection becomes less efficient.
To solve this problem, we implement a housekeeping service that deactivates outdated clients.
Implement a housekeeping service that deactivates outdated clients.
If there are outdated clients, garbage collection becomes less efficient.
In this example, client c1
is outdated, the tombstone which has a
as its contents can not be purged because it is still being referenced by c1
.
Agent periodically fetches outdated clients from the database. If the update times of clients are older than a certain threshold, the clients are candidates for deactivation.
In the deactivation process, the documents of the candidates are detached and
all synced_seq
s of the clients removed from synced_seqs
collection.
As a result, when calculating min_synced_seq
to include in PushPull's
response, old synced_seq
are removed so that relatively recently deleted
tombstones can be purged.
In the above example, client c1
is deactivated, the tombstone which has
a
can be purged because it is not being referenced by c1
.