Mercurial > lbo > hg > leveldb-rs
changeset 290:4c403f9e8391
version_set: Fix bug in how reusing the manifest was reported.
This bug led to manifests not being written when they should have been.
author | Lewin Bormann <lbo@spheniscida.de> |
---|---|
date | Tue, 26 Sep 2017 19:00:23 +0200 |
parents | 5b720657f8cc |
children | d2a96aac4edf |
files | src/version_set.rs |
diffstat | 1 files changed, 9 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/version_set.rs Tue Sep 26 18:59:21 2017 +0200 +++ b/src/version_set.rs Tue Sep 26 19:00:23 2017 +0200 @@ -523,7 +523,7 @@ } /// recover recovers the state of a LevelDB instance from the files on disk. If recover() - /// returns true, proceed with calling log_and_apply(). + /// returns true, the a manifest needs to be written eventually (using log_and_apply()). pub fn recover(&mut self) -> Result<bool> { assert!(self.current.is_some()); @@ -587,8 +587,15 @@ self.finalize(&mut v); self.add_version(v); self.manifest_num = self.next_file_num - 1; + log!(self.opt.log, + "Recovered manifest with next_file={} manifest_num={} log_num={} last_seq={}", + self.next_file_num, + self.manifest_num, + self.log_num, + self.last_seq); - Ok(self.reuse_manifest(&descfilename, ¤t)) + // A new manifest needs to be written only if we don't reuse the existing one. + Ok(!self.reuse_manifest(&descfilename, ¤t)) } /// reuse_manifest checks whether the current manifest can be reused.