Fix a group commit bug in LogAndApply
Fix a group commit bug in LogAndApply

Summary:
EncodeTo(&record) does not overwrite, it appends to it.

This means that group commit log and apply will look something like:
record1
record1record2
record1record2record3

I'm surprised this didn't show up in production, but I think the reason is that MANIFEST group commit almost never happens.

This bug turned up in column family work, where opening a database failed with "adding a same column family twice".

Test Plan: Tested the change in column family branch and observed that the problem is gone (with db_stress)

Reviewers: dhruba, haobo

Reviewed By: dhruba

CC: leveldb

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

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