diff --git a/Cargo.lock b/Cargo.lock index fd0e4b0d30..fd980e6dd3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1285,7 +1285,7 @@ dependencies = [ "datafusion", "datafusion-proto", "datafusion-substrait", - "ferroid", + "ferroid 3.1.0", "futures", "graphviz-rust", "http 1.5.0", @@ -3390,10 +3390,21 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ee93edf3c501f0035bbeffeccfed0b79e14c311f12195ec0e661e114a0f60da4" dependencies = [ - "futures", "portable-atomic", - "rand 0.10.4", - "tokio", + "rand 0.10.3", + "web-time", +] + +[[package]] +name = "ferroid" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c63948fb5874d42ea7562d7051437eb22260fccbb502e27a3688cfdae3b9b54" +dependencies = [ + "crossbeam-utils", + "portable-atomic", + "serde", + "tracing", "web-time", ] @@ -5431,9 +5442,9 @@ dependencies = [ [[package]] name = "portable-atomic" -version = "1.14.0" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d20d5497ef88037a52ff98267d066e7f11fcc5e99bbfbd58a42336193aacec3" +checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85" [[package]] name = "portable-atomic-util" @@ -7152,7 +7163,7 @@ dependencies = [ "docker_credential", "either", "etcetera", - "ferroid", + "ferroid 2.0.0", "futures", "http 1.5.0", "itertools 0.14.0", diff --git a/ballista/scheduler/Cargo.toml b/ballista/scheduler/Cargo.toml index 3e6fa82825..bc73192798 100644 --- a/ballista/scheduler/Cargo.toml +++ b/ballista/scheduler/Cargo.toml @@ -81,7 +81,7 @@ dashmap = { workspace = true } datafusion = { workspace = true } datafusion-proto = { workspace = true } datafusion-substrait = { workspace = true, optional = true } -ferroid = { version = "2.0", features = ["alloc", "std", "snowflake", "atomic", "base32", "async-tokio"] } +ferroid = { version = "3", features = ["alloc", "std", "snowflake", "atomic", "base32", "futures"] } futures = { workspace = true } graphviz-rust = { version = "0.9", optional = true } http = "1.4" diff --git a/ballista/scheduler/src/scheduler_server/mod.rs b/ballista/scheduler/src/scheduler_server/mod.rs index 1a79b8d877..a6dc347f81 100644 --- a/ballista/scheduler/src/scheduler_server/mod.rs +++ b/ballista/scheduler/src/scheduler_server/mod.rs @@ -32,11 +32,11 @@ use datafusion::physical_plan::ExecutionPlan; use datafusion::prelude::{SessionConfig, SessionContext}; use datafusion_proto::logical_plan::AsLogicalPlan; use datafusion_proto::physical_plan::AsExecutionPlan; -use ferroid::base32::Base32SnowExt; -use ferroid::futures::SnowflakeGeneratorAsyncTokioExt; +use ferroid::base32::Base32Ext; +use ferroid::futures::SnowflakeGeneratorAsyncExt; use ferroid::generator::AtomicSnowflakeGenerator; use ferroid::id::SnowflakeMastodonId; -use ferroid::time::MonotonicClock; +use ferroid::time::CachedClock; use tokio::sync::broadcast; use crate::cache::{contains_cache, strip_caches}; @@ -98,7 +98,7 @@ pub trait JobIdGenerator: Sync + Send { /// A monotonically increasing sortable snowflake job id generator /// which does not capture machine id as part result. pub(crate) struct DefaultJobGenerator { - generator: AtomicSnowflakeGenerator, + generator: AtomicSnowflakeGenerator, } impl Default for DefaultJobGenerator { @@ -107,7 +107,7 @@ impl Default for DefaultJobGenerator { // setups let generator = AtomicSnowflakeGenerator::new( 0, // machine id is hard-coded to 0 - MonotonicClock::<1>::default(), + CachedClock::default(), ); Self { generator } @@ -117,8 +117,8 @@ impl Default for DefaultJobGenerator { #[async_trait::async_trait] impl JobIdGenerator for DefaultJobGenerator { async fn next_id(&self) -> String { - let id = self.generator.next_id_async().await; - id.encode().to_string() + let id = self.generator.next_id_async(tokio::time::sleep).await; + id.encode().as_string() } }