@@ -110,14 +110,17 @@ fn default_i32(val: i32, default: i32) -> i32 {
110110/// cache-budget configuration. This function delegates to `fff_create_instance2`
111111/// with NULL log paths and auto cache budget, so behaviour is unchanged.
112112///
113+ /// The `use_unsafe_no_lock` parameter is deprecated and ignored; see
114+ /// [`fff_create_instance2`] for details.
115+ ///
113116/// ## Safety
114117/// See `fff_create_instance2`.
115118#[ unsafe( no_mangle) ]
116119pub unsafe extern "C" fn fff_create_instance (
117120 base_path : * const c_char ,
118121 frecency_db_path : * const c_char ,
119122 history_db_path : * const c_char ,
120- use_unsafe_no_lock : bool ,
123+ _use_unsafe_no_lock : bool ,
121124 enable_mmap_cache : bool ,
122125 enable_content_indexing : bool ,
123126 watch : bool ,
@@ -128,7 +131,7 @@ pub unsafe extern "C" fn fff_create_instance(
128131 base_path,
129132 frecency_db_path,
130133 history_db_path,
131- use_unsafe_no_lock ,
134+ false ,
132135 enable_mmap_cache,
133136 enable_content_indexing,
134137 watch,
@@ -152,7 +155,11 @@ pub unsafe extern "C" fn fff_create_instance(
152155/// * `base_path` – directory to index (required)
153156/// * `frecency_db_path` – frecency LMDB database path (NULL/empty to skip)
154157/// * `history_db_path` – query history LMDB database path (NULL/empty to skip)
155- /// * `use_unsafe_no_lock` – use MDB_NOLOCK for LMDB (useful in single-process setups)
158+ /// * `use_unsafe_no_lock` – **deprecated, ignored.** Previously enabled
159+ /// `MDB_NOLOCK|MDB_NOSYNC|MDB_NOMETASYNC` for LMDB; benchmarks showed no
160+ /// measurable win under realistic contention, so the flag is now a no-op.
161+ /// The parameter remains in the signature for ABI compatibility and will be
162+ /// removed in a future release.
156163/// * `enable_mmap_cache` – pre-populate mmap caches after the initial scan
157164/// * `enable_content_indexing` – build content index after the initial scan
158165/// * `watch` – start a background file-system watcher for live updates
@@ -177,7 +184,7 @@ pub unsafe extern "C" fn fff_create_instance2(
177184 base_path : * const c_char ,
178185 frecency_db_path : * const c_char ,
179186 history_db_path : * const c_char ,
180- use_unsafe_no_lock : bool ,
187+ _use_unsafe_no_lock : bool ,
181188 enable_mmap_cache : bool ,
182189 enable_content_indexing : bool ,
183190 watch : bool ,
@@ -214,12 +221,12 @@ pub unsafe extern "C" fn fff_create_instance2(
214221 let _ = std:: fs:: create_dir_all ( parent) ;
215222 }
216223
217- match FrecencyTracker :: new ( frecency_path, use_unsafe_no_lock ) {
224+ match FrecencyTracker :: open ( frecency_path) {
218225 Ok ( tracker) => {
219226 if let Err ( e) = shared_frecency. init ( tracker) {
220227 return FffResult :: err ( & format ! ( "Failed to acquire frecency lock: {}" , e) ) ;
221228 }
222- let _ = shared_frecency. spawn_gc ( frecency_path. clone ( ) , use_unsafe_no_lock ) ;
229+ let _ = shared_frecency. spawn_gc ( frecency_path. clone ( ) ) ;
223230 }
224231 Err ( e) => return FffResult :: err ( & format ! ( "Failed to init frecency db: {}" , e) ) ,
225232 }
@@ -231,7 +238,7 @@ pub unsafe extern "C" fn fff_create_instance2(
231238 let _ = std:: fs:: create_dir_all ( parent) ;
232239 }
233240
234- match QueryTracker :: new ( history_path, use_unsafe_no_lock ) {
241+ match QueryTracker :: open ( history_path) {
235242 Ok ( tracker) => {
236243 if let Err ( e) = query_tracker. init ( tracker) {
237244 return FffResult :: err ( & format ! ( "Failed to acquire query tracker lock: {}" , e) ) ;
0 commit comments