Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 18 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ballista/scheduler/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
14 changes: 7 additions & 7 deletions ballista/scheduler/src/scheduler_server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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<SnowflakeMastodonId, MonotonicClock>,
generator: AtomicSnowflakeGenerator<SnowflakeMastodonId, CachedClock>,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CachedClock or DirectClock 🤔 starting a thread or reading time on every call?

}

impl Default for DefaultJobGenerator {
Expand All @@ -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 }
Expand All @@ -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()
}
}

Expand Down
Loading