Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use in-memory storage by default #859

Merged
merged 2 commits into from
Dec 3, 2024
Merged
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
14 changes: 6 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,12 @@ jobs:
~/.cargo/git/db/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-${{ env.CACHE_KEY_SUFFIX }}
- name: Generate TPC-H 1GB dataset
run: |
rm -rf risinglight.db
make tpch
run: make tpch
- name: Build RisingLight (in release mode)
run: |
cargo build --release
run: cargo build --release
- name: Run TPC-H Test
run: |
./target/release/risinglight -f tests/sql/tpch/create.sql
./target/release/risinglight -f tests/sql/tpch/import.sql
./target/release/risinglight -f tests/sql/tpch-full/_tpch_full.slt
rm -rf tpch.db
./target/release/risinglight tpch.db -f tests/sql/tpch/create.sql
./target/release/risinglight tpch.db -f tests/sql/tpch/import.sql
./target/release/risinglight tpch.db -f tests/sql/tpch-full/_tpch_full.slt
20 changes: 7 additions & 13 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,15 @@ use tracing_subscriber::prelude::*;
#[derive(Parser, Debug)]
#[clap(author, version, about, long_about = None)]
struct Args {
/// Where to store the database files
#[clap()]
storage_path: Option<String>,
/// The name of an RisingLight database.
/// A new database is created if the file does not previously exist.
#[clap(default_value = ":memory:")]
filename: String,

/// File to execute. Can be either a SQL `sql` file or sqllogictest `slt` file.
#[clap(short, long)]
file: Option<String>,

/// Whether to use in-memory engine
#[clap(long)]
memory: bool,

/// Control the output format
/// - `text`: plain text
/// - `human`: human readable format
Expand Down Expand Up @@ -326,15 +323,12 @@ async fn main() -> Result<()> {
minitrace::set_reporter(ConsoleReporter, Config::default());
}

let db = if args.memory {
info!("using memory engine");
let db = if args.filename == ":memory:" {
info!("Connected to a transient in-memory database.");
Database::new_in_memory()
} else {
info!("using Secondary engine");
let mut options = SecondaryStorageOptions::default_for_cli();
if let Some(path) = args.storage_path {
options.path = PathBuf::new().join(path);
}
options.path = PathBuf::new().join(args.filename);
Database::new_on_disk(options).await
};

Expand Down
Loading