Unverified Commit a4c49fe5 authored by Graham King's avatar Graham King Committed by GitHub
Browse files

chore: Upgrade Rust to 1.87 (#1189)

parent 3f9c3ffe
...@@ -91,13 +91,13 @@ rust-base: ...@@ -91,13 +91,13 @@ rust-base:
ENV RUSTUP_HOME=/usr/local/rustup ENV RUSTUP_HOME=/usr/local/rustup
ENV CARGO_HOME=/usr/local/cargo ENV CARGO_HOME=/usr/local/cargo
ENV PATH=/usr/local/cargo/bin:$PATH ENV PATH=/usr/local/cargo/bin:$PATH
ENV RUST_VERSION=1.86.0 ENV RUST_VERSION=1.87.0
ENV RUSTARCH=x86_64-unknown-linux-gnu ENV RUSTARCH=x86_64-unknown-linux-gnu
RUN wget --tries=3 --waitretry=5 "https://static.rust-lang.org/rustup/archive/1.28.1/x86_64-unknown-linux-gnu/rustup-init" && \ RUN wget --tries=3 --waitretry=5 "https://static.rust-lang.org/rustup/archive/1.28.1/x86_64-unknown-linux-gnu/rustup-init" && \
echo "a3339fb004c3d0bb9862ba0bce001861fe5cbde9c10d16591eb3f39ee6cd3e7f *rustup-init" | sha256sum -c - && \ echo "a3339fb004c3d0bb9862ba0bce001861fe5cbde9c10d16591eb3f39ee6cd3e7f *rustup-init" | sha256sum -c - && \
chmod +x rustup-init && \ chmod +x rustup-init && \
./rustup-init -y --no-modify-path --profile minimal --default-toolchain 1.86.0 --default-host x86_64-unknown-linux-gnu && \ ./rustup-init -y --no-modify-path --profile minimal --default-toolchain 1.87.0 --default-host x86_64-unknown-linux-gnu && \
rm rustup-init && \ rm rustup-init && \
chmod -R a+w $RUSTUP_HOME $CARGO_HOME chmod -R a+w $RUSTUP_HOME $CARGO_HOME
......
...@@ -26,7 +26,7 @@ RUN apt update -y && \ ...@@ -26,7 +26,7 @@ RUN apt update -y && \
ENV RUSTUP_HOME=/usr/local/rustup \ ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \ CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH \ PATH=/usr/local/cargo/bin:$PATH \
RUST_VERSION=1.86.0 \ RUST_VERSION=1.87.0 \
RUSTARCH=x86_64-unknown-linux-gnu RUSTARCH=x86_64-unknown-linux-gnu
RUN wget --tries=3 --waitretry=5 "https://static.rust-lang.org/rustup/archive/1.28.1/${RUSTARCH}/rustup-init" && \ RUN wget --tries=3 --waitretry=5 "https://static.rust-lang.org/rustup/archive/1.28.1/${RUSTARCH}/rustup-init" && \
......
...@@ -194,7 +194,7 @@ RUN apt-get update && \ ...@@ -194,7 +194,7 @@ RUN apt-get update && \
ENV RUSTUP_HOME=/usr/local/rustup \ ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \ CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH \ PATH=/usr/local/cargo/bin:$PATH \
RUST_VERSION=1.86.0 RUST_VERSION=1.87.0
# Define Rust target based on ARCH_ALT ARG # Define Rust target based on ARCH_ALT ARG
ARG RUSTARCH=${ARCH_ALT}-unknown-linux-gnu ARG RUSTARCH=${ARCH_ALT}-unknown-linux-gnu
......
...@@ -246,7 +246,7 @@ RUN apt update -y && \ ...@@ -246,7 +246,7 @@ RUN apt update -y && \
ENV RUSTUP_HOME=/usr/local/rustup \ ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \ CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH \ PATH=/usr/local/cargo/bin:$PATH \
RUST_VERSION=1.86.0 RUST_VERSION=1.87.0
# Define Rust target based on ARCH_ALT ARG # Define Rust target based on ARCH_ALT ARG
ARG RUSTARCH=${ARCH_ALT}-unknown-linux-gnu ARG RUSTARCH=${ARCH_ALT}-unknown-linux-gnu
......
...@@ -357,11 +357,7 @@ impl FullyContiguousConfig { ...@@ -357,11 +357,7 @@ impl FullyContiguousConfig {
/// Calculate the total number of bytes required for allocation, including initial alignment padding. /// Calculate the total number of bytes required for allocation, including initial alignment padding.
/// Panics if the provided configuration is invalid. /// Panics if the provided configuration is invalid.
pub fn required_allocation_size(&self) -> usize { pub fn required_allocation_size(&self) -> usize {
let initial_padding = if self.inner.alignment > 1 { let initial_padding = self.inner.alignment.saturating_sub(1);
self.inner.alignment - 1
} else {
0
};
self.layout_data_bytes + initial_padding self.layout_data_bytes + initial_padding
} }
} }
......
...@@ -22,7 +22,6 @@ use tokio::fs::{self, File, OpenOptions}; ...@@ -22,7 +22,6 @@ use tokio::fs::{self, File, OpenOptions};
use tokio::io::{AsyncBufReadExt, AsyncWriteExt, BufReader, BufWriter}; use tokio::io::{AsyncBufReadExt, AsyncWriteExt, BufReader, BufWriter};
use tokio::sync::{mpsc, Mutex}; use tokio::sync::{mpsc, Mutex};
use tokio_util::sync::CancellationToken; use tokio_util::sync::CancellationToken;
use tracing as log;
/// Record entry that will be serialized to JSONL /// Record entry that will be serialized to JSONL
#[derive(Serialize, Deserialize)] #[derive(Serialize, Deserialize)]
...@@ -116,10 +115,10 @@ where ...@@ -116,10 +115,10 @@ where
// Check time limit if set // Check time limit if set
if let Some(deadline) = max_time_deadline { if let Some(deadline) = max_time_deadline {
if Instant::now() >= deadline { if Instant::now() >= deadline {
log::info!("Recorder reached max time limit, shutting down"); tracing::info!("Recorder reached max time limit, shutting down");
// Flush and cancel // Flush and cancel
if let Err(e) = writer.flush().await { if let Err(e) = writer.flush().await {
log::error!("Failed to flush on time limit shutdown: {}", e); tracing::error!("Failed to flush on time limit shutdown: {}", e);
} }
cancel_clone.cancel(); cancel_clone.cancel();
return; return;
...@@ -132,10 +131,10 @@ where ...@@ -132,10 +131,10 @@ where
_ = cancel_clone.cancelled() => { _ = cancel_clone.cancelled() => {
// Flush any pending writes before shutting down // Flush any pending writes before shutting down
if let Err(e) = writer.flush().await { if let Err(e) = writer.flush().await {
log::error!("Failed to flush on shutdown: {}", e); tracing::error!("Failed to flush on shutdown: {}", e);
} }
log::debug!("Recorder task shutting down"); tracing::debug!("Recorder task shutting down");
return; return;
} }
...@@ -161,20 +160,20 @@ where ...@@ -161,20 +160,20 @@ where
let json = match serde_json::to_string(&entry) { let json = match serde_json::to_string(&entry) {
Ok(json) => json, Ok(json) => json,
Err(e) => { Err(e) => {
log::error!("Failed to serialize event: {}", e); tracing::error!("Failed to serialize event: {}", e);
continue; continue;
} }
}; };
// Write JSON line // Write JSON line
if let Err(e) = writer.write_all(json.as_bytes()).await { if let Err(e) = writer.write_all(json.as_bytes()).await {
log::error!("Failed to write event: {}", e); tracing::error!("Failed to write event: {}", e);
continue; continue;
} }
// Add a newline // Add a newline
if let Err(e) = writer.write_all(b"\n").await { if let Err(e) = writer.write_all(b"\n").await {
log::error!("Failed to write newline: {}", e); tracing::error!("Failed to write newline: {}", e);
continue; continue;
} }
...@@ -186,7 +185,7 @@ where ...@@ -186,7 +185,7 @@ where
if line_count >= max_lines { if line_count >= max_lines {
// Flush the current file // Flush the current file
if let Err(e) = writer.flush().await { if let Err(e) = writer.flush().await {
log::error!("Failed to flush file before rotation: {}", e); tracing::error!("Failed to flush file before rotation: {}", e);
} }
// Create new filename with suffix // Create new filename with suffix
...@@ -204,10 +203,10 @@ where ...@@ -204,10 +203,10 @@ where
Ok(new_file) => { Ok(new_file) => {
writer = BufWriter::with_capacity(32768, new_file); writer = BufWriter::with_capacity(32768, new_file);
line_count = 0; line_count = 0;
log::info!("Rotated to new file: {}", new_path.display()); tracing::info!("Rotated to new file: {}", new_path.display());
}, },
Err(e) => { Err(e) => {
log::error!("Failed to open rotated file {}: {}", new_path.display(), e); tracing::error!("Failed to open rotated file {}: {}", new_path.display(), e);
// Continue with the existing file if rotation fails // Continue with the existing file if rotation fails
} }
} }
...@@ -221,10 +220,10 @@ where ...@@ -221,10 +220,10 @@ where
// Check if we've reached the maximum count // Check if we've reached the maximum count
if let Some(max) = max_count { if let Some(max) = max_count {
if *count >= max { if *count >= max {
log::info!("Recorder reached max event count ({}), shutting down", max); tracing::info!("Recorder reached max event count ({}), shutting down", max);
// Flush buffer before shutting down // Flush buffer before shutting down
if let Err(e) = writer.flush().await { if let Err(e) = writer.flush().await {
log::error!("Failed to flush on count limit shutdown: {}", e); tracing::error!("Failed to flush on count limit shutdown: {}", e);
} }
// Drop the lock before cancelling // Drop the lock before cancelling
drop(count); drop(count);
...@@ -262,10 +261,7 @@ where ...@@ -262,10 +261,7 @@ where
let first_time = self.first_event_time.lock().await; let first_time = self.first_event_time.lock().await;
match *first_time { match *first_time {
Some(time) => Ok(time.elapsed()), Some(time) => Ok(time.elapsed()),
None => Err(io::Error::new( None => Err(io::Error::other("No events received yet")),
io::ErrorKind::Other,
"No events received yet",
)),
} }
} }
...@@ -324,7 +320,7 @@ where ...@@ -324,7 +320,7 @@ where
// Check if we've reached the maximum count // Check if we've reached the maximum count
if let Some(max) = max_count { if let Some(max) = max_count {
if count >= max { if count >= max {
log::info!("Reached maximum event count ({}), stopping", max); tracing::info!("Reached maximum event count ({}), stopping", max);
break; break;
} }
} }
...@@ -332,7 +328,7 @@ where ...@@ -332,7 +328,7 @@ where
// Check if we've exceeded the time limit // Check if we've exceeded the time limit
if let Some(end_time) = deadline { if let Some(end_time) = deadline {
if Instant::now() >= end_time { if Instant::now() >= end_time {
log::info!("Reached maximum time limit, stopping"); tracing::info!("Reached maximum time limit, stopping");
break; break;
} }
} }
...@@ -348,7 +344,7 @@ where ...@@ -348,7 +344,7 @@ where
let record: RecordEntry<T> = match serde_json::from_str(&line) { let record: RecordEntry<T> = match serde_json::from_str(&line) {
Ok(record) => record, Ok(record) => record,
Err(e) => { Err(e) => {
log::warn!( tracing::warn!(
"Failed to parse JSON on line {}: {}. Skipping.", "Failed to parse JSON on line {}: {}. Skipping.",
line_number, line_number,
e e
...@@ -370,9 +366,10 @@ where ...@@ -370,9 +366,10 @@ where
} }
// Send the event // Send the event
event_tx.send(event).await.map_err(|e| { event_tx
io::Error::new(io::ErrorKind::Other, format!("Failed to send event: {}", e)) .send(event)
})?; .await
.map_err(|e| io::Error::other(format!("Failed to send event: {e}")))?;
// Update previous timestamp and count // Update previous timestamp and count
prev_timestamp = Some(timestamp); prev_timestamp = Some(timestamp);
...@@ -380,9 +377,9 @@ where ...@@ -380,9 +377,9 @@ where
} }
if count == 0 { if count == 0 {
log::warn!("No events to send from file: {}", display_name); tracing::warn!("No events to send from file: {}", display_name);
} else { } else {
log::info!("Sent {} events from {}", count, display_name); tracing::info!("Sent {} events from {}", count, display_name);
} }
Ok(count) Ok(count)
......
[toolchain] [toolchain]
channel = "1.86.0" channel = "1.87.0"
[toolchain] [toolchain]
channel = "1.86.0" channel = "1.87.0"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment