Commit Graph

37 Commits (fd8a89deea311a071e535eb192d9c7125705aeb7)

Author SHA1 Message Date
Fraser Savage e74a7a7dd4
test(wal): Test correct assignment of write per-partition sequence numbers
This adds extra test coverage for the ingester's WAL replay & RPC write
paths, as well as the WAL E2E tests, to ensure that all sequence numbers
present in a WriteOperation/WalOperation are encoded and present when
decoded.
2023-07-05 14:42:47 +01:00
Fraser Savage e6e09d0c15
feat(ingester): Assign individual sequence numbers for writes per partition
This commit asks the oracle for a new sequence number for each table
batch of a write operation (and thus each partition of a write) when
handling an RPC write operation before appending the operation to the
WAL. The ingester now honours the sequence numbers per-partition when
WAL replay is performed.
2023-07-05 14:29:27 +01:00
Fraser Savage 30939cfe96
refactor(wal): Remove op-level `sequence_number`, use per table map
This commit removes the op-level sequence number from the proto
definition, now reading and writing solely to the per table (and thus
per partition) sequence number map. Tables/partitions within the same
write op are still assigned the same number for now, so there should be
no semantic different
2023-07-05 14:20:43 +01:00
Fraser Savage fa69994358
refactor(wal): Implement `Iterator` for ClosedSegmentFileReader
The ClosedSegmentFileReader is pretty much an iterator anyways, this
just enables using all the juicy combinators with it more easily.
2023-06-09 17:30:53 +01:00
Fraser Savage fad34c375e
refactor(wal): Use TableId type for look-aside map key
This adds a little extra layer of type safety and should be optimised
by the compiler. This commit also makes sure the ingester's WAL sink
tests assert the behaviour for partitioned sequence numbering on an
operation that hits multiple tables & thus partitions.
2023-06-08 11:39:23 +01:00
Fraser Savage 7de98a6f11
refactor(wal): Associate sequence numbers to table ID in `SequencedWalOp`s
Writes are partitioned before being placed in the buffer tree. This
has the effect of splitting up the persistence of a DmlWrite's contents
and thus the persistence of data referred to by write operations placed
into a single WAL entry for a write op.

This change associates the currently assigned sequence number
with every `TableId` in the write, so that persist events for a single
write can be tracked on a per table/partition level.
Making this partial change enables a transition period where changes
can be rolled back and WAL files can still be processed.

