Protect correct lifetime for lock file
@@ -126,6 +126,7 @@ struct TiKVServer {
region_info_accessor: RegionInfoAccessor,
coprocessor_host: Option<CoprocessorHost>,
to_stop: Vec<Box<dyn Stop>>,
+ lock_file: Option<File>,
}
struct Engines {
@@ -185,6 +186,7 @@ impl TiKVServer {
region_info_accessor,
coprocessor_host,
to_stop: vec![Box::new(resolve_worker)],
+ lock_file: None,
}
}
@@ -292,7 +294,7 @@ impl TiKVServer {
pd_client
}
- fn init_fs(&self) {
+ fn init_fs(&mut self) {
let lock_path = self.store_path.join(Path::new("LOCK"));
let f = File::create(lock_path.as_path())
@@ -303,6 +305,7 @@ impl TiKVServer {
self.store_path.display()
);
}
+ self.lock_file = Some(f);
if tikv_util::panic_mark_file_exists(&self.config.storage.data_dir) {
fatal!(
