Move level0 sorting logic from Version::SaveTo() to Version::Finalize()
Move level0 sorting logic from Version::SaveTo() to Version::Finalize()

Summary: I realized that "D14409 Avoid sorting in Version::Get() by presorting them in VersionSet::Builder::SaveTo()" is not done in an optimized place. SaveTo() is usually inside mutex. Move it to Finalize(), which is called out of mutex.

Test Plan: make all check

Reviewers: dhruba, haobo, kailiu

Reviewed By: dhruba

CC: igor, leveldb

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

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