• Y
    Fix a bug of CompactionIterator/CompactionFilter using `Delete` (#9929) · 06394ff4
    Yanqin Jin 提交于
    Summary:
    When compaction filter determines that a key should be removed, it updates the internal key's type
    to `Delete`. If this internal key is preserved in current compaction but seen by a later compaction
    together with `SingleDelete`, it will cause compaction iterator to return Corruption.
    
    To fix the issue, compaction filter should return more information in addition to the intention of removing
    a key. Therefore, we add a new `kRemoveWithSingleDelete` to `CompactionFilter::Decision`. Seeing
    `kRemoveWithSingleDelete`, compaction iterator will update the op type of the internal key to `kTypeSingleDelete`.
    
    In addition, I updated db_stress_shared_state.[cc|h] so that `no_overwrite_ids_` becomes `const`. It is easier to
    reason about thread-safety if accessed from multiple threads. This information is passed to `PrepareTxnDBOptions()`
    when calling from `Open()` so that we can set up the rollback deletion type callback for transactions.
    
    Finally, disable compaction filter for multiops_txn because the key removal logic of `DbStressCompactionFilter` does
    not quite work with `MultiOpsTxnsStressTest`.
    
    Pull Request resolved: https://github.com/facebook/rocksdb/pull/9929
    
    Test Plan:
    make check
    make crash_test
    make crash_test_with_txn
    
    Reviewed By: anand1976
    
    Differential Revision: D36069678
    
    Pulled By: riversand963
    
    fbshipit-source-id: cedd2f1ba958af59ad3916f1ba6f424307955f92
    06394ff4
no_batched_ops_stress.cc 34.2 KB