diff --git a/src/database.rs b/src/database.rs index 6a21e325..2ce6eb7f 100644 --- a/src/database.rs +++ b/src/database.rs @@ -233,61 +233,6 @@ pub(crate) struct KeyValueDatabase { } impl KeyValueDatabase { - fn check_db_setup(config: &Config) -> Result<()> { - let path = Path::new(&config.database.path); - - let sqlite_exists = path - .join(format!( - "{}.db", - if config.conduit_compat { - "conduit" - } else { - "grapevine" - } - )) - .exists(); - let rocksdb_exists = path.join("IDENTITY").exists(); - - let mut count = 0; - - if sqlite_exists { - count += 1; - } - - if rocksdb_exists { - count += 1; - } - - if count > 1 { - warn!("Multiple databases at database_path detected"); - return Ok(()); - } - - let (backend_is_rocksdb, backend_is_sqlite): (bool, bool) = - match config.database.backend { - #[cfg(feature = "rocksdb")] - DatabaseBackend::Rocksdb => (true, false), - #[cfg(feature = "sqlite")] - DatabaseBackend::Sqlite => (false, true), - }; - - if sqlite_exists && !backend_is_sqlite { - return Err(Error::bad_config( - "Found sqlite at database_path, but is not specified in \ - config.", - )); - } - - if rocksdb_exists && !backend_is_rocksdb { - return Err(Error::bad_config( - "Found rocksdb at database_path, but is not specified in \ - config.", - )); - } - - Ok(()) - } - pub(crate) fn load_or_create_engine( config: &Config, ) -> Result> { @@ -296,8 +241,6 @@ impl KeyValueDatabase { "Compiled without support for any databases", )); - Self::check_db_setup(config)?; - if !Path::new(&config.database.path).exists() { fs::create_dir_all(&config.database.path).map_err(|_| { Error::BadConfig(