Commit e44a99f
Fix false positive corruption in compaction output verification (facebook#14456)
Summary:
Fix a bug where `VerifyOutputFiles()` produces false positive "Key-value checksum of compaction output doesn't match what was computed when written" errors when `verify_output_flags` includes `kVerifyIteration` but `paranoid_file_checks` is false.
The root cause is a hash enable flag mismatch between writing and verification:
- During compaction writing (`OpenCompactionOutputFile`), the `OutputValidator` hash computation was gated solely by `paranoid_file_checks_`. When false, `enable_hash=false` and the hash stays at 0.
- During verification (`VerifyOutputFiles`), a new `OutputValidator` is always created with `enable_hash=true`, computing a non-zero hash.
- `CompareValidator()` then compares 0 vs non-zero, producing a false positive corruption.
This was exposed by the crash test randomization of `verify_output_flags` added in facebook#14433. Before that change, `verify_output_flags` was always 0, so `kVerifyIteration` was only exercised via `paranoid_file_checks=true` (which correctly enabled the hash during writing).
The fix ensures hash computation is enabled during writing whenever either `paranoid_file_checks_` is true OR `verify_output_flags` includes `kVerifyIteration`.
Pull Request resolved: facebook#14456
Test Plan:
- Added `DBCompactionTest.VerifyIterationWithoutParanoidFileChecks`
- Added `DBCompactionTest.VerifyAllOutputFlagsWithoutParanoidFileChecks`
- Round-trip verified: tests FAIL without fix, PASS with fix
Reviewed By: jaykorean
Differential Revision: D96371769
Pulled By: xingbowang
fbshipit-source-id: 2f7406327496c7b541e4fa2668894df89eb813e81 parent 5494bc1 commit e44a99f
2 files changed
Lines changed: 91 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2494 | 2494 | | |
2495 | 2495 | | |
2496 | 2496 | | |
| 2497 | + | |
| 2498 | + | |
| 2499 | + | |
| 2500 | + | |
| 2501 | + | |
| 2502 | + | |
| 2503 | + | |
| 2504 | + | |
2497 | 2505 | | |
2498 | | - | |
| 2506 | + | |
2499 | 2507 | | |
2500 | 2508 | | |
2501 | 2509 | | |
| |||
2928 | 2936 | | |
2929 | 2937 | | |
2930 | 2938 | | |
| 2939 | + | |
| 2940 | + | |
| 2941 | + | |
| 2942 | + | |
| 2943 | + | |
2931 | 2944 | | |
2932 | 2945 | | |
2933 | 2946 | | |
2934 | 2947 | | |
2935 | 2948 | | |
2936 | | - | |
| 2949 | + | |
2937 | 2950 | | |
2938 | 2951 | | |
2939 | 2952 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11790 | 11790 | | |
11791 | 11791 | | |
11792 | 11792 | | |
| 11793 | + | |
| 11794 | + | |
| 11795 | + | |
| 11796 | + | |
| 11797 | + | |
| 11798 | + | |
| 11799 | + | |
| 11800 | + | |
| 11801 | + | |
| 11802 | + | |
| 11803 | + | |
| 11804 | + | |
| 11805 | + | |
| 11806 | + | |
| 11807 | + | |
| 11808 | + | |
| 11809 | + | |
| 11810 | + | |
| 11811 | + | |
| 11812 | + | |
| 11813 | + | |
| 11814 | + | |
| 11815 | + | |
| 11816 | + | |
| 11817 | + | |
| 11818 | + | |
| 11819 | + | |
| 11820 | + | |
| 11821 | + | |
| 11822 | + | |
| 11823 | + | |
| 11824 | + | |
| 11825 | + | |
| 11826 | + | |
| 11827 | + | |
| 11828 | + | |
| 11829 | + | |
| 11830 | + | |
| 11831 | + | |
| 11832 | + | |
| 11833 | + | |
| 11834 | + | |
| 11835 | + | |
| 11836 | + | |
| 11837 | + | |
| 11838 | + | |
| 11839 | + | |
| 11840 | + | |
| 11841 | + | |
| 11842 | + | |
| 11843 | + | |
| 11844 | + | |
| 11845 | + | |
| 11846 | + | |
| 11847 | + | |
| 11848 | + | |
| 11849 | + | |
| 11850 | + | |
| 11851 | + | |
| 11852 | + | |
| 11853 | + | |
| 11854 | + | |
| 11855 | + | |
| 11856 | + | |
| 11857 | + | |
| 11858 | + | |
| 11859 | + | |
| 11860 | + | |
| 11861 | + | |
| 11862 | + | |
| 11863 | + | |
| 11864 | + | |
| 11865 | + | |
| 11866 | + | |
| 11867 | + | |
| 11868 | + | |
11793 | 11869 | | |
11794 | 11870 | | |
11795 | 11871 | | |
| |||
0 commit comments