Skip to content

Commit

Permalink
refactor(meta): use in-memory sqlite for Mem meta backend
Browse files Browse the repository at this point in the history
  • Loading branch information
BugenZhao committed Oct 11, 2024
1 parent b01906e commit ccf26b4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/cmd_all/src/single_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,9 @@ pub fn map_single_node_opts_to_standalone_opts(opts: SingleNodeOpts) -> ParsedSt
};
if !meta_backend_is_set {
if opts.in_memory {
meta_opts.backend = Some(MetaBackend::Mem);
meta_opts.backend = Some(MetaBackend::Sqlite);
meta_opts.sql_endpoint =
Some("meta_backend?mode=memory&cache=shared".to_owned().into());
} else {
meta_opts.backend = Some(MetaBackend::Sqlite);
let meta_store_dir = format!("{}/meta_store", &store_directory);
Expand Down
2 changes: 1 addition & 1 deletion src/meta/node/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ pub fn start(
},
MetaBackend::Sqlite => MetaStoreBackend::Sql {
endpoint: format!(
"sqlite://{}?mode=rwc",
"sqlite://{}",
opts.sql_endpoint
.expect("sql endpoint is required")
.expose_secret()
Expand Down
2 changes: 1 addition & 1 deletion src/meta/src/backup_restore/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ pub async fn get_meta_store(opts: RestoreOpts) -> BackupResult<MetaStoreBackendI
endpoint: opts.sql_endpoint,
},
MetaBackend::Sqlite => MetaStoreBackend::Sql {
endpoint: format!("sqlite://{}?mode=rwc", opts.sql_endpoint),
endpoint: format!("sqlite://{}", opts.sql_endpoint),
},
MetaBackend::Postgres => MetaStoreBackend::Sql {
endpoint: format!(
Expand Down

0 comments on commit ccf26b4

Please sign in to comment.