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

refactor(meta): use in-memory sqlite for Mem meta backend #18881

Closed
wants to merge 1 commit into from
Closed
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
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
14 changes: 13 additions & 1 deletion src/meta/node/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,10 +271,22 @@ pub fn start(
},
MetaBackend::Sqlite => MetaStoreBackend::Sql {
endpoint: format!(
"sqlite://{}?mode=rwc",
"sqlite://{}{}",
opts.sql_endpoint
.as_ref()
.expect("sql endpoint is required")
.expose_secret(),
if opts
.sql_endpoint
.as_ref()
.unwrap()
.expose_secret()
.contains("mode=memory")
{
""
} else {
"?mode=rwc"
}
),
},
MetaBackend::Postgres => MetaStoreBackend::Sql {
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
Loading