From 3218edc573477a091058eebf565d57d6d1e25a93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A5=8F=E4=B9=8B=E7=AB=A0?= Date: Mon, 31 Jul 2017 14:22:37 -0700 Subject: [PATCH] Fix universal compaction bug Summary: this value ``` Compaction::is_trivial_move_ ``` uninitialized . under universal compaction , we enable ``` CompactionOptionsUniversal::allow_trivial_move ``` , https://github.com/facebook/rocksdb/blob/9b11d4345a0f01fc3de756e01460bf1b0446f326/db/compaction.cc#L245 here is a disastrous bug , some sst trivial move to target level without overlap check ... THEN , DATABASE DAMAGED , WE GOT A LEVEL WITH OVERLAP ! Closes https://github.com/facebook/rocksdb/pull/2634 Differential Revision: D5530722 Pulled By: siying fbshipit-source-id: 425ab55bca5967110377d634258360bcf88c200e --- db/compaction.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/db/compaction.cc b/db/compaction.cc index ea2c011a45..31adcc29de 100644 --- a/db/compaction.cc +++ b/db/compaction.cc @@ -169,6 +169,7 @@ Compaction::Compaction(VersionStorageInfo* vstorage, bottommost_level_(IsBottommostLevel(output_level_, vstorage, inputs_)), is_full_compaction_(IsFullCompaction(vstorage, inputs_)), is_manual_compaction_(_manual_compaction), + is_trivial_move_(false), compaction_reason_(_compaction_reason) { MarkFilesBeingCompacted(true); if (is_manual_compaction_) {