diff --git a/crates/index-scheduler/src/lib.rs b/crates/index-scheduler/src/lib.rs index 636615858..70b280301 100644 --- a/crates/index-scheduler/src/lib.rs +++ b/crates/index-scheduler/src/lib.rs @@ -209,7 +209,7 @@ impl IndexScheduler { #[allow(private_interfaces)] // because test_utils is private pub fn new( options: IndexSchedulerOptions, - auth_env: Env, + auth_env: Env, from_db_version: (u32, u32, u32), #[cfg(test)] test_breakpoint_sdr: crossbeam_channel::Sender<(test_utils::Breakpoint, bool)>, #[cfg(test)] planned_failures: Vec<(usize, test_utils::FailureLocation)>, diff --git a/crates/index-scheduler/src/scheduler/mod.rs b/crates/index-scheduler/src/scheduler/mod.rs index 1237b22c4..68591d664 100644 --- a/crates/index-scheduler/src/scheduler/mod.rs +++ b/crates/index-scheduler/src/scheduler/mod.rs @@ -21,7 +21,7 @@ use std::sync::atomic::{AtomicBool, AtomicU32, Ordering}; use std::sync::Arc; use meilisearch_types::error::ResponseError; -use meilisearch_types::heed::Env; +use meilisearch_types::heed::{Env, WithoutTls}; use meilisearch_types::milli; use meilisearch_types::tasks::Status; use rayon::current_num_threads; @@ -72,7 +72,7 @@ pub struct Scheduler { pub(crate) snapshots_path: PathBuf, /// The path to the folder containing the auth LMDB env. - pub(crate) auth_env: Env, + pub(crate) auth_env: Env, /// The path to the version file of Meilisearch. pub(crate) version_file_path: PathBuf, @@ -93,7 +93,7 @@ impl Scheduler { } } - pub fn new(options: &IndexSchedulerOptions, auth_env: Env) -> Scheduler { + pub fn new(options: &IndexSchedulerOptions, auth_env: Env) -> Scheduler { Scheduler { must_stop_processing: MustStopProcessing::default(), // we want to start the loop right away in case meilisearch was ctrl+Ced while processing things diff --git a/crates/meilisearch-auth/src/dump.rs b/crates/meilisearch-auth/src/dump.rs index d73b5cf09..6a71b636e 100644 --- a/crates/meilisearch-auth/src/dump.rs +++ b/crates/meilisearch-auth/src/dump.rs @@ -2,7 +2,7 @@ use std::fs::File; use std::io::{BufReader, Write}; use std::path::Path; -use meilisearch_types::heed::Env; +use meilisearch_types::heed::{Env, WithoutTls}; use serde_json::Deserializer; use crate::{AuthController, HeedAuthStore, Result}; @@ -10,7 +10,7 @@ use crate::{AuthController, HeedAuthStore, Result}; const KEYS_PATH: &str = "keys"; impl AuthController { - pub fn dump(auth_env: Env, dst: impl AsRef) -> Result<()> { + pub fn dump(auth_env: Env, dst: impl AsRef) -> Result<()> { let store = HeedAuthStore::new(auth_env)?; let keys_file_path = dst.as_ref().join(KEYS_PATH); @@ -25,7 +25,7 @@ impl AuthController { Ok(()) } - pub fn load_dump(src: impl AsRef, auth_env: Env) -> Result<()> { + pub fn load_dump(src: impl AsRef, auth_env: Env) -> Result<()> { let store = HeedAuthStore::new(auth_env)?; let keys_file_path = src.as_ref().join(KEYS_PATH); diff --git a/crates/meilisearch-auth/src/lib.rs b/crates/meilisearch-auth/src/lib.rs index 8e2445703..01c986d9f 100644 --- a/crates/meilisearch-auth/src/lib.rs +++ b/crates/meilisearch-auth/src/lib.rs @@ -6,7 +6,7 @@ use std::collections::{HashMap, HashSet}; use error::{AuthControllerError, Result}; use maplit::hashset; -use meilisearch_types::heed::Env; +use meilisearch_types::heed::{Env, WithoutTls}; use meilisearch_types::index_uid_pattern::IndexUidPattern; use meilisearch_types::keys::{Action, CreateApiKey, Key, PatchApiKey}; use meilisearch_types::milli::update::Setting; @@ -23,7 +23,7 @@ pub struct AuthController { } impl AuthController { - pub fn new(auth_env: Env, master_key: &Option) -> Result { + pub fn new(auth_env: Env, master_key: &Option) -> Result { let store = HeedAuthStore::new(auth_env)?; if store.is_empty()? { diff --git a/crates/meilisearch-auth/src/store.rs b/crates/meilisearch-auth/src/store.rs index 6fcd43cb6..2fd380194 100644 --- a/crates/meilisearch-auth/src/store.rs +++ b/crates/meilisearch-auth/src/store.rs @@ -7,10 +7,10 @@ use std::str; use std::str::FromStr; use hmac::{Hmac, Mac}; -use meilisearch_types::heed::BoxedError; +use meilisearch_types::heed::{BoxedError, WithoutTls}; use meilisearch_types::index_uid_pattern::IndexUidPattern; use meilisearch_types::keys::KeyId; -use meilisearch_types::milli; +use meilisearch_types::milli::heed; use meilisearch_types::milli::heed::types::{Bytes, DecodeIgnore, SerdeJson}; use meilisearch_types::milli::heed::{Database, Env, EnvOpenOptions, RwTxn}; use sha2::Sha256; @@ -28,20 +28,21 @@ const KEY_ID_ACTION_INDEX_EXPIRATION_DB_NAME: &str = "keyid-action-index-expirat #[derive(Clone)] pub struct HeedAuthStore { - env: Env, + env: Env, keys: Database>, action_keyid_index_expiration: Database>>, } -pub fn open_auth_store_env(path: &Path) -> milli::heed::Result { - let mut options = EnvOpenOptions::new(); +pub fn open_auth_store_env(path: &Path) -> heed::Result> { + let options = EnvOpenOptions::new(); + let mut options = options.read_txn_without_tls(); options.map_size(AUTH_STORE_SIZE); // 1GB options.max_dbs(2); unsafe { options.open(path) } } impl HeedAuthStore { - pub fn new(env: Env) -> Result { + pub fn new(env: Env) -> Result { let mut wtxn = env.write_txn()?; let keys = env.create_database(&mut wtxn, Some(KEY_DB_NAME))?; let action_keyid_index_expiration = @@ -274,7 +275,7 @@ impl HeedAuthStore { /// optionally on a specific index, for a given key. pub struct KeyIdActionCodec; -impl<'a> milli::heed::BytesDecode<'a> for KeyIdActionCodec { +impl<'a> heed::BytesDecode<'a> for KeyIdActionCodec { type DItem = (KeyId, Action, Option<&'a [u8]>); fn bytes_decode(bytes: &'a [u8]) -> StdResult { @@ -291,7 +292,7 @@ impl<'a> milli::heed::BytesDecode<'a> for KeyIdActionCodec { } } -impl<'a> milli::heed::BytesEncode<'a> for KeyIdActionCodec { +impl<'a> heed::BytesEncode<'a> for KeyIdActionCodec { type EItem = (&'a KeyId, &'a Action, Option<&'a [u8]>); fn bytes_encode((key_id, action, index): &Self::EItem) -> StdResult, BoxedError> {