On AOF end of file, truncate the AOF to last valid command.
On AOF end of file, truncate the AOF to last valid command.

Recently we introduced the ability to load truncated AOFs, but
unfortuantely the support was broken since the server, after loading the
truncated AOF, continues appending to the file that is corrupted at the
end. The problem is fixed only in the next AOF rewrite.

This commit fixes the issue by truncating the AOF to the last valid
opcode, and aborting if it is not possible to truncate the file
correctly.

sunheehnus/redis,GitHubMota/redis,gaoxianglong/redis,ouyangkongtong/redis,wbailey5/redis,pedigree/redis,MasahikoSawada/redis,seppo0010/redis,jingjidejuren/redis,h0x91b/redis,atreeyang/redis,gilala/hbjredis,takeshineshiro/redis,qiyang0221/redis,pmem/redis,LongXQ/redis,wujf/redis,huyuezheng/redis,fengshao0907/redis,netroby/redis,SyntaxStacks/redis,rogerlz/redis,MOON-CLJ/redis,kaushik94/redis,mcanthony/redis,programmecat/redis,LongXQ/redis,mattsta/redis,iandyh/redis,SyntaxStacks/redis,wprice/redis,yossigo/redis,cloudrain21/redis,CodeJuan/redis,shining-yang/redis,rogerchina/redis,j0hnma/szredis,tanghaodong25/redis,csuhawk/redis,ituncle/redis,mengyou0304/redis,jingjidejuren/redis,wangyikai/redis,Aliceljm1/redis,mcanthony/redis,netroby/redis,YuraLukashik/redis,pedigree/redis,ErikDubbelboer/redis,hgl888/redis,NBSW/redis,weizijun/redis,rogerlz/redis,taoguan/redis,universsky/redis,rouzier/redis,blackmady/redis,atreeyang/redis,wujf/redis,holstvoogd/redis,mattsta/redis,mverrilli/redis,pcarrier/redis,thomasdarimont/redis,gaoxianglong/redis,tellapart/redis,josiahcarlson/redis,seppo0010/rlite-server,ofirluzon/redis,hawkchch/redis,seppo0010/redis,roth1002/redis,ipmobiletech/redis,izhoujie/redis,RepmujNetsik/redis,RepmujNetsik/redis,timothyohare/3rdPartySrc-redis,ton31337/redis,roth1002/redis,aim-for-better/redis,atreeyang/redis,wprice/redis,davidradunz/redis,wangyikai/redis,nnog/redis,jackyan/redis,shining-yang/redis,SummonY/redis,hornen/redis,brg-liuwei/redis,yossigo/redis,OmarQunsul/graph-redis,wbailey5/redis,190235047/redis,rouzier/redis,4396/redis,simplestbest/redis,soveran/redis,ipmobiletech/redis,dayuoba/redis,takeshineshiro/redis,valdsJohn/redis,mgk/redis,ytjiang/redis,j0hnma/szredis,yuhc/redis-benchmark-enhanced,gilala/bjredis,zhcy/redis,ErikDubbelboer/redis,seandsky/redis,OmarQunsul/graph-redis,itamarhaber/redis,NBSW/redis,narma/redis,zczhuohuo/redis,elkingtonmcb/redis,GitHubMota/redis,devaos/redis,netroby/redis,ouyangkongtong/redis,ouyangkongtong/redis,mengyou0304/redis,tjschuck/redis,pkdevbox/redis,honestme/redis,riyan8250/redis,kensou97/redis,dreamquster/redis,YuanZhewei/redis,simplestbest/redis,j0hnma/hszredis,charsyam/redis,universsky/redis,kensou97/redis,elkingtonmcb/redis,jasonkying/redis,jackyan/redis,seppo0010/rlite-server,h0x91b/redis,citusdata/redis,z-fork/redis,gaoxianglong/redis,zguangyu/redis,mumingv/redis,thomasdarimont/redis,SummonY/redis,ofirluzon/redis,narma/redis,fengshao0907/redis,gilala/hbjredis,alenslan/redis,nnog/redis,zhiliaoniu/redis,YongMan/redis,wujf/redis,mingyaaaa/redis,oranagra/redis,july2993/redis,janekmi/redis,modulexcite/redis,badboy/redis,gaoxianglong/redis,atreeyang/redis,josiahcarlson/redis,zguangyu/redis,charsyam/redis,wujf/redis,OmarQunsul/graph-redis,seandsky/redis,allengaller/redis,izhoujie/redis,Sciumo/redis,a-pavlov/redis,a-pavlov/redis,zhcy/redis,ctripcorp/redis,j0hnma/hszredis,ouyangkongtong/redis,huyuezheng/redis,vincent-vivian-liu/redis,janekmi/redis,YuanZhewei/redis,supasate/redis,PKRoma/redis,Sciumo/redis,rogerchina/redis,supasate/redis,arijitvt/redis,soloestoy/redis,healerkx/redis,linfangrong/redis,ipmobiletech/redis,ctripcorp/redis,PKRoma/redis,xuguruogu/redis,flashbuckets/redis,tanghaodong25/redis,hedisdb/hedis,jingjidejuren/redis,StevenTsai/redis,GrimDerp/redis,ncopa/redis,cnbin/redis,mcanthony/redis,oranagra/redis,harrisonfeng/redis,elkingtonmcb/redis,wenxueliu/redis_comment,YuraLukashik/redis,badboy/redis,Wangyao14cyy/redis,nuxeh/redis,pcarrier/redis,Aaron1992/redis,blackmady/redis,RepmujNetsik/redis,hawkchch/redis,xlzhan/redis,YongMan/redis,july2993/redis,kensou97/redis,j0hnma/hszredis,CodeJuan/redis,mverrilli/redis,huyuezheng/redis,healerkx/redis,iandyh/redis,badboy/redis,mcanthony/redis,charsyam/redis,PradheepShrinivasan/redis,kmiku7/redis,z-fork/redis,wenxueliu/redis_comment,JoeWoo/redis,charsyam/redis,AALEKH/redis,colstrom/redis,weizijun/redis,cusspvz/redis,AplayER/redis,linfangrong/redis,zczhuohuo/redis,ituncle/redis,cnbin/redis,francischan714/redis,Markgorden/redis,kaushik94/redis,JoeWoo/redis,xuguruogu/redis,jackyan/redis,GrimDerp/redis,seandsky/redis,supasate/redis,Wangyao14cyy/redis,RepmujNetsik/redis,mingyaaaa/redis,rouzier/redis,holstvoogd/redis,YuraLukashik/redis,twskipper/redis,itamarhaber/redis,zhiliaoniu/redis,citusdata/redis,a-pavlov/redis,itugs/redis,csuhawk/redis,guker/redis,allengaller/redis,citusdata/redis,pkdevbox/redis,itugs/redis,alenslan/redis,z-fork/redis,StevenTsai/redis,ituncle/redis,LongXQ/redis,vincent-vivian-liu/redis,brg-liuwei/redis,seppo0010/redis,charsyam/redis,spinlock/redis,ErikDubbelboer/redis,wprice/redis,dreamquster/redis,vincent-vivian-liu/redis,xlzhan/redis,zczhuohuo/redis,PradheepShrinivasan/redis,thomasdarimont/redis,kmiku7/redis,xujunhai1991/redis,rouzier/redis,antirez/redis,healerkx/redis,Aliceljm1/redis,taoguan/redis,riyan8250/redis,gilala/hbjredis,soloestoy/redis,190235047/redis,soloestoy/redis,Aaron1992/redis,PradheepShrinivasan/redis,takeshineshiro/redis,antirez/redis,abhiklodh/redis,xlzhan/redis,mumingv/redis,yossigo/redis,saisai/redis,kmiku7/redis,csuhawk/redis,abhiklodh/redis,itugs/redis,duanx/redis,jasonkying/redis,cloudrain21/redis,a-pavlov/redis,tjschuck/redis,tanghaodong25/redis,mgk/redis,soveran/redis,hornen/redis,gilala/bjredis,modulexcite/redis,AALEKH/redis,july2993/redis,xujunhai1991/redis,SyntaxStacks/redis,PKRoma/redis,jackyan/redis,pmem/redis,jasonkying/redis,jingjidejuren/redis,neomantra/redis,oranagra/redis,takeshineshiro/redis,saisai/redis,mattsta/redis,xuguruogu/redis,blackmady/redis,zczhuohuo/redis,ofirluzon/redis,iandyh/redis,wprice/redis,honestme/redis,cusspvz/redis,colstrom/redis,aim-for-better/redis,MasahikoSawada/redis,clamoriniere1A/redis,francischan714/redis,guker/redis,ctripcorp/redis,SummonY/redis,qiyang0221/redis,duanx/redis,aim-for-better/redis,wangyikai/redis,davidradunz/redis,Soledad89/redis,jasonkying/redis,nnog/redis,LongXQ/redis,harrisonfeng/redis,zhiliaoniu/redis,zhcy/redis,Markgorden/redis,hedisdb/hedis,davidradunz/redis,universsky/redis,taoguan/redis,hornen/redis,cusspvz/redis,qiyang0221/redis,programmecat/redis,xujunhai1991/redis,Soledad89/redis,csuhawk/redis,oranagra/redis,h0x91b/redis,hedisdb/hedis,OmarQunsul/graph-redis,GrimDerp/redis,ofirluzon/redis,dreamquster/redis,YuanZhewei/redis,itamarhaber/redis,sunheehnus/redis,yuhc/redis-benchmark-enhanced,zhcy/redis,tjschuck/redis,flashbuckets/redis,universsky/redis,mumingv/redis,programmecat/redis,SyntaxStacks/redis,pcarrier/redis,JoeWoo/redis,ipmobiletech/redis,antirez/redis,gilala/bjredis,janekmi/redis,honestme/redis,kensou97/redis,hornen/redis,devaos/redis,allengaller/redis,abhiklodh/redis,Sciumo/redis,rogerlz/redis,shining-yang/redis,wangyikai/redis,programmecat/redis,YongMan/redis,PKRoma/redis,hawkchch/redis,xlzhan/redis,hgl888/redis,duanx/redis,mingyaaaa/redis,Markgorden/redis,valdsJohn/redis,dayuoba/redis,mverrilli/redis,july2993/redis,blackmady/redis,nuxeh/redis,Soledad89/redis,dayuoba/redis,MOON-CLJ/redis,soloestoy/redis,roth1002/redis,AALEKH/redis,riyan8250/redis,brg-liuwei/redis,soveran/redis,neomantra/redis,wbailey5/redis,shreesundara/redis,twskipper/redis,kmiku7/redis,mverrilli/redis,hedisdb/hedis,j0hnma/hszredis,seppo0010/redis,hgl888/redis,badboy/redis,nnog/redis,ofirluzon/redis,flashbuckets/redis,elkingtonmcb/redis,guker/redis,netroby/redis,twskipper/redis,190235047/redis,josiahcarlson/redis,4396/redis,izhoujie/redis,huyuezheng/redis,ton31337/redis,zhiliaoniu/redis,mgk/redis,alenslan/redis,janekmi/redis,CodeJuan/redis,MasahikoSawada/redis,seandsky/redis,saisai/redis,AplayER/redis,timothyohare/3rdPartySrc-redis,honestme/redis,harrisonfeng/redis,holstvoogd/redis,kaushik94/redis,j0hnma/szredis,mengyou0304/redis,Aliceljm1/redis,ton31337/redis,GrimDerp/redis,simplestbest/redis,shining-yang/redis,nuxeh/redis,shreesundara/redis,PKRoma/redis,valdsJohn/redis,narma/redis,clamoriniere1A/redis,zguangyu/redis,timothyohare/3rdPartySrc-redis,oranagra/redis,wbailey5/redis,Wangyao14cyy/redis,allengaller/redis,modulexcite/redis,arijitvt/redis,citusdata/redis,Soledad89/redis,tanghaodong25/redis,neomantra/redis,yuhc/redis-benchmark-enhanced,NBSW/redis,h0x91b/redis,twskipper/redis,clamoriniere1A/redis,Markgorden/redis,pedigree/redis,sunheehnus/redis,z-fork/redis,vincent-vivian-liu/redis,devaos/redis,cloudrain21/redis,4396/redis,neomantra/redis,Sciumo/redis,spinlock/redis,pmem/redis,MOON-CLJ/redis,nuxeh/redis,guker/redis,shreesundara/redis,mumingv/redis,arijitvt/redis,4396/redis,tellapart/redis,StevenTsai/redis,wenxueliu/redis_comment,brg-liuwei/redis,wenxueliu/redis_comment,alenslan/redis,ytjiang/redis,roth1002/redis,hgl888/redis,GitHubMota/redis,weizijun/redis,soveran/redis,ncopa/redis,gilala/bjredis,izhoujie/redis,YongMan/redis,CodeJuan/redis,arijitvt/redis,cnbin/redis,abhiklodh/redis,healerkx/redis,pkdevbox/redis,ituncle/redis,itamarhaber/redis,neomantra/redis,weizijun/redis,ErikDubbelboer/redis,Wangyao14cyy/redis,GitHubMota/redis,cnbin/redis,mgk/redis,iandyh/redis,linfangrong/redis,ctripcorp/redis,fengshao0907/redis,NBSW/redis,duanx/redis,hawkchch/redis,josiahcarlson/redis,saisai/redis,rogerchina/redis,valdsJohn/redis,mengyou0304/redis,aim-for-better/redis,colstrom/redis,soloestoy/redis,francischan714/redis,mingyaaaa/redis,francischan714/redis,ton31337/redis,AALEKH/redis,seppo0010/rlite-server,PradheepShrinivasan/redis,zguangyu/redis,ytjiang/redis,kaushik94/redis,yossigo/redis,pmem/redis,dreamquster/redis,JoeWoo/redis,pcarrier/redis,cusspvz/redis,sunheehnus/redis,thomasdarimont/redis,timothyohare/3rdPartySrc-redis,MasahikoSawada/redis,riyan8250/redis,pkdevbox/redis,linfangrong/redis,Aaron1992/redis,xujunhai1991/redis,yossigo/redis,ncopa/redis,gilala/hbjredis,tellapart/redis,ncopa/redis,seppo0010/rlite-server,tjschuck/redis,SummonY/redis,AplayER/redis,fengshao0907/redis,190235047/redis,YuraLukashik/redis,rogerchina/redis,dayuoba/redis,pedigree/redis,spinlock/redis,devaos/redis,qiyang0221/redis,yuhc/redis-benchmark-enhanced,ytjiang/redis,harrisonfeng/redis,YuanZhewei/redis,simplestbest/redis,shreesundara/redis,Aaron1992/redis,colstrom/redis,supasate/redis,Aliceljm1/redis,xuguruogu/redis,davidradunz/redis,antirez/redis,AplayER/redis,spinlock/redis,holstvoogd/redis,j0hnma/szredis,rogerlz/redis,clamoriniere1A/redis,tellapart/redis,cloudrain21/redis,StevenTsai/redis,itugs/redis,modulexcite/redis,flashbuckets/redis,taoguan/redis