Skip to content

Commit 1f72bfc

Browse files
authored
feat: Update to Rust 1.85 and 2024 Edition (#26046)
1 parent f1fc498 commit 1f72bfc

File tree

65 files changed

+484
-392
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+484
-392
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ exclude = [
3737
[workspace.package]
3838
version = "0.1.0"
3939
authors = ["InfluxData OSS Developers"]
40-
edition = "2021"
40+
edition = "2024"
4141
license = "MIT OR Apache-2.0"
4242

4343
[workspace.dependencies]

influxdb3/src/commands/create.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
use crate::commands::common::{
2-
parse_key_val, DataType, InfluxDb3Config, SeparatedKeyValue, SeparatedList,
2+
DataType, InfluxDb3Config, SeparatedKeyValue, SeparatedList, parse_key_val,
33
};
4-
use base64::engine::general_purpose::URL_SAFE_NO_PAD as B64;
54
use base64::Engine as _;
5+
use base64::engine::general_purpose::URL_SAFE_NO_PAD as B64;
66
use hashbrown::HashMap;
77
use influxdb3_client::Client;
88
use influxdb3_wal::TriggerSpecificationDefinition;
9-
use rand::rngs::OsRng;
109
use rand::RngCore;
10+
use rand::rngs::OsRng;
1111
use secrecy::ExposeSecret;
1212
use secrecy::Secret;
1313
use sha2::Digest;

influxdb3/src/commands/query.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::str::Utf8Error;
33
use clap::{Parser, ValueEnum};
44
use secrecy::ExposeSecret;
55
use std::fs;
6-
use std::io::{stdin, BufReader, IsTerminal, Read};
6+
use std::io::{BufReader, IsTerminal, Read, stdin};
77
use tokio::{
88
fs::OpenOptions,
99
io::{self, AsyncWriteExt},

influxdb3/src/commands/serve.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Entrypoint for InfluxDB 3 Core Server
22
3-
use anyhow::{bail, Context};
3+
use anyhow::{Context, bail};
44
use datafusion_util::config::register_iox_object_store;
55
use influxdb3_cache::{
66
distinct_cache::DistinctCacheProvider,
@@ -16,29 +16,30 @@ use influxdb3_clap_blocks::{
1616
tokio::TokioDatafusionConfig,
1717
};
1818
use influxdb3_process::{
19-
build_malloc_conf, setup_metric_registry, INFLUXDB3_GIT_HASH, INFLUXDB3_VERSION, PROCESS_UUID,
19+
INFLUXDB3_GIT_HASH, INFLUXDB3_VERSION, PROCESS_UUID, build_malloc_conf, setup_metric_registry,
2020
};
21+
use influxdb3_processing_engine::ProcessingEngineManagerImpl;
2122
use influxdb3_processing_engine::environment::{
2223
DisabledManager, PipManager, PythonEnvironmentManager, UVManager,
2324
};
2425
use influxdb3_processing_engine::plugins::ProcessingEngineEnvironmentManager;
25-
use influxdb3_processing_engine::ProcessingEngineManagerImpl;
2626
use influxdb3_server::{
27+
CommonServerState,
2728
auth::AllOrNothingAuthorizer,
2829
builder::ServerBuilder,
2930
query_executor::{CreateQueryExecutorArgs, QueryExecutorImpl},
30-
serve, CommonServerState,
31+
serve,
3132
};
3233
use influxdb3_sys_events::SysEventStore;
3334
use influxdb3_telemetry::store::TelemetryStore;
3435
use influxdb3_wal::{Gen1Duration, WalConfig};
3536
use influxdb3_write::{
37+
WriteBuffer,
3638
persister::Persister,
3739
write_buffer::{
38-
check_mem_and_force_snapshot_loop, persisted_files::PersistedFiles, WriteBufferImpl,
39-
WriteBufferImplArgs,
40+
WriteBufferImpl, WriteBufferImplArgs, check_mem_and_force_snapshot_loop,
41+
persisted_files::PersistedFiles,
4042
},
41-
WriteBuffer,
4243
};
4344
use iox_query::exec::{DedicatedExecutor, Executor, ExecutorConfig};
4445
use iox_time::SystemProvider;

influxdb3/src/commands/write.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::{
22
fs,
3-
io::{stdin, BufReader, IsTerminal, Read},
3+
io::{BufReader, IsTerminal, Read, stdin},
44
};
55

66
use clap::Parser;

influxdb3/src/main.rs

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,15 @@ use dotenvy::dotenv;
1414
use influxdb3_clap_blocks::tokio::TokioIoConfig;
1515
use influxdb3_process::VERSION_STRING;
1616
use observability_deps::tracing::warn;
17-
use std::env;
18-
use std::path::{Path, PathBuf};
17+
#[cfg(feature = "system-py")]
18+
use std::{
19+
env,
20+
path::{Path, PathBuf},
21+
};
1922
use trogging::{
20-
cli::LoggingConfigBuilderExt,
21-
tracing_subscriber::{prelude::*, Registry},
2223
TroggingGuard,
24+
cli::LoggingConfigBuilderExt,
25+
tracing_subscriber::{Registry, prelude::*},
2326
};
2427

2528
pub mod commands {
@@ -264,21 +267,23 @@ unsafe extern "C" fn signal_handler(sig: i32) {
264267
#[cfg(unix)]
265268
unsafe fn set_signal_handler(signal: libc::c_int, handler: unsafe extern "C" fn(libc::c_int)) {
266269
use libc::{sigaction, sigfillset, sighandler_t};
267-
let mut sigset = std::mem::zeroed();
270+
let mut sigset = unsafe { std::mem::zeroed() };
268271

269272
// Block all signals during the handler. This is the expected behavior, but
270273
// it's not guaranteed by `signal()`.
271-
if sigfillset(&mut sigset) != -1 {
274+
if unsafe { sigfillset(&mut sigset) } != -1 {
272275
// Done because sigaction has private members.
273276
// This is safe because sa_restorer and sa_handlers are pointers that
274277
// might be null (that is, zero).
275-
let mut action: sigaction = std::mem::zeroed();
278+
let mut action: sigaction = unsafe { std::mem::zeroed() };
276279

277280
// action.sa_flags = 0;
278281
action.sa_mask = sigset;
279282
action.sa_sigaction = handler as sighandler_t;
280283

281-
sigaction(signal, &action, std::ptr::null_mut());
284+
unsafe {
285+
sigaction(signal, &action, std::ptr::null_mut());
286+
}
282287
}
283288
}
284289

influxdb3/tests/cli/mod.rs

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
use crate::server::{ConfigProvider, TestServer};
2-
use assert_cmd::cargo::CommandCargoExt;
32
use assert_cmd::Command as AssertCmd;
3+
use assert_cmd::cargo::CommandCargoExt;
44
use observability_deps::tracing::debug;
55
use pretty_assertions::assert_eq;
6-
use serde_json::{json, Value};
6+
use serde_json::{Value, json};
77
use std::{
88
io::Write,
99
process::{Command, Stdio},
@@ -1110,8 +1110,7 @@ async fn test_show_system() {
11101110
],
11111111
},
11121112
SuccessTestCase {
1113-
name:
1114-
"table NAME should show queries table without information or system schema queries",
1113+
name: "table NAME should show queries table without information or system schema queries",
11151114
args: vec![
11161115
"show",
11171116
"system",
@@ -1155,11 +1154,29 @@ async fn test_show_system() {
11551154
},
11561155
FailTestCase {
11571156
name: "random table name doesn't exist, should error",
1158-
args: vec!["show", "system", "--host", server_addr.as_str(), "--database", db_name, "table", "meow"],
1157+
args: vec![
1158+
"show",
1159+
"system",
1160+
"--host",
1161+
server_addr.as_str(),
1162+
"--database",
1163+
db_name,
1164+
"table",
1165+
"meow",
1166+
],
11591167
},
11601168
FailTestCase {
11611169
name: "iox schema table name exists, but should error because we're concerned here with system tables",
1162-
args: vec!["show", "system", "--host", server_addr.as_str(), "--database", db_name, "table", "cpu"],
1170+
args: vec![
1171+
"show",
1172+
"system",
1173+
"--host",
1174+
server_addr.as_str(),
1175+
"--database",
1176+
db_name,
1177+
"table",
1178+
"cpu",
1179+
],
11631180
},
11641181
];
11651182

@@ -1412,7 +1429,7 @@ async fn test_wal_plugin_errors() {
14121429
expected_error: &'static str,
14131430
}
14141431

1415-
let tests = vec![
1432+
let tests = vec![
14161433
Test {
14171434
name: "invalid_python",
14181435
plugin_code: r#"
@@ -1467,7 +1484,7 @@ def process_writes(influxdb3_local, table_batches, args=None):
14671484
influxdb3_local.query("SELECT foo FROM not_here")
14681485
"#,
14691486
expected_error: "error executing plugin: QueryError: error: error while planning query: Error during planning: table 'public.iox.not_here' not found executing query: SELECT foo FROM not_here",
1470-
}
1487+
},
14711488
];
14721489

14731490
let plugin_dir = TempDir::new().unwrap();

influxdb3/tests/server/auth.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use arrow_util::assert_batches_sorted_eq;
33
use influxdb3_client::Precision;
44
use reqwest::StatusCode;
55

6-
use crate::server::{collect_stream, ConfigProvider, TestServer};
6+
use crate::server::{ConfigProvider, TestServer, collect_stream};
77

88
#[tokio::test]
99
async fn auth() {

influxdb3/tests/server/configure.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use hyper::StatusCode;
22
use observability_deps::tracing::debug;
33
use pretty_assertions::assert_eq;
4-
use serde_json::{json, Value};
4+
use serde_json::{Value, json};
55
use test_helpers::assert_contains;
66

77
use crate::server::TestServer;
@@ -97,8 +97,7 @@ async fn api_v3_configure_distinct_cache_create() {
9797
..Default::default()
9898
},
9999
TestCase {
100-
description:
101-
"identical to previous request, still success, but results in no 204 content",
100+
description: "identical to previous request, still success, but results in no 204 content",
102101
db: Some("foo"),
103102
table: Some("bar"),
104103
columns: &["t1", "t2"],
@@ -480,8 +479,7 @@ async fn api_v3_configure_last_cache_create() {
480479
..Default::default()
481480
},
482481
TestCase {
483-
description:
484-
"Will create new cache, because key columns are unique, and so will be the name",
482+
description: "Will create new cache, because key columns are unique, and so will be the name",
485483
db: Some(db_name),
486484
table: Some(tbl_name),
487485
key_cols: Some(&["t1", "t2"]),

0 commit comments

Comments
 (0)