A future change will produce a new sequence number per table
ID.
2023-06-06 17:49:09 +01:00
Dom Dwyer 0b40e0d17c
feat(wal): SequenceNumberSet for rotated file
Changes Wal::rotate() to return the SequenceNumberSet containing the IDs
of all writes in the segment file that is rotated out.
2023-03-02 10:58:03 +01:00
Carol (Nichols || Goulding) 30fea67701
fix: Move variables within format strings. Thanks clippy!
Changes made automatically using `cargo clippy --fix`.
2023-02-03 13:06:17 -05:00
Paul Dix d9c72bb93f
feat: optimize wal with batching (#6399)
* feat: optimize wal with batching

Simplified the wal writer so that it batches up write operations. Currently it waits 10ms between fsync calls. We can pull this out to a config variable later if we want, but I think this is good enough for now.

Also updated the reader to be a more simple blocking reader without the extra tasks and channels as that wasn't really getting us anything that I know of.

* chore: cleanup wal code for PR feedback
2022-12-14 16:07:20 +00:00
Dom Dwyer f40885d4ca
refactor(wal): remove needless async/await
Obtaining a rotation handle isn't async.
2022-12-01 16:03:52 +01:00
Carol (Nichols || Goulding) b6b8e6ac10
Merge remote-tracking branch 'origin/main' into dom/wal-write 2022-11-30 13:27:28 -05:00
Carol (Nichols || Goulding) 096d850fd5
fix: Maintain WAL segment file ordering (#6287)
Rather than naming WAL files with a UUID, give them a number that
indicates the order they were created in so that they can be read back
in order.

Fixes #6227.

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-11-30 17:37:37 +00:00
Carol (Nichols || Goulding) f326baa5d0
test: Update to correctly expect old open files are closed on replay 2022-11-30 12:09:36 -05:00
Dom Dwyer c48a3b49fb
refactor(wal): rename next_ops -> next_op
It only returns one op, so remove the plural.
2022-11-30 16:37:05 +01:00
Dom Dwyer 3029146f5a
refactor(wal): remove SequenceNumberNg
This actually starts getting more confusing than passing the bare u64
around.
2022-11-30 16:37:00 +01:00
Carol (Nichols || Goulding) eafc0ea131
fix: Get the file stem rather than file name for the UUID (#6284)
Oops. Stupid mistake, behavior that should have had a test but didn't.

Fixes #6270.
2022-11-30 15:22:03 +00:00
Carol (Nichols || Goulding) edd606aa3b
feat: Serialize using protobuf instead of json 2022-11-23 17:07:49 -05:00
Carol (Nichols || Goulding) a85abadfd5
fix: Define and use a sequence number represented as u64 instead 2022-11-23 17:07:49 -05:00
Carol (Nichols || Goulding) d5b439732d
feat: Implement delete WAL file 2022-11-23 17:07:48 -05:00
Carol (Nichols || Goulding) cdec449963
fix: Return single SequencedWalOps for now, will batch later 2022-11-23 17:07:48 -05:00
Carol (Nichols || Goulding) db9a43f1b3
fix: Create types for 3 different tasks of a WAL 2022-11-23 17:07:48 -05:00
Carol (Nichols || Goulding) ee99b93d09
fix: Make checksum private 2022-11-23 17:07:47 -05:00
Carol (Nichols || Goulding) 70b12a8112
fix: Clarify and simplify the public API 2022-11-23 17:07:47 -05:00
Jake Goulding 1f5fd43829
fix: cross ps and dot qs 2022-11-23 17:07:47 -05:00
Jake Goulding 0ae40ba025
fix: move writing to blocking and wire up some things 2022-11-23 17:07:47 -05:00
Carol (Nichols || Goulding) 49633842a5
test: Rotate and reading of closed segments 2022-11-23 17:07:46 -05:00
Carol (Nichols || Goulding) 48e5000ec6
fix: Make test data deterministic 2022-11-23 17:07:46 -05:00
Carol (Nichols || Goulding) 4bb8d3a408
fix: Update to DmlWrite only containing IDs 2022-11-23 17:07:46 -05:00
Carol (Nichols || Goulding) 42ed02ea31
feat: Actually write entries to the open segment file 2022-11-23 17:07:46 -05:00
Jake Goulding e81a84dd40
fix: don't require a reference just to make an owned value 2022-11-23 17:07:45 -05:00
Carol (Nichols || Goulding) 3eda17ea8b
fix: Make SegmentId into a newtype; test the open segment file is created 2022-11-23 17:07:44 -05:00
Carol (Nichols || Goulding) eea7f113fb
fix: Start implementing traits on Wal to enable outside use 2022-11-23 17:07:44 -05:00
Carol (Nichols || Goulding) f0b93c5c8c refactor: Rename the wal crate to write_buffer 2021-04-21 17:43:03 +00:00
Carol (Nichols || Goulding) 82588d5c72 fix: Don't return Result from test functions 2021-04-07 12:40:00 -04:00
Dom 6f473984d0 style: wrap comments
Runs rustfmt with the new config.
2020-12-11 18:22:26 +00:00
Andrew Lamb a52e0001c5
refactor: rename all crates that start with`delorean_` in preparation for rename (#415)
* refactor: rename delorean_cluster --> cluster

* refactor: rebane delorean_generated_types --> generated_types

* refactor: rename delorean_write_buffer --> write_buffer

* refactor: rename delorean_ingest --> ingest

* refactor: rename delorean_storage --> storage

* refactor: rename delorean_tsm --> tsm

* refactor: rename delorean_test_helpers --> test_helpers

* refactor: rename delorean_arrow --> arrow_deps

* refactor: rename delorean_line_parser --> influxdb_line_protocol
2020-11-05 13:44:36 -05:00
Andrew Lamb ff824a5477
refactor: rename delorean_wal --> wal, conslidate wal_writer (#411) 2020-11-05 09:25:29 -05:00