Commit Graph

32 Commits (2d18a61949370b1136c41af03e819a77e33a158b)

Author SHA1 Message Date
Trevor Hilton 81d1ff1d62
chore: upgrade to rust 1.83.0 (#25605) 2024-11-29 18:21:48 -05:00
Trevor Hilton 0e814f5d52
feat: SerdeVecMap type for serializing ID maps (#25492)
This PR introduces a new type `SerdeVecHashMap` that can be used in places where we need a HashMap with the following properties:
1. When serialized, it is serialized as a list of key-value pairs, instead of a map
2. When deserialized, it assumes the serialization format from (1.) and deserializes from a list of key-value pairs to a map
3. Does not allow for duplicate keys on deserialization

This is useful in places where we need to create map types that map from an identifier (integer) to some value, and need to serialize that data. For example: in the WAL when serializing write batches, and in the catalog when serializing the database/table schema.

This PR refactors the code in `influxdb3_wal` and `influxdb3_catalog` to use the new type for maps that use `DbId` and `TableId` as the key. Follow on work can give the same treatment to `ColumnId` based maps once that is fully worked out.

## Explanation

If we have a `HashMap<u32, String>`, `serde_json` will serialize it in the following way:
```json
{"0": "foo", "1": "bar"}
```
i.e., the integer keys are serialized as strings, since JSON doesn't support any other type of key in maps.

`SerdeVecHashMap<u32, String>` will be serialized by `serde_json` in the following way:
```json,
[[0, "foo"], [1, "bar"]]
```
and will deserialize from that vector-based structure back to the map. This allows serialization/deserialization to run directly off of the `HashMap`'s `Iterator`/`FromIterator` implementations.

## The Controversial Part

One thing I also did in this PR was switch the catalog from using a `BTreeMap` for tables to using the new `HashMap` type. This breaks the deterministic ordering of the database schema's `tables` map and therefore wrecks the snapshot tests we were using. I had to comment those parts of their respective tests out, because there isn't an easy way to make the underlying hashmap have a deterministic ordering just in tests that I am aware of.

If we think that using `BTreeMap` in the catalog is okay over a `HashMap`, then I think it would be okay to roll a similar `SerdeVecBTreeMap` type specifically for the catalog. Coincidentally, this may actually be a good use case for [`indexmap`](https://docs.rs/indexmap/latest/indexmap/), since it holds supposedly similar lookup performance characteristics to hashmap, while preserving order and _having faster iteration_ which could be a win for WAL serialization speed. It also accepts different hashing algorithms so could be swapped in with FNV like `HashMap` can.

## Follow-up work

Use the `SerdeVecHashMap` for column data in the WAL following https://github.com/influxdata/influxdb/issues/25461
2024-10-25 13:49:02 -04:00
Michael Gattozzi 05a8a7da43
chore: Upgrade to rustc 1.80 (#25193)
This commit updates us to rustc 1.80. There are three significant changes
here:

1. LazyLock and LazyCell have been stabilized meaning we can replace our
   usage of Lazy from the once_cell crate with the std lib versions
2. Lints were added to handle unknown cfg directives. `tokio_unstable`
   is affected by this and while we do have the flags in our
   .cargo/config.toml Cargo still output a lint for it so we supress
   that warning now in our Cargo.toml for the workspace
3. clippy now throws a new warning about priority levels for lints. It's
   quite frankly a thing that doesn't make sense to me and should be
   something cargo fixes, but here we are.

Besides that it was a painless upgrade and now we're on the latest and
greatest.
2024-07-25 11:38:18 -04:00
Michael Gattozzi 5c146317aa
chore: Update Rust to 1.79.0 (#25061)
Fairly quiet update for us. The only change was around using the numeric
constants now inbuilt into the primitives not the ones from `std`

https://rust-lang.github.io/rust-clippy/master/index.html#/legacy_numeric_constants

Release post: https://blog.rust-lang.org/2024/06/13/Rust-1.79.0.html
2024-06-13 13:56:39 -04:00
Michael Gattozzi 7138019636
chore: Upgrade to Rust 1.78.0 (#24953)
This fixes new lints that have come up in the latest edition of clippy and moves
.cargo/config to .cargo/config.toml as the previous filename is now deprecated.
2024-05-02 13:39:20 -04:00
Michael Gattozzi a2984cdc17
chore: Update to Rust 1.77.0 (#24800)
* chore: Update to Rust 1.77.0

This is a fairly quiet upgrade. The only changes are some lints around
`OpenOptions` that were added to clippy between 1.75 and this version
and they're small changes that either remove unecessary function calls
or add a needed function call.

* fix: cargo-deny by using the --locked flag
2024-03-21 13:00:15 -04:00
Trevor Hilton 397ee6e73b
fix: add rust-analyzer to toolchain file (#24636)
* fix: add rust-analyzer to toolchain file

Added the rust-analyzer component to the rust-toolchain.toml
file so that the correct version of rust-analyzer is installed
on Apple Silicone.

This will allow the LSP to work on Apple Silicone machines.

* chore: update deps for cargo deny
2024-02-06 16:04:03 -05:00
Michael Gattozzi 8ee13bca48
fix: Failing CI on main (#24562)
* fix: build, upgrade rustc, and deps

This commit upgrades Rust to 1.75.0, the latest release. We also
upgraded our dependencies to stay up to date and to clear out any
uneeded deps from the lockfile. In order to make sure everything works
this also fixes the build by upgrading the workspace-hack crate using
cargo hikari and removing the `workspace.lint` that was in
influxdb3_write that didn't need to be there, probably from a merge
issue.

With this we can build influxdb3 as our default on main, but this alone
is not enough to fix CI and will be addressed in future commits.

* fix: warnings for influxdb3 build

This commit fixes the warnings emitted by `cargo build` when compiling
influxdb3. Mainly it adds needed lifetimes and removes uneccesary
imports and functions calls.

* fix: all of the clippy lints

This for the most part just applies suggested fixes by clippy with a few
exceptions:

- Generated type crates had additional allows added since we can't
  control what code gets made
- Things that couldn't be automatically fixed were done so manually in
  particular adding a Send bound for traits that created a Future that
  should be Send

We also had to fix a build issue by adding a feature for tokio-compat
due to the upgrade of deps. The workspace crate was updated accordingly.

* fix: failing test due to rust panic message change

Inbetween rustc 1.72 and rustc 1.75 the way that error messages were
displayed when panicing changed. One of our tests depended on the output
of that behavior and this commit updates the error message to the new
form so that tests will pass.

* fix: broken cargo doc link

* fix: cargo formatting run

* fix: add workspace-hack to influxdb3 crates

This was the last change needed to make sure that the workspace-hack
crate CI lint would pass.

* fix: remove tests that can not run anymore

We removed iox code from this code base and as a result some tests
cannot be run anymore and so this commit removes them from the code base
so that we can get a green build.
2024-01-09 15:11:35 -05:00
Dom Dwyer 3c9f282837
build: bump rust to 1.72.1
https://github.com/rust-lang/rust/releases/tag/1.72.1
2023-09-20 12:00:04 +02:00
Carol (Nichols || Goulding) 12b8095c46
feat: Upgrade to Rust 1.72.0 (#8589)
* feat: Upgrade to Rust 1.72.0

* fix: Allow a warning about an error we're intentionally creating

This is a test for an error. This lint warns that this code will cause
an error. Thanks lint, that's what we wanted!

* chore: rustfmt 1.72

* fix: Remove unnecessary hashes in raw string literals

Thanks Clippy!
https://rust-lang.github.io/rust-clippy/master/index.html#/needless_raw_string_hashes

Note that there are a number of false negatives with this lint; see
https://github.com/rust-lang/rust-clippy/issues/11420

* fix: Remove unnecessary explicit iteration

Looks like clippy::explicit_iter_loop was improved.
https://rust-lang.github.io/rust-clippy/master/index.html#/explicit_iter_loop

* fix: Allow clippy::manual_try_fold in a few places

Some of these might not be possible to rewrite with try_fold, or at
least not trivially. I don't feel confident enough to change these, in
any case. I think the lint is good to have on for future code though, so
that new code can be written with try_fold.

* fix: Remove useless creation of vectors when an array will do

Mostly in tests. Also fix some long lines.

Thanks Clippy!
https://rust-lang.github.io/rust-clippy/master/index.html#/useless_vec

* fix: Allow a single range in a vec init, which is actually what we want

Looks like Clippy's trying to catch a common mistake here, but for realz
we actually want `Vec<Range<usize>>` not `Vec<usize>`

https://rust-lang.github.io/rust-clippy/master/index.html#/single_range_in_vec_init

* fix: Remove a useless conversion

This looks like removing explicit iteration, but it's actually caught by
useless_conversion.

https://rust-lang.github.io/rust-clippy/master/index.html#/useless_conversion

* fix: Remove redundant pattern matching

Thanks Clippy!
https://rust-lang.github.io/rust-clippy/master/index.html#/redundant_pat

* fix: Allow an unwrap on a literal None in a test

This matches with the other tests better, and also when I tried to
remove the `unwrap_or_default` it changed the JSON sent from something
with an empty value to `null`, so I think the `or_default` part is
actually changing from one `None` to another `None`.

https://rust-lang.github.io/rust-clippy/master/index.html#/unnecessary_literal_unwrap
2023-08-29 05:57:38 +00:00
Carol (Nichols || Goulding) 0d6a4cc9f6
chore: Update to Rust 1.71 2023-07-14 10:20:51 -04:00
Stuart Carnie 0fc859f616
build: bump Rust version 2023-06-04 06:43:22 +10:00
Dom Dwyer 368d4af23f
build: bump rust version
Bump to 1.69 for more fixing magic.
2023-04-27 13:19:05 +02:00
Carol (Nichols || Goulding) cc7c44f76a
chore: Upgrade to Rust 1.68 (#7175)
* chore: Upgrade to Rust 1.68

* fix: Remove unnecessary into_iter, thanks Clippy!

* fix: Use the size of the type, not a reference to the type... oops.

Thanks clippy!

* fix: Return block directly instead of creating a variable

Thanks clippy!

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-03-12 13:22:20 +00:00
Carol (Nichols || Goulding) a82f7916d0
chore: Upgrade to Rust 1.67 2023-02-03 13:06:01 -05:00
Dom Dwyer e0dcfc8830
chore: bump rust to 1.66.1
Picks up a fix to SSH host authentication in cargo when pulling the
crates index:

    https://blog.rust-lang.org/2023/01/10/cve-2022-46176.html
2023-01-11 11:39:17 +01:00
Carol (Nichols || Goulding) a672fea405
chore: Update to Rust 1.66 2022-12-21 13:31:31 -05:00
Carol (Nichols || Goulding) a3bee0c303
chore: Upgrade to Rust 1.65 2022-11-09 10:29:13 -05:00
Carol (Nichols || Goulding) c8108f01e7
chore: Upgrade to Rust 1.64 (#5727)
* chore: Upgrade to Rust 1.64

* fix: Use iter find instead of a for loop, thanks clippy

* fix: Remove some needless borrows, thanks clippy

* fix: Use then_some rather than then with a closure, thanks clippy

* fix: Use iter retain rather than filter collect, thanks clippy

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-09-22 18:04:00 +00:00
Carol (Nichols || Goulding) 545a1a5228
chore: Upgrade to Rust 1.63 2022-08-11 15:04:00 -04:00
Carol (Nichols || Goulding) 1c4caa2cc2
chore: Upgrade to Rust 1.62 2022-07-01 13:31:31 -04:00
Carol (Nichols || Goulding) 8eece6135b
chore: Update to Rust 1.61 2022-05-19 14:39:05 -04:00
Dom Dwyer 3624d63529 build: use rust 1.60 2022-04-11 12:41:27 +01:00
Marco Neumann 33851be3a5
chore: upgrade Rust to 1.59 (#3875)
Mostly a few new clippy crates around `flat_map`, `and_then`, and
"underscore locks" (!!!):
https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_lock

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-02-28 15:14:19 +00:00
Dom Dwyer 5438a4afac build: use rust 1.58.1
Security bugfix release, see:
    https://groups.google.com/g/rustlang-security-announcements/c/R1fZFDhnJVQ?pli=1
2022-01-28 14:43:22 +00:00
Edd Robinson d1816b662f
chore: update rust to 1.58 (#3461)
* chore: update rust to 1.58

* fix: clippy

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
2022-01-13 21:12:46 +00:00
Carol (Nichols || Goulding) bf1513cb8b
chore: Update stable Rust version 2021-12-02 10:46:39 -05:00
Carol (Nichols || Goulding) bb05ab4191 chore: Update Rust 2021-10-21 20:23:29 -04:00
Marco Neumann 368f0369ee chore: Rust 1.55 2021-09-10 12:36:49 +02:00
Carol (Nichols || Goulding) 49a4dd0125 feat: Upgrade to Rust 1.54 2021-07-29 21:07:43 -04:00
Andrew Lamb e6d995cbd8
chore: Update to Rust 1.53.0 (#1922)
* chore: Update to Rust 1.53.0

* fix: Update to latest clippy standards

* fix: bad refactor

* fix: Update escaping

* test: update test output

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-07-07 18:02:03 +00:00
Carol (Nichols || Goulding) f0efd20259 chore: Switch to rust-toolchain.toml to specify Rust components we need as well 2021-06-23 15:28:58 -04:00