Skip to content
Snippets Groups Projects
Commit 7638bbc4 authored by Jason Volk's avatar Jason Volk
Browse files

keep column list lexically sorted


Signed-off-by: default avatarJason Volk <jason@zemos.net>
parent 35049c94
No related branches found
No related tags found
4 merge requests!480Misc,!475Room Alias related,!476Misc Admin related,!462SQLighter 🔥
use std::{ use std::{
collections::{HashMap, HashSet}, collections::{BTreeSet, HashMap},
fmt::Write, fmt::Write,
sync::{atomic::AtomicU32, Arc, Mutex, RwLock}, sync::{atomic::AtomicU32, Arc, Mutex, RwLock},
}; };
...@@ -23,7 +23,7 @@ pub struct Engine { ...@@ -23,7 +23,7 @@ pub struct Engine {
col_cache: RwLock<HashMap<String, Cache>>, col_cache: RwLock<HashMap<String, Cache>>,
opts: Options, opts: Options,
env: Env, env: Env,
cfs: Mutex<HashSet<String>>, cfs: Mutex<BTreeSet<String>>,
pub(crate) db: Db, pub(crate) db: Db,
corks: AtomicU32, corks: AtomicU32,
} }
...@@ -57,7 +57,10 @@ pub(crate) fn open(server: &Arc<Server>) -> Result<Arc<Self>> { ...@@ -57,7 +57,10 @@ pub(crate) fn open(server: &Arc<Server>) -> Result<Arc<Self>> {
} }
debug!("Listing column families in database"); debug!("Listing column families in database");
let cfs = Db::list_cf(&db_opts, &config.database_path).unwrap_or_default(); let cfs = Db::list_cf(&db_opts, &config.database_path)
.unwrap_or_default()
.into_iter()
.collect::<BTreeSet<_>>();
debug!("Opening {} column family descriptors in database", cfs.len()); debug!("Opening {} column family descriptors in database", cfs.len());
let cfds = cfs let cfds = cfs
...@@ -79,7 +82,6 @@ pub(crate) fn open(server: &Arc<Server>) -> Result<Arc<Self>> { ...@@ -79,7 +82,6 @@ pub(crate) fn open(server: &Arc<Server>) -> Result<Arc<Self>> {
load_time.elapsed() load_time.elapsed()
); );
let cfs = HashSet::<String>::from_iter(cfs);
Ok(Arc::new(Self { Ok(Arc::new(Self {
server: server.clone(), server: server.clone(),
row_cache, row_cache,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment