[RocksDB] Provide contiguous sequence number even in case of write failure
[RocksDB] Provide contiguous sequence number even in case of write failure

Summary: Replication logic would be simplifeid if we can guarantee that write sequence number is always contiguous, even if write failure occurs. Dhruba and I looked at the sequence number generation part of the code. It seems fixable. Note that if WAL was successful and insert into memtable was not, we would be in an unfortunate state. The approach in this diff is : IO error is expected and error status will be returned to client, sequence number will not be advanced; In-mem error is not expected and we panic.

Test Plan: make check; db_stress

Reviewers: dhruba, sheki

CC: leveldb

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

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