Schedule flush when waiting on flush
Schedule flush when waiting on flush

Summary:
This will also help with avoiding the deadlock. If a flush failed and we're waiting for a memtable to be flushed, we should schedule a new flush and hope a new one succeedes.

If paranoid_checks = false, Wait() will still hang on ENOSPC, but at least it will automatically continue when the space frees up. Current behavior both hangs and deadlocks.

Also, I renamed some 'compaction' to 'flush'. 'compaction' was leveldb way of saying things.

Test Plan: make check

Reviewers: dhruba, haobo, ljin

Reviewed By: haobo

CC: leveldb

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

wat-ze-hex/rocksdb,tschottdorf/rocksdb,sorphi/rocksdb,Andymic/rocksdb,mbarbon/rocksdb,geraldoandradee/rocksdb,msb-at-yahoo/rocksdb,Vaisman/rocksdb,IMCG/RcoksDB,JoeWoo/rocksdb,tsheasha/rocksdb,wlqGit/rocksdb,dkorolev/rocksdb,RyanTech/rocksdb,OverlordQ/rocksdb,kaschaeffer/rocksdb,tizzybec/rocksdb,siddhartharay007/rocksdb,JohnPJenkins/rocksdb,amyvmiwei/rocksdb,rDSN-Projects/rocksdb.replicated,makelivedotnet/rocksdb,Vaisman/rocksdb,lgscofield/rocksdb,mbarbon/rocksdb,vmx/rocksdb,lgscofield/rocksdb,kaschaeffer/rocksdb,wat-ze-hex/rocksdb,mbarbon/rocksdb,wenduo/rocksdb,luckywhu/rocksdb,siddhartharay007/rocksdb,Vaisman/rocksdb,hobinyoon/rocksdb,sorphi/rocksdb,vashstorm/rocksdb,temicai/rocksdb,jalexanderqed/rocksdb,wenduo/rocksdb,biddyweb/rocksdb,NickCis/rocksdb,geraldoandradee/rocksdb,JackLian/rocksdb,OverlordQ/rocksdb,sorphi/rocksdb,JohnPJenkins/rocksdb,ryneli/rocksdb,bbiao/rocksdb,rDSN-Projects/rocksdb.replicated,zhangpng/rocksdb,JackLian/rocksdb,sorphi/rocksdb,amyvmiwei/rocksdb,rDSN-Projects/rocksdb.replicated,temicai/rocksdb,alihalabyah/rocksdb,vmx/rocksdb,Andymic/rocksdb,kaschaeffer/rocksdb,NickCis/rocksdb,ryneli/rocksdb,JackLian/rocksdb,amyvmiwei/rocksdb,wenduo/rocksdb,norton/rocksdb,luckywhu/rocksdb,vashstorm/rocksdb,vmx/rocksdb,Applied-Duality/rocksdb,wenduo/rocksdb,ryneli/rocksdb,kaschaeffer/rocksdb,siddhartharay007/rocksdb,skunkwerks/rocksdb,tizzybec/rocksdb,wenduo/rocksdb,anagav/rocksdb,tsheasha/rocksdb,wenduo/rocksdb,JohnPJenkins/rocksdb,JohnPJenkins/rocksdb,wat-ze-hex/rocksdb,alihalabyah/rocksdb,biddyweb/rocksdb,makelivedotnet/rocksdb,hobinyoon/rocksdb,wskplho/rocksdb,siddhartharay007/rocksdb,tizzybec/rocksdb,facebook/rocksdb,wlqGit/rocksdb,temicai/rocksdb,wat-ze-hex/rocksdb,hobinyoon/rocksdb,ryneli/rocksdb,wat-ze-hex/rocksdb,fengshao0907/rocksdb,tsheasha/rocksdb,tschottdorf/rocksdb,virtdb/rocksdb,tschottdorf/rocksdb,virtdb/rocksdb,temicai/rocksdb,ylong/rocksdb,alihalabyah/rocksdb,kaschaeffer/rocksdb,bbiao/rocksdb,lgscofield/rocksdb,OverlordQ/rocksdb,norton/rocksdb,hobinyoon/rocksdb,Andymic/rocksdb,fengshao0907/rocksdb,facebook/rocksdb,alihalabyah/rocksdb,dkorolev/rocksdb,ryneli/rocksdb,biddyweb/rocksdb,ylong/rocksdb,wskplho/rocksdb,norton/rocksdb,wat-ze-hex/rocksdb,flabby/rocksdb,vmx/rocksdb,luckywhu/rocksdb,makelivedotnet/rocksdb,msb-at-yahoo/rocksdb,Andymic/rocksdb,hobinyoon/rocksdb,tschottdorf/rocksdb,Applied-Duality/rocksdb,biddyweb/rocksdb,JohnPJenkins/rocksdb,IMCG/RcoksDB,mbarbon/rocksdb,biddyweb/rocksdb,hobinyoon/rocksdb,RyanTech/rocksdb,RyanTech/rocksdb,Andymic/rocksdb,msb-at-yahoo/rocksdb,makelivedotnet/rocksdb,zhangpng/rocksdb,IMCG/RcoksDB,jalexanderqed/rocksdb,temicai/rocksdb,siddhartharay007/rocksdb,temicai/rocksdb,jalexanderqed/rocksdb,fengshao0907/rocksdb,geraldoandradee/rocksdb,zhangpng/rocksdb,wlqGit/rocksdb,anagav/rocksdb,lgscofield/rocksdb,Vaisman/rocksdb,Vaisman/rocksdb,tizzybec/rocksdb,hobinyoon/rocksdb,facebook/rocksdb,zhangpng/rocksdb,wat-ze-hex/rocksdb,SunguckLee/RocksDB,alihalabyah/rocksdb,Applied-Duality/rocksdb,tizzybec/rocksdb,SunguckLee/RocksDB,IMCG/RcoksDB,ylong/rocksdb,NickCis/rocksdb,vashstorm/rocksdb,wskplho/rocksdb,Andymic/rocksdb,amyvmiwei/rocksdb,vmx/rocksdb,caijieming-baidu/rocksdb,msb-at-yahoo/rocksdb,fengshao0907/rocksdb,OverlordQ/rocksdb,skunkwerks/rocksdb,wlqGit/rocksdb,SunguckLee/RocksDB,makelivedotnet/rocksdb,fengshao0907/rocksdb,jalexanderqed/rocksdb,JackLian/rocksdb,facebook/rocksdb,bbiao/rocksdb,tschottdorf/rocksdb,JohnPJenkins/rocksdb,vmx/rocksdb,facebook/rocksdb,JoeWoo/rocksdb,luckywhu/rocksdb,JoeWoo/rocksdb,geraldoandradee/rocksdb,bbiao/rocksdb,fengshao0907/rocksdb,SunguckLee/RocksDB,SunguckLee/RocksDB,caijieming-baidu/rocksdb,OverlordQ/rocksdb,facebook/rocksdb,skunkwerks/rocksdb,geraldoandradee/rocksdb,vmx/rocksdb,anagav/rocksdb,wenduo/rocksdb,hobinyoon/rocksdb,bbiao/rocksdb,Vaisman/rocksdb,Vaisman/rocksdb,zhangpng/rocksdb,wenduo/rocksdb,RyanTech/rocksdb,skunkwerks/rocksdb,flabby/rocksdb,msb-at-yahoo/rocksdb,temicai/rocksdb,biddyweb/rocksdb,siddhartharay007/rocksdb,sorphi/rocksdb,vmx/rocksdb,dkorolev/rocksdb,JackLian/rocksdb,amyvmiwei/rocksdb,dkorolev/rocksdb,RyanTech/rocksdb,kaschaeffer/rocksdb,JoeWoo/rocksdb,rDSN-Projects/rocksdb.replicated,skunkwerks/rocksdb,sorphi/rocksdb,wlqGit/rocksdb,virtdb/rocksdb,flabby/rocksdb,ylong/rocksdb,norton/rocksdb,Andymic/rocksdb,siddhartharay007/rocksdb,tsheasha/rocksdb,vashstorm/rocksdb,caijieming-baidu/rocksdb,flabby/rocksdb,skunkwerks/rocksdb,dkorolev/rocksdb,msb-at-yahoo/rocksdb,norton/rocksdb,ylong/rocksdb,SunguckLee/RocksDB,JohnPJenkins/rocksdb,NickCis/rocksdb,wskplho/rocksdb,IMCG/RcoksDB,tizzybec/rocksdb,JoeWoo/rocksdb,makelivedotnet/rocksdb,JoeWoo/rocksdb,jalexanderqed/rocksdb,virtdb/rocksdb,wskplho/rocksdb,tsheasha/rocksdb,bbiao/rocksdb,Andymic/rocksdb,mbarbon/rocksdb,RyanTech/rocksdb,facebook/rocksdb,NickCis/rocksdb,IMCG/RcoksDB,NickCis/rocksdb,SunguckLee/RocksDB,OverlordQ/rocksdb,flabby/rocksdb,Applied-Duality/rocksdb,JoeWoo/rocksdb,JackLian/rocksdb,lgscofield/rocksdb,caijieming-baidu/rocksdb,amyvmiwei/rocksdb,rDSN-Projects/rocksdb.replicated,flabby/rocksdb,luckywhu/rocksdb,wskplho/rocksdb,sorphi/rocksdb,OverlordQ/rocksdb,virtdb/rocksdb,facebook/rocksdb,bbiao/rocksdb,tsheasha/rocksdb,norton/rocksdb,virtdb/rocksdb,Applied-Duality/rocksdb,tsheasha/rocksdb,anagav/rocksdb,rDSN-Projects/rocksdb.replicated,caijieming-baidu/rocksdb,skunkwerks/rocksdb,ryneli/rocksdb,kaschaeffer/rocksdb,anagav/rocksdb,jalexanderqed/rocksdb,tizzybec/rocksdb,luckywhu/rocksdb,SunguckLee/RocksDB,ylong/rocksdb,wlqGit/rocksdb,IMCG/RcoksDB,alihalabyah/rocksdb,Applied-Duality/rocksdb,geraldoandradee/rocksdb,bbiao/rocksdb,JackLian/rocksdb,wlqGit/rocksdb,makelivedotnet/rocksdb,RyanTech/rocksdb,rDSN-Projects/rocksdb.replicated,dkorolev/rocksdb,caijieming-baidu/rocksdb,jalexanderqed/rocksdb,anagav/rocksdb,zhangpng/rocksdb,vashstorm/rocksdb,NickCis/rocksdb,alihalabyah/rocksdb,virtdb/rocksdb,tsheasha/rocksdb,wat-ze-hex/rocksdb,biddyweb/rocksdb,tschottdorf/rocksdb,amyvmiwei/rocksdb,zhangpng/rocksdb,anagav/rocksdb,mbarbon/rocksdb,luckywhu/rocksdb,norton/rocksdb,ryneli/rocksdb,caijieming-baidu/rocksdb,lgscofield/rocksdb,dkorolev/rocksdb,vashstorm/rocksdb,vashstorm/rocksdb,geraldoandradee/rocksdb,ylong/rocksdb,wskplho/rocksdb,lgscofield/rocksdb,flabby/rocksdb,fengshao0907/rocksdb,norton/rocksdb,Applied-Duality/rocksdb,mbarbon/rocksdb