mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-03-19 06:08:20 +01:00
Make meilitool prefer WithoutTls Env
This commit is contained in:
parent
331dc3d241
commit
7e07cb9de1
@ -11,7 +11,7 @@ use meilisearch_auth::{open_auth_store_env, AuthController};
|
|||||||
use meilisearch_types::batches::Batch;
|
use meilisearch_types::batches::Batch;
|
||||||
use meilisearch_types::heed::types::{Bytes, SerdeJson, Str};
|
use meilisearch_types::heed::types::{Bytes, SerdeJson, Str};
|
||||||
use meilisearch_types::heed::{
|
use meilisearch_types::heed::{
|
||||||
CompactionOption, Database, Env, EnvOpenOptions, RoTxn, RwTxn, TlsUsage, Unspecified,
|
CompactionOption, Database, Env, EnvOpenOptions, RoTxn, RwTxn, Unspecified, WithoutTls,
|
||||||
};
|
};
|
||||||
use meilisearch_types::milli::constants::RESERVED_VECTORS_FIELD_NAME;
|
use meilisearch_types::milli::constants::RESERVED_VECTORS_FIELD_NAME;
|
||||||
use meilisearch_types::milli::documents::{obkv_to_object, DocumentsBatchReader};
|
use meilisearch_types::milli::documents::{obkv_to_object, DocumentsBatchReader};
|
||||||
@ -172,7 +172,7 @@ fn main() -> anyhow::Result<()> {
|
|||||||
/// Clears the task queue located at `db_path`.
|
/// Clears the task queue located at `db_path`.
|
||||||
fn clear_task_queue(db_path: PathBuf) -> anyhow::Result<()> {
|
fn clear_task_queue(db_path: PathBuf) -> anyhow::Result<()> {
|
||||||
let path = db_path.join("tasks");
|
let path = db_path.join("tasks");
|
||||||
let env = unsafe { EnvOpenOptions::new().max_dbs(100).open(&path) }
|
let env = unsafe { EnvOpenOptions::new().read_txn_without_tls().max_dbs(100).open(&path) }
|
||||||
.with_context(|| format!("While trying to open {:?}", path.display()))?;
|
.with_context(|| format!("While trying to open {:?}", path.display()))?;
|
||||||
|
|
||||||
eprintln!("Deleting tasks from the database...");
|
eprintln!("Deleting tasks from the database...");
|
||||||
@ -224,8 +224,8 @@ fn clear_task_queue(db_path: PathBuf) -> anyhow::Result<()> {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn try_opening_database<KC: 'static, DC: 'static, T: TlsUsage>(
|
fn try_opening_database<KC: 'static, DC: 'static>(
|
||||||
env: &Env<T>,
|
env: &Env<WithoutTls>,
|
||||||
rtxn: &RoTxn,
|
rtxn: &RoTxn,
|
||||||
db_name: &str,
|
db_name: &str,
|
||||||
) -> anyhow::Result<Database<KC, DC>> {
|
) -> anyhow::Result<Database<KC, DC>> {
|
||||||
@ -234,8 +234,8 @@ fn try_opening_database<KC: 'static, DC: 'static, T: TlsUsage>(
|
|||||||
.with_context(|| format!("Missing the {db_name:?} database"))
|
.with_context(|| format!("Missing the {db_name:?} database"))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn try_opening_poly_database<T: TlsUsage>(
|
fn try_opening_poly_database(
|
||||||
env: &Env<T>,
|
env: &Env<WithoutTls>,
|
||||||
rtxn: &RoTxn,
|
rtxn: &RoTxn,
|
||||||
db_name: &str,
|
db_name: &str,
|
||||||
) -> anyhow::Result<Database<Unspecified, Unspecified>> {
|
) -> anyhow::Result<Database<Unspecified, Unspecified>> {
|
||||||
@ -284,8 +284,10 @@ fn export_a_dump(
|
|||||||
FileStore::new(db_path.join("update_files")).context("While opening the FileStore")?;
|
FileStore::new(db_path.join("update_files")).context("While opening the FileStore")?;
|
||||||
|
|
||||||
let index_scheduler_path = db_path.join("tasks");
|
let index_scheduler_path = db_path.join("tasks");
|
||||||
let env = unsafe { EnvOpenOptions::new().max_dbs(100).open(&index_scheduler_path) }
|
let env = unsafe {
|
||||||
.with_context(|| format!("While trying to open {:?}", index_scheduler_path.display()))?;
|
EnvOpenOptions::new().read_txn_without_tls().max_dbs(100).open(&index_scheduler_path)
|
||||||
|
}
|
||||||
|
.with_context(|| format!("While trying to open {:?}", index_scheduler_path.display()))?;
|
||||||
|
|
||||||
eprintln!("Dumping the keys...");
|
eprintln!("Dumping the keys...");
|
||||||
|
|
||||||
@ -442,8 +444,10 @@ fn export_a_dump(
|
|||||||
|
|
||||||
fn compact_index(db_path: PathBuf, index_name: &str) -> anyhow::Result<()> {
|
fn compact_index(db_path: PathBuf, index_name: &str) -> anyhow::Result<()> {
|
||||||
let index_scheduler_path = db_path.join("tasks");
|
let index_scheduler_path = db_path.join("tasks");
|
||||||
let env = unsafe { EnvOpenOptions::new().max_dbs(100).open(&index_scheduler_path) }
|
let env = unsafe {
|
||||||
.with_context(|| format!("While trying to open {:?}", index_scheduler_path.display()))?;
|
EnvOpenOptions::new().read_txn_without_tls().max_dbs(100).open(&index_scheduler_path)
|
||||||
|
}
|
||||||
|
.with_context(|| format!("While trying to open {:?}", index_scheduler_path.display()))?;
|
||||||
|
|
||||||
let rtxn = env.read_txn()?;
|
let rtxn = env.read_txn()?;
|
||||||
let index_mapping: Database<Str, UuidCodec> =
|
let index_mapping: Database<Str, UuidCodec> =
|
||||||
@ -519,8 +523,10 @@ fn export_documents(
|
|||||||
offset: Option<usize>,
|
offset: Option<usize>,
|
||||||
) -> anyhow::Result<()> {
|
) -> anyhow::Result<()> {
|
||||||
let index_scheduler_path = db_path.join("tasks");
|
let index_scheduler_path = db_path.join("tasks");
|
||||||
let env = unsafe { EnvOpenOptions::new().max_dbs(100).open(&index_scheduler_path) }
|
let env = unsafe {
|
||||||
.with_context(|| format!("While trying to open {:?}", index_scheduler_path.display()))?;
|
EnvOpenOptions::new().read_txn_without_tls().max_dbs(100).open(&index_scheduler_path)
|
||||||
|
}
|
||||||
|
.with_context(|| format!("While trying to open {:?}", index_scheduler_path.display()))?;
|
||||||
|
|
||||||
let rtxn = env.read_txn()?;
|
let rtxn = env.read_txn()?;
|
||||||
let index_mapping: Database<Str, UuidCodec> =
|
let index_mapping: Database<Str, UuidCodec> =
|
||||||
@ -622,8 +628,10 @@ fn hair_dryer(
|
|||||||
index_parts: &[IndexPart],
|
index_parts: &[IndexPart],
|
||||||
) -> anyhow::Result<()> {
|
) -> anyhow::Result<()> {
|
||||||
let index_scheduler_path = db_path.join("tasks");
|
let index_scheduler_path = db_path.join("tasks");
|
||||||
let env = unsafe { EnvOpenOptions::new().max_dbs(100).open(&index_scheduler_path) }
|
let env = unsafe {
|
||||||
.with_context(|| format!("While trying to open {:?}", index_scheduler_path.display()))?;
|
EnvOpenOptions::new().read_txn_without_tls().max_dbs(100).open(&index_scheduler_path)
|
||||||
|
}
|
||||||
|
.with_context(|| format!("While trying to open {:?}", index_scheduler_path.display()))?;
|
||||||
|
|
||||||
eprintln!("Trying to get a read transaction on the index scheduler...");
|
eprintln!("Trying to get a read transaction on the index scheduler...");
|
||||||
|
|
||||||
|
@ -2,7 +2,9 @@ use std::path::Path;
|
|||||||
|
|
||||||
use anyhow::{bail, Context};
|
use anyhow::{bail, Context};
|
||||||
use meilisearch_types::heed::types::{SerdeJson, Str};
|
use meilisearch_types::heed::types::{SerdeJson, Str};
|
||||||
use meilisearch_types::heed::{Database, Env, EnvOpenOptions, RoTxn, RwTxn, TlsUsage, Unspecified};
|
use meilisearch_types::heed::{
|
||||||
|
Database, Env, EnvOpenOptions, RoTxn, RwTxn, Unspecified, WithoutTls,
|
||||||
|
};
|
||||||
use meilisearch_types::milli::index::{db_name, main_key};
|
use meilisearch_types::milli::index::{db_name, main_key};
|
||||||
|
|
||||||
use super::v1_9;
|
use super::v1_9;
|
||||||
@ -90,9 +92,9 @@ fn update_index_stats(
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn update_date_format<T: TlsUsage>(
|
fn update_date_format(
|
||||||
index_uid: &str,
|
index_uid: &str,
|
||||||
index_env: &Env<T>,
|
index_env: &Env<WithoutTls>,
|
||||||
index_wtxn: &mut RwTxn,
|
index_wtxn: &mut RwTxn,
|
||||||
) -> anyhow::Result<()> {
|
) -> anyhow::Result<()> {
|
||||||
let main = try_opening_poly_database(index_env, index_wtxn, db_name::MAIN)
|
let main = try_opening_poly_database(index_env, index_wtxn, db_name::MAIN)
|
||||||
@ -104,9 +106,9 @@ fn update_date_format<T: TlsUsage>(
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn find_rest_embedders<T: TlsUsage>(
|
fn find_rest_embedders(
|
||||||
index_uid: &str,
|
index_uid: &str,
|
||||||
index_env: &Env<T>,
|
index_env: &Env<WithoutTls>,
|
||||||
index_txn: &RoTxn,
|
index_txn: &RoTxn,
|
||||||
) -> anyhow::Result<Vec<String>> {
|
) -> anyhow::Result<Vec<String>> {
|
||||||
let main = try_opening_poly_database(index_env, index_txn, db_name::MAIN)
|
let main = try_opening_poly_database(index_env, index_txn, db_name::MAIN)
|
||||||
@ -164,8 +166,10 @@ pub fn v1_9_to_v1_10(
|
|||||||
// 2. REST embedders. We don't support this case right now, so bail
|
// 2. REST embedders. We don't support this case right now, so bail
|
||||||
|
|
||||||
let index_scheduler_path = db_path.join("tasks");
|
let index_scheduler_path = db_path.join("tasks");
|
||||||
let env = unsafe { EnvOpenOptions::new().max_dbs(100).open(&index_scheduler_path) }
|
let env = unsafe {
|
||||||
.with_context(|| format!("While trying to open {:?}", index_scheduler_path.display()))?;
|
EnvOpenOptions::new().read_txn_without_tls().max_dbs(100).open(&index_scheduler_path)
|
||||||
|
}
|
||||||
|
.with_context(|| format!("While trying to open {:?}", index_scheduler_path.display()))?;
|
||||||
|
|
||||||
let mut sched_wtxn = env.write_txn()?;
|
let mut sched_wtxn = env.write_txn()?;
|
||||||
|
|
||||||
@ -205,9 +209,13 @@ pub fn v1_9_to_v1_10(
|
|||||||
|
|
||||||
let index_env = unsafe {
|
let index_env = unsafe {
|
||||||
// FIXME: fetch the 25 magic number from the index file
|
// FIXME: fetch the 25 magic number from the index file
|
||||||
EnvOpenOptions::new().max_dbs(25).open(&index_path).with_context(|| {
|
EnvOpenOptions::new()
|
||||||
format!("while opening index {uid} at '{}'", index_path.display())
|
.read_txn_without_tls()
|
||||||
})?
|
.max_dbs(25)
|
||||||
|
.open(&index_path)
|
||||||
|
.with_context(|| {
|
||||||
|
format!("while opening index {uid} at '{}'", index_path.display())
|
||||||
|
})?
|
||||||
};
|
};
|
||||||
|
|
||||||
let index_txn = index_env.read_txn().with_context(|| {
|
let index_txn = index_env.read_txn().with_context(|| {
|
||||||
@ -252,9 +260,13 @@ pub fn v1_9_to_v1_10(
|
|||||||
|
|
||||||
let index_env = unsafe {
|
let index_env = unsafe {
|
||||||
// FIXME: fetch the 25 magic number from the index file
|
// FIXME: fetch the 25 magic number from the index file
|
||||||
EnvOpenOptions::new().max_dbs(25).open(&index_path).with_context(|| {
|
EnvOpenOptions::new()
|
||||||
format!("while opening index {uid} at '{}'", index_path.display())
|
.read_txn_without_tls()
|
||||||
})?
|
.max_dbs(25)
|
||||||
|
.open(&index_path)
|
||||||
|
.with_context(|| {
|
||||||
|
format!("while opening index {uid} at '{}'", index_path.display())
|
||||||
|
})?
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut index_wtxn = index_env.write_txn().with_context(|| {
|
let mut index_wtxn = index_env.write_txn().with_context(|| {
|
||||||
|
@ -23,8 +23,10 @@ pub fn v1_10_to_v1_11(
|
|||||||
println!("Upgrading from v1.10.0 to v1.11.0");
|
println!("Upgrading from v1.10.0 to v1.11.0");
|
||||||
|
|
||||||
let index_scheduler_path = db_path.join("tasks");
|
let index_scheduler_path = db_path.join("tasks");
|
||||||
let env = unsafe { EnvOpenOptions::new().max_dbs(100).open(&index_scheduler_path) }
|
let env = unsafe {
|
||||||
.with_context(|| format!("While trying to open {:?}", index_scheduler_path.display()))?;
|
EnvOpenOptions::new().read_txn_without_tls().max_dbs(100).open(&index_scheduler_path)
|
||||||
|
}
|
||||||
|
.with_context(|| format!("While trying to open {:?}", index_scheduler_path.display()))?;
|
||||||
|
|
||||||
let sched_rtxn = env.read_txn()?;
|
let sched_rtxn = env.read_txn()?;
|
||||||
|
|
||||||
@ -50,9 +52,13 @@ pub fn v1_10_to_v1_11(
|
|||||||
);
|
);
|
||||||
|
|
||||||
let index_env = unsafe {
|
let index_env = unsafe {
|
||||||
EnvOpenOptions::new().max_dbs(25).open(&index_path).with_context(|| {
|
EnvOpenOptions::new()
|
||||||
format!("while opening index {uid} at '{}'", index_path.display())
|
.read_txn_without_tls()
|
||||||
})?
|
.max_dbs(25)
|
||||||
|
.open(&index_path)
|
||||||
|
.with_context(|| {
|
||||||
|
format!("while opening index {uid} at '{}'", index_path.display())
|
||||||
|
})?
|
||||||
};
|
};
|
||||||
|
|
||||||
let index_rtxn = index_env.read_txn().with_context(|| {
|
let index_rtxn = index_env.read_txn().with_context(|| {
|
||||||
|
@ -115,8 +115,10 @@ fn convert_update_files(db_path: &Path) -> anyhow::Result<()> {
|
|||||||
/// Rebuild field distribution as it was wrongly computed in v1.12.x if x < 3
|
/// Rebuild field distribution as it was wrongly computed in v1.12.x if x < 3
|
||||||
fn rebuild_field_distribution(db_path: &Path) -> anyhow::Result<()> {
|
fn rebuild_field_distribution(db_path: &Path) -> anyhow::Result<()> {
|
||||||
let index_scheduler_path = db_path.join("tasks");
|
let index_scheduler_path = db_path.join("tasks");
|
||||||
let env = unsafe { EnvOpenOptions::new().max_dbs(100).open(&index_scheduler_path) }
|
let env = unsafe {
|
||||||
.with_context(|| format!("While trying to open {:?}", index_scheduler_path.display()))?;
|
EnvOpenOptions::new().read_txn_without_tls().max_dbs(100).open(&index_scheduler_path)
|
||||||
|
}
|
||||||
|
.with_context(|| format!("While trying to open {:?}", index_scheduler_path.display()))?;
|
||||||
|
|
||||||
let mut sched_wtxn = env.write_txn()?;
|
let mut sched_wtxn = env.write_txn()?;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user