]> git-server-git.apps.pok.os.sepia.ceph.com Git - rocksdb.git/commit
Fix CompactFiles() bug when used with CompactionFilter using SuperVersion
authorIslam AbdelRahman <tec@fb.com>
Wed, 25 Jan 2017 22:03:49 +0000 (14:03 -0800)
committerAlex Yang <alexyang@fb.com>
Fri, 3 Feb 2017 00:16:47 +0000 (16:16 -0800)
commitd4b0ac27604577075fc5f6e272a1340c6eaf6860
treed3f0ab09541aa544eb53a81973d0328680b4f883
parenta7a20058738b542d1740d3368c3c7bad5a40396e
Fix CompactFiles() bug when used with CompactionFilter using SuperVersion

Summary:
GetAndRefSuperVersion() should not be called again in the same thread before ReturnAndCleanupSuperVersion() is called.

If we have a compaction filter that is using DB::Get, This will happen
```
CompactFiles() {
  GetAndRefSuperVersion() // -- first call
    ..
    CompactionFilter() {
      GetAndRefSuperVersion() // -- second call
      ReturnAndCleanupSuperVersion()
    }
    ..
  ReturnAndCleanupSuperVersion()
}
```

We solve this issue in the same way Iterator is solving it, but using GetReferencedSuperVersion()

This was discovered in https://github.com/facebook/mysql-5.6/issues/427 by alxyang
Closes https://github.com/facebook/rocksdb/pull/1803

Differential Revision: D4460155

Pulled By: IslamAbdelRahman

fbshipit-source-id: 5e54322
db/compact_files_test.cc
db/db_impl.cc