From 6e2eec012ff330796be6ba362c908bb2872facff Mon Sep 17 00:00:00 2001 From: Charles Hall Date: Tue, 21 May 2024 17:56:56 -0700 Subject: [PATCH] special case `userroomid_highlightcount` This fixes the panic on startup with a fresh database. --- src/database/abstraction/rocksdb.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/database/abstraction/rocksdb.rs b/src/database/abstraction/rocksdb.rs index 176e56ea..12e98ed6 100644 --- a/src/database/abstraction/rocksdb.rs +++ b/src/database/abstraction/rocksdb.rs @@ -116,11 +116,15 @@ impl KeyValueDatabaseEngine for Arc { let created_already = !new_cfs.insert(name); assert!( - !created_already, + // userroomid_highlightcount is special-cased because it is an + // existing violation of this check that happens to work anyway. We + // should write a database migration to obviate the need for this. + !(created_already && name != "userroomid_highlightcount"), "detected attempt to alias column family: {name}", ); - if !self.old_cfs.contains(&name.to_owned()) { + // Remove `&& !created_already` when the above is addressed + if !self.old_cfs.contains(&name.to_owned()) && !created_already { // Create if it didn't exist self.rocks .create_cf(name, &db_options(self.max_open_files, &self.cache))