Skip to content

Allow efficient trimming of history #77

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 41 commits into
base: main
Choose a base branch
from

Conversation

asteppke
Copy link

Currently when using the SQL backend of the ystore the complete document history is stored by default. If the document_ttl parameter is set under the specific condition that the time difference between the most recent update and the current update is larger than document_ttl all history is squashed.

At the moment this does not reduce the size of the database and in case of changes to the document that occur relatively regularly no squashing ever takes place.

This is a draft for discussion of how an effective trimming and limiting of the history size could be achieved. This would address the request to trim the database (#60) and might also influence the decision to disable the saving of the database (jupyterlab/jupyter-collaboration#244).

To achieve we introduce a new parameter, the history_length which limits the age of the oldest entries in the database. All older entries get squashed. Additionally to trim the size of the database deleted entries are vacuumed. This preserves the functionality of the database, e.g. if a client is missing updates we can provide them from the database up to the given age limit. At the same time the total size does not increase infinitely. This is especially important in contexts where the database is counted towards user quotas.

asteppke and others added 8 commits October 10, 2024 21:08
* Start the server awareness

* Stop the awareness

* Apply suggestions from review

Co-authored-by: David Brochart <[email protected]>

* Stop awareness on error

---------

Co-authored-by: David Brochart <[email protected]>
Co-authored-by: David Brochart <[email protected]>
SHA256 hashes:

pycrdt_websocket-0.15.1-py3-none-any.whl: 4b5c5a7001358b61b14b3ac1c4a13db1d05678f35836e9e5ee829228ce736caf

pycrdt_websocket-0.15.1.tar.gz: a20b6c6c4926c57176c23bdaee79b064297c50acd251b55f29c7a9ee7068a6c8
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.6.9 → v0.7.0](astral-sh/ruff-pre-commit@v0.6.9...v0.7.0)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
@asteppke
Copy link
Author

@davidbrochart @brichet
Any thoughts regarding this approach or comments how to deal with the growing database otherwise? Thanks!

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.7.0 → v0.7.1](astral-sh/ruff-pre-commit@v0.7.0...v0.7.1)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
@davidbrochart
Copy link
Contributor

Thanks for the PR @asteppke.
It could be nice to support multiple strategies for handling the database size, one of which could be the history length. Alternatively, we could have a strategy where we ensure the database size doesn't exceed a given size, since this is really what we care about in the end. What do you think?

@asteppke
Copy link
Author

Thanks for looking into this approach and your suggestion. I agree that the size of the database is a good input for a trimming strategy.

At first glance it seems that sqlite is supporting to query the database size directly, so that should be easy to add. I will have a look in the next days how to incorporate this and then update the merge request here.

pre-commit-ci bot and others added 18 commits November 4, 2024 22:17
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.7.1 → v0.7.2](astral-sh/ruff-pre-commit@v0.7.1...v0.7.2)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.7.2 → v0.7.3](astral-sh/ruff-pre-commit@v0.7.2...v0.7.3)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.7.3 → v0.7.4](astral-sh/ruff-pre-commit@v0.7.3...v0.7.4)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.7.4 → v0.8.0](astral-sh/ruff-pre-commit@v0.7.4...v0.8.0)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.8.0 → v0.8.1](astral-sh/ruff-pre-commit@v0.8.0...v0.8.1)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.8.1 → v0.8.2](astral-sh/ruff-pre-commit@v0.8.1...v0.8.2)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
SHA256 hashes:

pycrdt_websocket-0.15.2-py3-none-any.whl: a730fa981a2d68237959652facf9170569986b51c46a43bb158bad998774b07b

pycrdt_websocket-0.15.2.tar.gz: 164a686269a61fe42f0ad78a2cef193acbac570238761b3450e6791c003753ed
SHA256 hashes:

pycrdt_websocket-0.15.3-py3-none-any.whl: 239eafb896b5ab4718d8067dbdbeb892a4cf701b3578019a03ad6161a10305b7

pycrdt_websocket-0.15.3.tar.gz: 8f5a487a921cdf45406e0b49e0876e60f840bcc8dcc5a731c48ec95c9c3ba3cc
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.8.2 → v0.8.3](astral-sh/ruff-pre-commit@v0.8.2...v0.8.3)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.8.3 → v0.8.4](astral-sh/ruff-pre-commit@v0.8.3...v0.8.4)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.8.4 → v0.8.6](astral-sh/ruff-pre-commit@v0.8.4...v0.8.6)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.8.6 → v0.9.1](astral-sh/ruff-pre-commit@v0.8.6...v0.9.1)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.9.1 → v0.9.2](astral-sh/ruff-pre-commit@v0.9.1...v0.9.2)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Increase pycrdt compatible version range

* Add type annotation

---------

Co-authored-by: David Brochart <[email protected]>
davidbrochart and others added 6 commits January 23, 2025 16:37
SHA256 hashes:

pycrdt_websocket-0.15.4-py3-none-any.whl: 63c257cf67bfeade5d9943f98856aacd564f75586c8d696f06a957622e1fb152

pycrdt_websocket-0.15.4.tar.gz: 46612b3580aa70b70fbf20b0adc0b4afec6d95d3bde142739ef26e74dacf4c9e
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.9.2 → v0.9.3](astral-sh/ruff-pre-commit@v0.9.2...v0.9.3)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.9.3 → v0.9.4](astral-sh/ruff-pre-commit@v0.9.3...v0.9.4)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.9.4 → v0.9.6](astral-sh/ruff-pre-commit@v0.9.4...v0.9.6)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.9.6 → v0.9.7](astral-sh/ruff-pre-commit@v0.9.6...v0.9.7)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.9.7 → v0.9.9](astral-sh/ruff-pre-commit@v0.9.7...v0.9.9)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
pre-commit-ci bot and others added 8 commits March 11, 2025 08:59
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.9.9 → v0.9.10](astral-sh/ruff-pre-commit@v0.9.9...v0.9.10)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.9.10 → v0.11.0](astral-sh/ruff-pre-commit@v0.9.10...v0.11.0)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.11.0 → v0.11.2](astral-sh/ruff-pre-commit@v0.11.0...v0.11.2)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants