Commit Graph

9 Commits

Author SHA1 Message Date
Kim Altintop 2894d364fb core: Store inputs (reducer info + args) in commitlog (#1091)
Prerequisite for auto-disconnect after a database crash, requested for
analytics purposes.
2024-04-18 20:16:52 +00:00
Kim Altintop 4cd17d7e00 core: Don't persist empty transactions (#1086)
Fix a minor bug where completely empty transactions would still be
written to the commitlog. The bug is minor because, once we start
logging inputs, all transactions will be non-empty.

The check is done in relational DB rather than the durability crate,
because in principle empty transactions are permissible, and may be used
in the future (e.g. to confirm a certain offset).
2024-04-12 16:45:21 +00:00
Kim Altintop 838e8696ec core,commitlog: Re-instantiate commitlog disk usage reporting (#955)
Disk usage reporting was left unimplemented in previous patches of the
series, as its semantics are slightly different from before.

Namely, inspecting the size of the commitlog now requires to `stat(2)`
the segment files, and is thus fallible.

Also, a size reporting function is only defined for local durability
(i.e. the commitlog). The behaviour when the database is in a follower
state is left unspecified.
2024-04-12 08:49:34 +00:00
Kim Altintop 47048559b4 core: Integrate new commitlog + durability (#926)
This patch attempts to integrate the new commitlog with the minimum
changes.

Most of the diff comes from deletions of the legacy log and the need to
adjust tests due to the requirement for a tokio runtime when a durable
database is used in tests.

The "meat" of the patch are the `RelationalDB` constructors,
`RelationalDB::commit_tx`, and the replay logic in
`locking_tx_datastore`.

While `DataKey` is gone, there is still some redundant data being passed
around, which will be addressed in the follow-up patch.
2024-04-11 22:46:31 +00:00
Kim Altintop 02be002416 Durability: Traits and implementation in terms of commitlog (#922)
Defines traits intended to abstract over the kind of persistence a
database utilizes. The only implementation is (host-)local durability in
terms of the new commitlog crate.

The trait definitions may not be considered stable yet, but are in their
tentative form needed for further integration of the new commitlog.
2024-04-11 09:44:58 +00:00
Phoebe Goldman 8902b08bfc Drop commitlog logging to trace to avoid spamming host logs (#1073) 2024-04-10 15:26:54 +00:00
Kim Altintop 1d316d991e Commitlog: Add canonical txdata payload (#921)
Defines the canonical commitlog payload, and how to encode / decode it.

Also exposes folds alongside iterators, which allows the common case of
replaying the commitlog onto a database to be further optimized (the
`Txdata` does not have to be constructed in this case). This
optimization is, however, left for a future patch.
2024-04-02 09:54:19 +00:00
Kim Altintop 73cd78231e Commitlog: Add I/O based on regular files (#920)
Provides a commitlog backing store based on files, and defines the
exported `Commitlog` type which fixes the store to the file-based one.
2024-04-02 09:10:21 +00:00
Kim Altintop 3b343e4eb1 Commitlog: Base implementation "sans I/O" (#919)
First in a series of patches to implement the new commitlog format.

This patch implements the base format, leaving the transaction payload
generic. Segment handling, writing and reading is implemented based on
an in-memory backend, which greatly simplifies testing.

As a notable deviation from the previous implementation, segments are
never implicitly trimmed. Instead, faulty commits are ignored if and
only if the next commit in the log sequence is valid and has the right
offset. On the write path, this entails closing the active segment when
an (I/O) error occurs, but retaining the commit in memory such that it
is written to the next segment.

Note that this patch does not define the final public API.
2024-04-02 06:18:30 +00:00