Mercurial > lbo > hg > leveldb-rs
changeset 360:803cd9917c82
db_impl: Fix infinite looping in compaction code.
author | Lewin Bormann <lbo@spheniscida.de> |
---|---|
date | Fri, 06 Oct 2017 06:14:28 +0000 |
parents | c2487d69ede0 |
children | d1427db7cd72 |
files | src/db_impl.rs |
diffstat | 1 files changed, 9 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/db_impl.rs Fri Oct 06 06:13:20 2017 +0000 +++ b/src/db_impl.rs Fri Oct 06 06:14:28 2017 +0000 @@ -698,6 +698,9 @@ // Parsing failed. log!(self.opt.log, "Encountered seq=0 in key: {:?}", &key); last_seq_for_key = MAX_SEQUENCE_NUMBER; + have_ukey = false; + current_ukey.clear(); + input.advance(); continue; } @@ -711,10 +714,16 @@ // We can omit the key under the following conditions: if last_seq_for_key <= cs.smallest_seq { + last_seq_for_key = seq; + input.advance(); continue; } + // Entry is deletion; no older version is observable by any snapshot; and all entries + // in compacted levels with smaller sequence numbers will if ktyp == ValueType::TypeDeletion && seq <= cs.smallest_seq && cs.compaction.is_base_level_for(ukey) { + last_seq_for_key = seq; + input.advance(); continue; }