| Commit message (Collapse) | Author | Age | Files | Lines |
| ... | |
| |
|
|
|
|
|
|
| |
This commit implements support for adding arbitrary documents into the
store table.
It is non-trivial because the relevant data has to be compressed into
various formats, so it can be retrieved without delays.
|
| |
|
|
|
|
| |
The reverse direction already exists and it will be required when we act
with functions outside the crate that only accept a `SystemTime` in
situations where we just have a `Timestamp`.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
This commit eliminates the use of sleep in database tests because those
can be flaky, especially when the CI scheduler is overloaded, leading to
potential timeout invariants not holding true anymore.
We now fix this by using synchronization primitives from Rust in order
for threads to communicate. Documentation has been added explaining how
these tests work in greater detail.
Fixes #2308
|
| |
|
|
|
|
|
|
|
|
| |
This commit improves upon the work made in arti!3460, by establishing
the `database::Timestamp` type as a general purpose type for the
handling of timestamp throughout the code base.
It also replaces all previous occurrences of `SystemTime` within
`dirmirror::operation`, which leads to the reduction of code complexity
in one particular function, namely `calculate_sync_timeout`.
|
| |
|
|
|
|
|
| |
This commit replaces the custom implementation of `SaturatingSystemTime`
with the `saturating-time` crate, additionally adding a new type to the
`database` module called `Timestamp`, in order to have a convenient
wrapper around `ToSql` and `FromSql`.
|
| |
|
|
| |
Run maint/add_warning
|
| |
|
|
|
| |
This commit adds `CHECK` constraints to the database schema in order to
ensure all timestamps are positive.
|
| | |
|
| |
|
|
|
|
|
|
|
|
| |
This commit makes the entire database operations synchronous, thereby
replacing deadpool with r2d2.
The full motivation is outlined in a rustdoc comment at the top of the
`database` module, but it can be summarized to the fact that SQLite is
by design inherently synchronous due to directly interfacing with the
file system.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit does a large overhaul in the overall way on how we interact
with SQLite.
Although SQLite is a fairly straightforward tool, it has one large
caveat, namely the handling of the infamous `SQLITE_BUSY` error.
In WAL mode, the journaling mode we are using, the respective error may
occur if there is an existing write transaction while another thread is
trying to either upgrade an existing read transaction or create an
exclusive transaction at the same time. In this case, SQLite will fail
at the statement that either requires the write operation or at the
creation of the transaction respectively.
In order to tackle this problem, SQLite provides the `busy_timeout`
pragma, which allows specifying a timeout in milliseconds during which
SQLite will retry to obtain a write transaction or fail immediately.
This only works in the latter case, that is, creating a write
transaction from the beginning.
To solve this issue, we introduce two new functions:
1. `database::read_tx`
2. `database::rw_tx`
Both functions accept a database pool alongside a closure accepting a
`Transaction` and returning an arbitrary return value.
The first function creates a deferred transaction that gets rolled-back
in the end, making it suitable for read-only connections.
The latter function creates an exclusive transaction that gets committed
in the end, making it suitable for read-write connections. This also
honors the `busy_timeout`, i.e. the function retries for up to 1s to
acquire a write transaction before failing ultimately.
|
| |
|
|
|
|
| |
This commit introduces the no-op sql macro used to mark string literals
as SQL statements. It is purely semantical and serves the purpose to
quickly identify string literals as SQL statements.
|
| | |
|
|
|
This commit renames the schema module to the database module in order
to perform better error handling while redesigning the API.
|