DBImpl::FindObsoleteFiles() shouldn't release mutex between getting min_pending_output and scanning files
DBImpl::FindObsoleteFiles() shouldn't release mutex between getting min_pending_output and scanning files

Summary:
Releasing mutex between getting min_pending_output and scanning files may cause min_pending_output to be max but some non-final files are found in file scanning, ending up with deleting wrong files.
As a recent regression, mutex can be released while waiting for log sync. We move it to after file scanning.

Test Plan: Run all existing tests. Don't think it is easy to write a unit test. Maybe we should find a way to assert lock not released so that we can have some test verification for similar cases.

Reviewers: igor, anthony, IslamAbdelRahman, kradhakrishnan, yhchiang, kolmike, rven

Reviewed By: rven

Subscribers: leveldb, dhruba

Differential Revision: https://reviews.facebook.net/D46899

Andymic/rocksdb,luckywhu/rocksdb,JackLian/rocksdb,facebook/rocksdb,jalexanderqed/rocksdb,JackLian/rocksdb,ryneli/rocksdb,OverlordQ/rocksdb,luckywhu/rocksdb,caijieming-baidu/rocksdb,jalexanderqed/rocksdb,bbiao/rocksdb,facebook/rocksdb,RyanTech/rocksdb,wenduo/rocksdb,Andymic/rocksdb,norton/rocksdb,flabby/rocksdb,bbiao/rocksdb,bbiao/rocksdb,JackLian/rocksdb,norton/rocksdb,kaschaeffer/rocksdb,JohnPJenkins/rocksdb,Vaisman/rocksdb,vmx/rocksdb,RyanTech/rocksdb,wat-ze-hex/rocksdb,luckywhu/rocksdb,flabby/rocksdb,wenduo/rocksdb,jalexanderqed/rocksdb,OverlordQ/rocksdb,hobinyoon/rocksdb,Andymic/rocksdb,RyanTech/rocksdb,JackLian/rocksdb,JohnPJenkins/rocksdb,caijieming-baidu/rocksdb,ryneli/rocksdb,wenduo/rocksdb,flabby/rocksdb,SunguckLee/RocksDB,flabby/rocksdb,biddyweb/rocksdb,vmx/rocksdb,ryneli/rocksdb,hobinyoon/rocksdb,kaschaeffer/rocksdb,luckywhu/rocksdb,tsheasha/rocksdb,SunguckLee/RocksDB,vmx/rocksdb,caijieming-baidu/rocksdb,biddyweb/rocksdb,wenduo/rocksdb,OverlordQ/rocksdb,geraldoandradee/rocksdb,Vaisman/rocksdb,biddyweb/rocksdb,caijieming-baidu/rocksdb,wat-ze-hex/rocksdb,JoeWoo/rocksdb,SunguckLee/RocksDB,hobinyoon/rocksdb,vmx/rocksdb,OverlordQ/rocksdb,Andymic/rocksdb,JoeWoo/rocksdb,tsheasha/rocksdb,hobinyoon/rocksdb,wenduo/rocksdb,Vaisman/rocksdb,SunguckLee/RocksDB,Andymic/rocksdb,facebook/rocksdb,JoeWoo/rocksdb,Andymic/rocksdb,facebook/rocksdb,JohnPJenkins/rocksdb,wat-ze-hex/rocksdb,luckywhu/rocksdb,wenduo/rocksdb,norton/rocksdb,wat-ze-hex/rocksdb,biddyweb/rocksdb,geraldoandradee/rocksdb,jalexanderqed/rocksdb,biddyweb/rocksdb,geraldoandradee/rocksdb,norton/rocksdb,facebook/rocksdb,geraldoandradee/rocksdb,JohnPJenkins/rocksdb,Vaisman/rocksdb,biddyweb/rocksdb,kaschaeffer/rocksdb,RyanTech/rocksdb,SunguckLee/RocksDB,wat-ze-hex/rocksdb,Andymic/rocksdb,vmx/rocksdb,caijieming-baidu/rocksdb,hobinyoon/rocksdb,vmx/rocksdb,OverlordQ/rocksdb,wenduo/rocksdb,hobinyoon/rocksdb,OverlordQ/rocksdb,geraldoandradee/rocksdb,norton/rocksdb,flabby/rocksdb,wat-ze-hex/rocksdb,JoeWoo/rocksdb,JackLian/rocksdb,facebook/rocksdb,wat-ze-hex/rocksdb,tsheasha/rocksdb,Vaisman/rocksdb,RyanTech/rocksdb,bbiao/rocksdb,wenduo/rocksdb,luckywhu/rocksdb,bbiao/rocksdb,JoeWoo/rocksdb,JohnPJenkins/rocksdb,ryneli/rocksdb,JoeWoo/rocksdb,kaschaeffer/rocksdb,jalexanderqed/rocksdb,vmx/rocksdb,tsheasha/rocksdb,RyanTech/rocksdb,luckywhu/rocksdb,flabby/rocksdb,ryneli/rocksdb,tsheasha/rocksdb,norton/rocksdb,kaschaeffer/rocksdb,caijieming-baidu/rocksdb,jalexanderqed/rocksdb,facebook/rocksdb,Andymic/rocksdb,ryneli/rocksdb,facebook/rocksdb,tsheasha/rocksdb,RyanTech/rocksdb,Vaisman/rocksdb,tsheasha/rocksdb,kaschaeffer/rocksdb,JoeWoo/rocksdb,JackLian/rocksdb,geraldoandradee/rocksdb,flabby/rocksdb,kaschaeffer/rocksdb,geraldoandradee/rocksdb,hobinyoon/rocksdb,wat-ze-hex/rocksdb,SunguckLee/RocksDB,SunguckLee/RocksDB,ryneli/rocksdb,vmx/rocksdb,norton/rocksdb,hobinyoon/rocksdb,JohnPJenkins/rocksdb,JohnPJenkins/rocksdb,biddyweb/rocksdb,JackLian/rocksdb,SunguckLee/RocksDB,Vaisman/rocksdb,jalexanderqed/rocksdb,tsheasha/rocksdb,OverlordQ/rocksdb,bbiao/rocksdb,bbiao/rocksdb,bbiao/rocksdb,caijieming-baidu/rocksdb,norton/rocksdb