Commit Graph

703 Commits (fd8a89deea311a071e535eb192d9c7125705aeb7)

Author SHA1 Message Date
Fraser Savage fd8a89deea
feat(ingester): WIP - WAL rotate task uses reference tracker for delete
This is the first commit in line to connect the WAL segment reference
tracker actor up to the rest of the ingester. It removes the segment file
deletion and hacky sleep from the rotate task, deferring to the actor
for deletion tracking.
2023-07-05 15:23:37 +01:00
Fraser Savage 7b2ef53c7b
refactor(ingester): Notify `SequenceNumberSet` when tracking unbuffered writes
Writes now contain multiple sequence numbers, so the WAL reference
actor must be notified of *all* sequence numbers contained for a write
that failed to be applied to the buffer.
2023-07-05 15:13:29 +01:00
Fraser Savage 2da99f8032
refactor: Use `const` instead of unnecessary lazy_static
Co-authored-by: Carol (Nichols || Goulding) <193874+carols10cents@users.noreply.github.com>
2023-07-05 14:42:55 +01:00
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
kodiakhq[bot] 70a6e60415
Merge branch 'main' into savage/use-u64-for-sequence-number 2023-07-05 12:55:44 +00:00
dependabot[bot] 3827257f94
chore(deps): Bump thiserror from 1.0.40 to 1.0.41 (#8149)
Bumps [thiserror](https://github.com/dtolnay/thiserror) from 1.0.40 to 1.0.41.
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/1.0.40...1.0.41)

---
updated-dependencies:
- dependency-name: thiserror
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Dom <dom@itsallbroken.com>
2023-07-05 09:25:14 +00:00
dependabot[bot] b5c9628f0f
chore(deps): Bump async-trait from 0.1.69 to 0.1.70 (#8148)
Bumps [async-trait](https://github.com/dtolnay/async-trait) from 0.1.69 to 0.1.70.
- [Release notes](https://github.com/dtolnay/async-trait/releases)
- [Commits](https://github.com/dtolnay/async-trait/compare/0.1.69...0.1.70)

---
updated-dependencies:
- dependency-name: async-trait
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-07-05 09:05:13 +00:00
dependabot[bot] 9a03d9c9fe
chore(deps): Bump paste from 1.0.12 to 1.0.13 (#8139)
Bumps [paste](https://github.com/dtolnay/paste) from 1.0.12 to 1.0.13.
- [Release notes](https://github.com/dtolnay/paste/releases)
- [Commits](https://github.com/dtolnay/paste/compare/1.0.12...1.0.13)

---
updated-dependencies:
- dependency-name: paste
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-04 07:57:41 +00:00
Dom Dwyer 0297fe3651
refactor: less nesting in partition pruning logic
Improve readability by pulling the partition pruning logic into it's own
function and clean up some minor bits.
2023-07-03 17:25:03 +02:00
Dom Dwyer edf6686130
fix(test): custom partitioning template pruning
Configure the partition pruning test to use a partition template that
partitions on the "region" field. This will allow it to be used for
pruning at query time.
2023-07-03 17:25:03 +02:00
Marco Neumann 36ed914689
test: type coercion in ingester tests 2023-07-03 17:25:02 +02:00
Marco Neumann 171b2a14c7
fix: doc link 2023-07-03 17:25:01 +02:00
Marco Neumann e9b456df1f
fix: do not panic for pruning errors 2023-07-03 17:25:00 +02:00
Marco Neumann 0bcf85d48c
refactor: de-dup code 2023-07-03 17:24:59 +02:00
Carol (Nichols || Goulding) 8ebf390d9c
feat: Try to prune ingester partitions by partition key
This is hacktastic.
2023-07-03 17:24:58 +02:00
Fraser Savage da34eb7b35
feat: Load both table name and partition template in the ingester 2023-07-03 17:24:57 +02:00
Fraser Savage 5f759528d3
test(ingester): Add `BufferTree` test for predicate-filtered queries 2023-07-03 17:24:56 +02:00
Fraser Savage 246c2b0749
refactor(ingester): Accept a predicate as parameter to `query_exec`
This will allow the ingester to apply a predicate when serving a query
and only stream back data that satisfies the predicate.
2023-07-03 17:24:56 +02:00
dependabot[bot] 9f00c9c4ef
chore(deps): Bump pin-project from 1.1.1 to 1.1.2 (#8129)
Bumps [pin-project](https://github.com/taiki-e/pin-project) from 1.1.1 to 1.1.2.
- [Release notes](https://github.com/taiki-e/pin-project/releases)
- [Changelog](https://github.com/taiki-e/pin-project/blob/main/CHANGELOG.md)
- [Commits](https://github.com/taiki-e/pin-project/compare/v1.1.1...v1.1.2)

---
updated-dependencies:
- dependency-name: pin-project
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-03 09:10:28 +00:00
Marco Neumann ce6a2fb613
refactor: remove `QueryChunk::column_values` (#8111)
Similar to #8109.

This was once implemented by the RUB but as it stands right now, no
chunk implements this anymore.

If we ever want to bring this back, we should use the output of
`QueryChunk::data` instead (i.e. use a data-based implementation instead
of a per-chunk one).

Closes #8096.
2023-07-03 09:03:21 +00:00
dependabot[bot] ede8e32804
chore(deps): Bump pin-project from 1.1.0 to 1.1.1 (#8118)
Bumps [pin-project](https://github.com/taiki-e/pin-project) from 1.1.0 to 1.1.1.
- [Release notes](https://github.com/taiki-e/pin-project/releases)
- [Changelog](https://github.com/taiki-e/pin-project/blob/main/CHANGELOG.md)
- [Commits](https://github.com/taiki-e/pin-project/compare/v1.1.0...v1.1.1)

---
updated-dependencies:
- dependency-name: pin-project
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-30 08:51:56 +00:00
kodiakhq[bot] 16f18fdd53
Merge branch 'main' into cn/use-the-test-constants-luke 2023-06-29 15:04:53 +00:00
Marco Neumann b982ee180e
refactor: remove `QueryChunk::column_names` (#8109)
This interface was once specially implemented by the RUB. The only
actual implementation of it is within the querier that just forwards it
to a simple schema scan. Lift this semantic to `iox_query_influxrpc`
instead so all the chunks can use it.

If we ever want to optimize this again, we should use `QueryChunk::data`
instead (i.e. instead of implementing it within the chunk it should use
the data method and do something smart based on that).

First half of #8096.
2023-06-29 13:43:10 +00:00
Marco Neumann dcb4a9bb5c
refactor: fuse `QueryChunk` and `QueryChunkMeta` (#8107)
Closes #8095.
2023-06-29 11:02:48 +00:00
Marco Neumann 4638b89d93
refactor: migrate retention to proper predicates (#8092)
Do not (ab)use per-chunk delete predicates for the retention policy.
Instead use a per-table predicate.

This makes the code way cleaner, since the scoping is correct (i.e.
delete predicates are a table-wide attribute, not a chunk-based one) and
it is consistent time predicates that the user providers (e.g. via
`WHERE time > x`).

It also allows us to remove delete predicates (in their current,
non-scalable form) from the query path. A potential future version would
likely not use per chunk predicates (and "is processed" markers) but use
the timestamp / chunk order to determine to which data the predicate
should be applied.

Note that the lowering of the retention policy changed slightly from

```text
(time > (now() - retention)) AND (time < MAX)
```

to

```text
time > (now() - retention)
```

Since the `MAX` cut is just an artifact of the lowering and was unnecessary.

Closes #7409.
Closes #7410.
2023-06-29 08:36:37 +00:00
dependabot[bot] b15c6062a9
chore(deps): Bump tokio from 1.28.2 to 1.29.0 (#8100)
Bumps [tokio](https://github.com/tokio-rs/tokio) from 1.28.2 to 1.29.0.
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-1.28.2...tokio-1.29.0)

---
updated-dependencies:
- dependency-name: tokio
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-28 13:18:08 +00:00
dependabot[bot] bb6f481de8
chore(deps): Bump uuid from 1.3.4 to 1.4.0 (#8099)
Bumps [uuid](https://github.com/uuid-rs/uuid) from 1.3.4 to 1.4.0.
- [Release notes](https://github.com/uuid-rs/uuid/releases)
- [Commits](https://github.com/uuid-rs/uuid/compare/1.3.4...1.4.0)

---
updated-dependencies:
- dependency-name: uuid
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-28 10:26:53 +00:00
Carol (Nichols || Goulding) d7959e7b0c
refactor: Extract a test constant for a namespace ID different than ARBITRARY_NAMESPACE_ID 2023-06-26 17:26:14 -04:00
Carol (Nichols || Goulding) dc21c48404
refactor: Use and create test constants for partition keys
Replace:

- PartitionKey p1 with ARBITRARY_PARTITION_KEY
- PartitionKey p2 with PARTITION2_KEY
- PartitionKey p3 with PARTITION3_KEY
2023-06-26 17:26:03 -04:00
Carol (Nichols || Goulding) 086a073fda
refactor: Extract and use test constants for table values throughout these tests
Moved TABLE2_ID and TABLE2_NAME to the top of the test module, even
though TABLE2_NAME is only used in one spot, to encourage use of the
constants if new tests are added to this file that need a table that's
different from the arbitrary table.

Replaced all occurrences of TableId::new(1234) with TABLE2_ID even
though TABLE2_ID is 1234321; the exact value doesn't matter, the
important property is that it does not equal ARBITRARY_TABLE_ID (which
is 4).
2023-06-26 17:25:55 -04:00
Carol (Nichols || Goulding) ce4e67e921
refactor: Use and create test constants for partition IDs
Replace:

- PartitionId::new(0) with ARBITRARY_PARTITION_ID (which is actually 1)
- PartitionId::new(1) with PARTITION2_ID (actually 2)
- PartitionId::new(2) with PARTITION3_ID (actually 3)

So while adding one is a bit confusing in this diff, in the long run,
this will make the test more understandable and consistent with other
tests.
2023-06-26 17:25:46 -04:00
Carol (Nichols || Goulding) afcd2d859d
refactor: Use test constants in more places
So that when I change the type of PartitionIds to TransitionPartitionId,
I don't have to update all these places that just need an arbitrary
partition ID or related values.

These test constants probably didn't exist when these tests
were created.
2023-06-26 17:25:14 -04:00
Fraser Savage 62cb6594c8
refactor(ingester): Use unsigned sequence number, remove its `Sqlx::Type`
Now that sequence numbers are internal to the ingester and the WAL,
there's no need for them to be a signed integer. As noted by
[#7260](https://github.com/influxdata/influxdb_iox/issues/7260) this was
a quirk related to the kafka-based IOx and Postgres only supported
signed integers.
2023-06-23 16:39:11 +01:00
Carol (Nichols || Goulding) 1912840c25
docs: Update size calculations in the description of PartitionCache 2023-06-22 09:01:22 -04:00
Carol (Nichols || Goulding) bffb2f8f9f
fix: Specialize Partition constructors to clarify appropriate usage 2023-06-22 09:01:22 -04:00
Carol (Nichols || Goulding) 41420cb920
fix: Borrow transition partition ID when possible 2023-06-22 09:01:22 -04:00
Carol (Nichols || Goulding) d991e12fbb
feat: Send PartitionHashId from ingesters to queriers 2023-06-22 09:01:22 -04:00
Carol (Nichols || Goulding) 62ba18171a
feat: Add a new hash column on the partition and parquet file tables
This will hold the deterministic ID for partitions.

Until all existing partitions have this value, this is optional/nullable.

The row ID still exists and is used as the main foreign key in the
parquet_file and skipped_compaction tables.

The hash_id has a unique index so that we can look up records based on
it (if it's available).

If the parquet file record has a partition_hash_id value, use that to
generate the object storage path instead of the partition_id.
2023-06-22 09:01:22 -04:00
Fraser Savage fab088f680
refactor(ingester): Split up the `WriteOperation` sub-types into separate modules 2023-06-22 10:08:26 +01:00
Fraser Savage f6ad920f31
refactor(ingester): Remove `set_span_context()` from `IngestOp` 2023-06-21 15:58:16 +01:00
Fraser Savage 35c5017410
docs(ingester): Update references to `DmlOperation` in doc comments 2023-06-21 11:45:46 +01:00
Fraser Savage d3775e67f8
chore(ingester): Tidy TODO comment in `dml_payload` 2023-06-21 11:16:51 +01:00
Fraser Savage 4f489b9d9d
refactor(ingester): Add dml_payload::encode mod for encode to `DatabaseBatch`
This enables the whole of the RPC write path to use the new
`dml_payload::IngestOp` instead of the `DmlOperation` type. The
implementation of `From<&WriteOperation> for DmlWrite` has been removed
to complete the switch.
2023-06-21 11:13:44 +01:00
Fraser Savage 3e7a82f319
refactor(ingester): Remove `From` dml op to construct `IngestOp` directly
Removes one of the temporary conversion traits and adds a test helper
method `encode_batch(NamespaceId, WriteOperation)` for removal of the
`DmlOperation` from WAL replay and the RPC write handler.
2023-06-21 11:11:19 +01:00
Fraser Savage a3a4145774
refactor(ingester): Replace test_util `DmlWrite` with `WriteOperation`
This change replaces the test_util equality and write generation code
to use the new `IngestOp::Write(WriteOperation)` type, removing many
pointless conversions in tests.
2023-06-21 11:11:18 +01:00
Fraser Savage 8908f5fc96
refactor(ingester): Take `IngestOp` as parameter for `DmlSink::apply`
This commit switches over the trait definition to take `IngestOp`
instead of `DmlOperation`. This commit is not enough to complete the
switch, as the conversion from `DmlOperation` and back is a performance
regression.
2023-06-21 11:11:17 +01:00
Fraser Savage 198a47da53
refactor(ingester): Implement `From<&WriteOperation>` for `DmlWrite`
This commit implements the `From` trait to allow quick conversion from
a `&WriteOperation` back to an owned `DmlWrite`. This conversion
copies all the record batches and should be removed once WAL encoding
can be done from `&WriteOperation`.
2023-06-21 11:11:16 +01:00
Fraser Savage 6527110663
refactor(ingester): Expose some `IngestOp` fields from inner type
This allows accessing temporarily agnostic values without matching on
the kind of `IngestOp`. There is only one type at the moment, so this
just provides a bridge for users of the `DmlOperation` getters.
2023-06-21 11:11:15 +01:00