[RocksDB Performance Branch] DBImpl.NewInternalIterator() to reduce works inside mutex
[RocksDB Performance Branch] DBImpl.NewInternalIterator() to reduce works inside mutex

Summary: To reduce mutex contention caused by DBImpl.NewInternalIterator(), in this function, move all the iteration creation works out of mutex, only leaving object ref and get.

Test Plan:
make all check
will run db_stress for a while too to make sure no problem.

Reviewers: haobo, dhruba, kailiu

Reviewed By: haobo

CC: igor, leveldb

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

Conflicts:
	db/db_impl.cc

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