mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-27 07:14:26 +01:00
Merge pull request #196 from meilisearch/fix-cf-handle-creation
Create the Column Family only when it doesn't already exist
This commit is contained in:
commit
1e2ef06c5c
@ -17,9 +17,12 @@ struct CfTreeInner {
|
|||||||
impl CfTree {
|
impl CfTree {
|
||||||
pub fn create(db: Arc<rocksdb::DB>, name: String) -> RocksDbResult<CfTree> {
|
pub fn create(db: Arc<rocksdb::DB>, name: String) -> RocksDbResult<CfTree> {
|
||||||
let mut options = rocksdb::Options::default();
|
let mut options = rocksdb::Options::default();
|
||||||
options.create_missing_column_families(true);
|
options.create_missing_column_families(true); // this doesn't work
|
||||||
|
|
||||||
|
if db.cf_handle(&name).is_none() {
|
||||||
|
let _cf = db.create_cf(&name, &options)?;
|
||||||
|
}
|
||||||
|
|
||||||
let _cf = db.create_cf(&name, &options)?;
|
|
||||||
let index = Arc::new(CfTreeInner { db, name });
|
let index = Arc::new(CfTreeInner { db, name });
|
||||||
|
|
||||||
Ok(CfTree { index, sender: None })
|
Ok(CfTree { index, sender: None })
|
||||||
@ -31,9 +34,12 @@ impl CfTree {
|
|||||||
) -> RocksDbResult<(CfTree, Receiver<()>)>
|
) -> RocksDbResult<(CfTree, Receiver<()>)>
|
||||||
{
|
{
|
||||||
let mut options = rocksdb::Options::default();
|
let mut options = rocksdb::Options::default();
|
||||||
options.create_missing_column_families(true);
|
options.create_missing_column_families(true); // this doesn't work
|
||||||
|
|
||||||
|
if db.cf_handle(&name).is_none() {
|
||||||
|
let _cf = db.create_cf(&name, &options)?;
|
||||||
|
}
|
||||||
|
|
||||||
let _cf = db.create_cf(&name, &options)?;
|
|
||||||
let index = Arc::new(CfTreeInner { db, name });
|
let index = Arc::new(CfTreeInner { db, name });
|
||||||
let (sender, receiver) = unbounded();
|
let (sender, receiver) = unbounded();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user