Skip to content

Commit

Permalink
Initial WiredTiger tasks DB implementation
Browse files Browse the repository at this point in the history
Tests pass, but uncovered some maybe-bugs in the scheduler around forked tasks.

(Also design problem when reconstituting... these tasks need a Session that isn't NoopSession if they do background `notify` events. But how to get one?)
  • Loading branch information
rdaum committed Jul 1, 2024
1 parent b92311d commit 1bfa5d5
Show file tree
Hide file tree
Showing 8 changed files with 514 additions and 10 deletions.
25 changes: 23 additions & 2 deletions crates/daemon/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ use crate::rpc_server::zmq_loop;

#[cfg(feature = "relbox")]
use moor_db_relbox::RelBoxDatabaseBuilder;
use moor_kernel::tasks::NoopTasksDb;
use moor_kernel::tasks::{TasksDb};

mod connections;

Expand All @@ -45,6 +45,7 @@ mod connections_rb;
mod connections_wt;
mod rpc_server;
mod rpc_session;
mod tasks_wt;

#[macro_export]
macro_rules! clap_enum_variants {
Expand Down Expand Up @@ -84,6 +85,16 @@ struct Args {
)]
connections_file: PathBuf,

#[arg(
short = 'x',
long,
value_name = "tasks-db",
help = "Path to persistent tasks database to use or create",
value_hint = ValueHint::FilePath,
default_value = "tasks.db"
)]
tasks_db: PathBuf,

#[arg(
long,
value_name = "rpc-listen",
Expand Down Expand Up @@ -271,7 +282,17 @@ fn main() -> Result<(), Report> {
textdump_output: args.textdump_out,
};

let tasks_db = Box::new(NoopTasksDb {});
let tasks_db: Box<dyn TasksDb> = match args.db_flavour {
DatabaseFlavour::WiredTiger => {
let (tasks_db, _) = tasks_wt::WiredTigerTasksDb::open(Some(&args.tasks_db));
Box::new(tasks_db)
}
#[cfg(feature = "relbox")]
DatabaseFlavour::RelBox => {
warn!("RelBox does not support tasks persistence yet. Using a no-op tasks database. Suspended tasks will not resume on restart.");
Box::new(NoopTasksDb {})

Check failure on line 293 in crates/daemon/src/main.rs

View workflow job for this annotation

GitHub Actions / clippy

cannot find struct, variant or union type `NoopTasksDb` in this scope

error[E0422]: cannot find struct, variant or union type `NoopTasksDb` in this scope --> crates/daemon/src/main.rs:293:22 | 293 | Box::new(NoopTasksDb {}) | ^^^^^^^^^^^ not found in this scope | help: consider importing this struct | 15 + use moor_kernel::tasks::NoopTasksDb; |
}
};

// The pieces from core we're going to use:
// Our DB.
Expand Down
Loading

0 comments on commit 1bfa5d5

Please sign in to comment.