Replication: install the write handler when reusing a cached master.
Replication: install the write handler when reusing a cached master.

Sometimes when we resurrect a cached master after a successful partial
resynchronization attempt, there is pending data in the output buffers
of the client structure representing the master (likely REPLCONF ACK
commands).

If we don't reinstall the write handler, it will never be installed
again by addReply*() family functions as they'll assume that if there is
already data pending, the write handler is already installed.

This bug caused some slaves after a successful partial sync to never
send REPLCONF ACK, and continuously being detected as timing out by the
master, with a disconnection / reconnection loop.

alenslan/redis,OmarQunsul/graph-redis,colstrom/redis,soloestoy/redis,soloestoy/redis,fengshao0907/redis-3.0-annotated,ituncle/redis,gilala/redis,alenslan/redis,taoguan/redis,brg-liuwei/redis,seppo0010/redis,gilala/bjredis,seppo0010/rlite-server,jingjidejuren/redis,takeshineshiro/redis,adamweixuan/redis-3.0-annotated,xlzhan/redis,seandsky/redis,twskipper/redis,gechong/redis-3.0-annotated,zhaobo1023/redis-3.0-annotated,janekmi/redis,GitHubMota/redis,NBSW/redis,wprice/redis,rogerlz/redis,xuguruogu/redis,simplestbest/redis,j0hnma/hszredis,janekmi/redis,kmiku7/redis,ttuna/msot-redis,ketor/redis,ketor/redis,LongXQ/redis,PKRoma/redis,aim-for-better/redis,magastzheng/redis-3.0-annotated,ton31337/redis,YongMan/redis,devaos/redis,jbochi/redis,zhoudayang/redis,j0hnma/szredis,HeartSaVioR/redis,gilala/hbjredis,mcanthony/redis,kensou97/redis,splitice/redis,fengshao0907/redis-3.0-annotated,holstvoogd/redis,charsyam/redis,z-fork/redis,gongice/redis-3.0-annotated,AplayER/redis,louisliangjun/redis,mverrilli/redis,RepmujNetsik/redis,dayuoba/redis,miaoyc1989/redis-3.0-annotated,OmarQunsul/graph-redis,a-pavlov/redis,ituncle/redis,spinlock/redis,zhiliaoniu/redis,louisliangjun/redis,slfs007/mk-redis,jasonkying/redis,abhiklodh/redis,hornen/redis,jbochi/parallel_redis,nilyang/redis-tdd-annotation,msn217/redis-3.0-annotated,magastzheng/redis-3.0-annotated,Hailei/redis,Hailei/redis,idning/redis,h0x91b/redis,jackyan/redis,jingjidejuren/redis,qiyang0221/redis,iandyh/redis,thomasdarimont/redis,CodeJuan/redis,yossigo/redis,j0hnma/hszredis,Hailei/redis,pcarrier/redis,RepmujNetsik/redis,onlymellb/redis-3.0-annotated,davidradunz/redis,ttuna/msot-redis,mingyaaaa/redis,huyuezheng/redis,wangyikai/redis,NBSW/redis,seppo0010/redis,h0x91b/redis,mumingv/redis-3.0-annotated,netroby/redis,elkingtonmcb/redis,wbailey5/redis,gilala/redis,supasate/redis,splitice/redis,ksarch-saas/redis,elkingtonmcb/redis,zhoudayang/redis,soveran/redis,Aaron1992/redis,MasahikoSawada/redis,Wangyao14cyy/redis,ctripcorp/redis,tzq668766/redis-3.0-annotated,haima-zju/redis-3.0-annotated,neomantra/redis,unasm/redis-3.0-annotated,JoeWoo/redis,supasate/redis,Markgorden/redis,narma/redis,universsky/redis,alenslan/redis,whille/redis-3.0-annotated,ReadCode/redis-3.0-annotated,timothyohare/3rdPartySrc-redis,rouzier/redis,francischan714/redis,Soledad89/redis,tzq668766/redis-3.0-annotated,seppo0010/redis,jbochi/redis,citusdata/redis,wenxueliu/redis_comment,ksarch-saas/redis,roth1002/redis,shreesundara/redis,gilala/bjredis,mumingv/redis,thomasdarimont/redis,zhoudayang/redis,roth1002/redis,citusdata/redis,sunheehnus/redis,LongXQ/redis,josiahcarlson/redis,tellapart/redis,0x55/redis-3.0-annotated,gilala/hredis,unasm/redis-3.0-annotated,harrisonfeng/redis,louisliangjun/redis,programmecat/redis,xujunhai1991/redis,mattsta/redis,yybirdcf/learn-redis,pkdevbox/redis,weizijun/redis,0x55/redis-3.0-annotated,zczhuohuo/redis,vincent-vivian-liu/redis,kaushik94/redis,clamoriniere1A/redis,ctripcorp/redis,gechong/redis-3.0-annotated,harrisonfeng/redis,gilala/hbjredis,mengyou0304/redis,kaushik94/redis,LongXQ/redis,ncopa/redis,ofirluzon/redis,soloestoy/redis,healerkx/redis,oranagra/redis,davidradunz/redis,zy416548283/redis-3.0-annotated,WorkingOfTimtohyZhang/redis-3.0-annotated,AALEKH/redis,programmecat/redis,holstvoogd/redis,SyntaxStacks/redis,maodeyi/redis_lua,healerkx/redis,allengaller/redis,GrimDerp/redis,nuxeh/redis,sunlianqiang/redis-3.0-annotated,moonbingbing/redis-3.0-annotated,HeartSaVioR/redis,mcanthony/redis,fengshao0907/redis-3.0-annotated,ipmobiletech/redis,ErikDubbelboer/redis,ipmobiletech/redis,HeartSaVioR/redis,neomantra/redis,shshlzh/redis-3.0-annotated,kensou97/redis,guker/redis,hedisdb/hedis,soloestoy/redis,antirez/redis,programmecat/redis,ncopa/redis,citusdata/redis,miaoyc1989/redis-3.0-annotated,dreamquster/redis,hedisdb/hedis,oranagra/redis,buobao/redis-3.0-annotated,ofirluzon/redis,xuzhezhaozhao/redis_reading,rouzier/redis,atreeyang/redis,buobao/redis-3.0-annotated,PradheepShrinivasan/redis,jacklee0810/redis-3.0-annotated,GrimDerp/redis,programmecat/redis,nilyang/redis-tdd-annotation,yuhc/redis-benchmark-enhanced,shreesundara/redis,fankeke/redis-3.0-annotated,valdsJohn/redis,yybirdcf/learn-redis,xlzhan/redis,190235047/redis,PradheepShrinivasan/redis,cusspvz/redis,AALEKH/redis,ton31337/redis,Sciumo/redis,mengyou0304/redis,shining-yang/redis,pcarrier/redis,xuzhezhaozhao/redis_reading,cloudrain21/redis,ramonsnir/redis,SummonY/redis,itamarhaber/redis,aim-for-better/redis,gaoxianglong/redis,shreesundara/redis,MOON-CLJ/redis,Markgorden/redis,gilala/redis,duanx/redis,Soledad89/redis,pmem/redis,cnbin/redis,wuyu201321060203/redis-3.0-annotated,francischan714/redis,rrsean/redis-3.0-annotated,riyan8250/redis,aim-for-better/redis,WorkingOfTimtohyZhang/redis-3.0-annotated,charsyam/redis,fengshao0907/redis,moonbingbing/redis-3.0-annotated,guker/redis,hedisdb/hedis,linfangrong/redis,twskipper/redis,devaos/redis,healerkx/redis,badboy/redis,dayuoba/redis,huyuezheng/redis,netroby/redis,mverrilli/redis,spearhead-ea/redis,spearhead-ea/redis,ErikDubbelboer/redis,unasm/redis-3.0-annotated,janekmi/redis,saisai/redis,rouzier/redis,pedigree/redis,MasahikoSawada/redis,rrsean/redis-3.0-annotated,yybirdcf/learn-redis,Soledad89/redis,flashbuckets/redis,tjschuck/redis,hedisdb/hedis,holstvoogd/redis,cusspvz/redis,StevenTsai/redis,j0hnma/hszredis,zczhuohuo/redis,zhaobo1023/redis-3.0-annotated,dreamquster/redis,zhcy/redis,healerkx/redis,ituncle/redis,guker/redis,slfs007/mk-redis,YuanZhewei/redis,pkdevbox/redis,itamarhaber/redis,Aliceljm1/redis-3.0-annotated,takeshineshiro/redis,holstvoogd/redis,cloudrain21/redis,flashbuckets/redis,timothyohare/3rdPartySrc-redis,shshlzh/redis-3.0-annotated,wenxueliu/redis_comment,taoguan/redis,jacklee0810/redis-3.0-annotated,tjschuck/redis,allengaller/redis,Wangyao14cyy/redis,hornen/redis,tellapart/redis,mcanthony/redis,drinkthere/redis-3.0-annotated,universsky/redis,magastzheng/redis-3.0-annotated,aim-for-better/redis,cnbin/redis,dongqifan2/redis-3.0-annotated,wbailey5/redis,JoeWoo/redis,yybirdcf/learn-redis,brg-liuwei/redis,seppo0010/rlite-server,buobao/redis-3.0-annotated,wujf/redis,pkdevbox/redis,190235047/redis,a-pavlov/redis,josiahcarlson/redis,ErikDubbelboer/redis,zy416548283/redis-3.0-annotated,tellapart/redis,splitice/redis,4396/redis,j0hnma/hszredis,LongXQ/redis,soveran/redis,j0hnma/szredis,arijitvt/redis,csuhawk/redis,yuzhangjob/redis-3.0-annotated-unstable,WorkingOfTimtohyZhang/redis-3.0-annotated,mengzhejin/RedisStudy,zczhuohuo/redis,cnbin/redis,onlymellb/redis-3.0-annotated,yossigo/redis,seandsky/redis,rrsean/redis-3.0-annotated,allengaller/redis,seppo0010/rlite-server,mengyou0304/redis,miaoyc1989/redis-3.0-annotated,gilala/hbjredis,janekmi/redis,gilala/hredis,darksideofthemoo/redis-histogram,HunanTV/redis,gilala/hbjredis,kensou97/redis,ReadCode/redis-3.0-annotated,guker/redis,charsyam/redis,yossigo/redis,HouKangkang/redis-3.0-annotated,Soledad89/redis,soloestoy/redis,tjschuck/redis,tanghaodong25/redis,charsyam/redis,tanghaodong25/redis,Aliceljm1/redis,vincent-vivian-liu/redis,itamarhaber/redis,shining-yang/redis,honestme/redis,dongqifan2/redis-3.0-annotated,jingjidejuren/redis,zczhuohuo/redis,mumingv/redis,twskipper/redis,hgl888/redis,josiahcarlson/redis,csuhawk/redis,xujunhai1991/redis,0x55/redis-3.0-annotated,jxwr/redis,kensou97/redis,hawkchch/redis,ErikDubbelboer/redis,shining-yang/redis,zhoudayang/redis,mengzhejin/RedisStudy,mgk/redis,HunanTV/redis,hawkchch/redis,GitHubMota/redis,HeartSaVioR/redis,MasahikoSawada/redis,sunheehnus/redis,wangyikai/redis,tzq668766/redis-3.0-annotated,xlzhan/redis,Aaron1992/redis,valdsJohn/redis,MOON-CLJ/redis,PKRoma/redis,ipmobiletech/redis,ytjiang/redis,spinlock/redis,spearhead-ea/redis,colstrom/redis,honestme/redis,cnbin/redis,oranagra/redis,YuanZhewei/redis,weizijun/redis,SummonY/redis,zhiliaoniu/redis,ncopa/redis,jackyan/redis,honestme/redis,ouyangkongtong/redis,timothyohare/3rdPartySrc-redis,4396/redis,ytjiang/redis,PKRoma/redis,SummonY/redis,fengshao0907/redis,dreamquster/redis,wangyikai/redis,Aliceljm1/redis-3.0-annotated,HunanTV/redis,valdsJohn/redis,NBSW/redis,ytjiang/redis,idning/redis,netroby/redis,supasate/redis,itugs/redis,YongMan/redis,gilala/bjredis,itugs/redis,ituncle/redis,Wangyao14cyy/redis,ketor/redis,timothyohare/3rdPartySrc-redis,StevenTsai/redis,moonbingbing/redis-3.0-annotated,soveran/redis,mverrilli/redis,0x55/redis-3.0-annotated,YuraLukashik/redis,devaos/redis,honestme/redis,a-pavlov/redis,neomantra/redis,mcanthony/redis,xuguruogu/redis,JoeWoo/redis,weizijun/redis,ncopa/redis,allengaller/redis,AALEKH/redis,devaos/redis,clamoriniere1A/redis,fankeke/redis-3.0-annotated,gaoxianglong/redis,ton31337/redis,neomantra/redis,izhoujie/redis,mattsta/redis,supasate/redis,RepmujNetsik/redis,himoca/redis,valdsJohn/redis,cloudrain21/redis,hawkchch/redis,jingjidejuren/redis,arijitvt/redis,huangz1990/redis-3.0-annotated,francischan714/redis,wujf/redis,ctripcorp/redis,vincent-vivian-liu/redis,zguangyu/redis,wprice/redis,AALEKH/redis,gongice/redis-3.0-annotated,modulexcite/redis,NBSW/redis,HunanTV/redis,mengzhejin/RedisStudy,pedigree/redis,saisai/redis,harrisonfeng/redis,ouyangkongtong/redis,universsky/redis,pcarrier/redis,kaushik94/redis,xujunhai1991/redis,ofirluzon/redis,nuxeh/redis,yuhc/redis-benchmark-enhanced,qiyang0221/redis,hgl888/redis,Aaron1992/redis,MSOpenTech/redis,wprice/redis,seppo0010/rlite-server,hgl888/redis,nnog/redis,jbochi/parallel_redis,nnog/redis,MSOpenTech/redis,haima-zju/redis-3.0-annotated,seppo0010/redis,ttuna/msot-redis,elkingtonmcb/redis,izhoujie/redis,harrisonfeng/redis,Markgorden/redis,itugs/redis,simplestbest/redis,splitice/redis,zguangyu/redis,tanghaodong25/redis,ipmobiletech/redis,CodeJuan/redis,YongMan/redis,OmarQunsul/graph-redis,huangz1990/redis-3.0-annotated,atreeyang/redis,izhoujie/redis,cloudrain21/redis,miaoyc1989/redis-3.0-annotated,darksideofthemoo/redis-histogram,YongMan/redis,drinkthere/redis-3.0-annotated,maodeyi/redis_lua,july2993/redis,yossigo/redis,whille/redis-3.0-annotated,fengshao0907/redis,qiyang0221/redis,wuyu201321060203/redis-3.0-annotated,jbochi/redis,Aliceljm1/redis,vincent-vivian-liu/redis,GitHubMota/redis,idning/redis,linfangrong/redis,mingyaaaa/redis,4396/redis,wangyikai/redis,sunheehnus/redis,gongice/redis-3.0-annotated,sunlianqiang/redis-3.0-annotated,riyan8250/redis,pedigree/redis,zhcy/redis,yossigo/redis,citusdata/redis,xuzhezhaozhao/redis_reading,YuraLukashik/redis,h0x91b/redis,wuyu201321060203/redis-3.0-annotated,badboy/redis,csuhawk/redis,izhoujie/redis,hornen/redis,ctripcorp/redis,maodeyi/redis_lua,dongqifan2/redis-3.0-annotated,wenxueliu/redis_comment,alenslan/redis,abhiklodh/redis,colstrom/redis,netroby/redis,zhcy/redis,roth1002/redis,huyuezheng/redis,Aliceljm1/redis-3.0-annotated,MasahikoSawada/redis,hawkchch/redis,riyan8250/redis,YuraLukashik/redis,dayuoba/redis,iandyh/redis,antirez/redis,taoguan/redis,yuzhangjob/redis-3.0-annotated-unstable,SyntaxStacks/redis,atreeyang/redis,badboy/redis,modulexcite/redis,twskipper/redis,dreamquster/redis,blackmady/redis,arijitvt/redis,ramonsnir/redis,clamoriniere1A/redis,gaoxianglong/redis,Aliceljm1/redis,rogerchina/redis,jbochi/parallel_redis,wujf/redis,j0hnma/szredis,modulexcite/redis,mverrilli/redis,CodeJuan/redis,adamweixuan/redis-3.0-annotated,gilala/redis,louisliangjun/redis,gilala/hredis,ouyangkongtong/redis,pedigree/redis,190235047/redis,zguangyu/redis,PKRoma/redis,PKRoma/redis,ramonsnir/redis,yuhc/redis-benchmark-enhanced,roth1002/redis,hornen/redis,haima-zju/redis-3.0-annotated,takeshineshiro/redis,Wangyao14cyy/redis,narma/redis,pmem/redis,pmem/redis,mumingv/redis-3.0-annotated,rogerlz/redis,kmiku7/redis,msn217/redis-3.0-annotated,wujf/redis,arijitvt/redis,charsyam/redis,Sciumo/redis,duanx/redis,mgk/redis,ttuna/msot-redis,mengzhejin/RedisStudy,oranagra/redis,wbailey5/redis,hgl888/redis,sunlianqiang/redis-3.0-annotated,brg-liuwei/redis,mingyaaaa/redis,oranagra/redis,jasonkying/redis,antirez/redis,mengyou0304/redis,Aaron1992/redis,idning/redis,abhiklodh/redis,rogerchina/redis,darksideofthemoo/redis-histogram,clamoriniere1A/redis,simplestbest/redis,YuraLukashik/redis,himoca/redis,duanx/redis,takeshineshiro/redis,modulexcite/redis,davidradunz/redis,SyntaxStacks/redis,tjschuck/redis,PradheepShrinivasan/redis,ton31337/redis,thomasdarimont/redis,universsky/redis,iandyh/redis,thomasdarimont/redis,zhiliaoniu/redis,dayuoba/redis,spinlock/redis,HouKangkang/redis-3.0-annotated,jackyan/redis,shshlzh/redis-3.0-annotated,HouKangkang/redis-3.0-annotated,j0hnma/szredis,OmarQunsul/graph-redis,blackmady/redis,gilala/hredis,kaushik94/redis,SyntaxStacks/redis,nilyang/redis-tdd-annotation,msn217/redis-3.0-annotated,ytjiang/redis,zguangyu/redis,july2993/redis,Sciumo/redis,mgk/redis,qiyang0221/redis,pmem/redis,wenxueliu/redis_comment,z-fork/redis,elkingtonmcb/redis,francischan714/redis,josiahcarlson/redis,tellapart/redis,nuxeh/redis,z-fork/redis,zhcy/redis,wprice/redis,pcarrier/redis,fankeke/redis-3.0-annotated,neomantra/redis,riyan8250/redis,jackyan/redis,adamweixuan/redis-3.0-annotated,wuyu201321060203/redis-3.0-annotated,davidradunz/redis,duanx/redis,saisai/redis,AplayER/redis,z-fork/redis,MSOpenTech/redis,yuhc/redis-benchmark-enhanced,simplestbest/redis,jxwr/redis,GitHubMota/redis,GrimDerp/redis,a-pavlov/redis,GrimDerp/redis,tanghaodong25/redis,nuxeh/redis,xuguruogu/redis,CodeJuan/redis,nnog/redis,yuzhangjob/redis-3.0-annotated-unstable,july2993/redis,JoeWoo/redis,saisai/redis,slfs007/mk-redis,jasonkying/redis,nnog/redis,abhiklodh/redis,Aliceljm1/redis,MSOpenTech/redis,gilala/bjredis,narma/redis,linfangrong/redis,ksarch-saas/redis,MOON-CLJ/redis,kmiku7/redis,shshlzh/redis-3.0-annotated,antirez/redis,brg-liuwei/redis,SummonY/redis,StevenTsai/redis,AplayER/redis,himoca/redis,gaoxianglong/redis,Hailei/redis,YuanZhewei/redis,whille/redis-3.0-annotated,ofirluzon/redis,Sciumo/redis,cusspvz/redis,h0x91b/redis,onlymellb/redis-3.0-annotated,xlzhan/redis,mumingv/redis-3.0-annotated,Markgorden/redis,huyuezheng/redis,badboy/redis,flashbuckets/redis,iandyh/redis,csuhawk/redis,cusspvz/redis,rouzier/redis,soveran/redis,flashbuckets/redis,gechong/redis-3.0-annotated,rogerlz/redis,seandsky/redis,RepmujNetsik/redis,sunheehnus/redis,darksideofthemoo/redis-histogram,itugs/redis,StevenTsai/redis,july2993/redis,xuguruogu/redis,rogerlz/redis,4396/redis,itamarhaber/redis,shining-yang/redis,mingyaaaa/redis,jxwr/redis,ouyangkongtong/redis,jacklee0810/redis-3.0-annotated,zhiliaoniu/redis,weizijun/redis,rogerchina/redis,mgk/redis,shreesundara/redis,190235047/redis,kmiku7/redis,YuanZhewei/redis,mattsta/redis,drinkthere/redis-3.0-annotated,pkdevbox/redis,nilyang/redis-tdd-annotation,ttuna/msot-redis,jasonkying/redis,wbailey5/redis,atreeyang/redis,rogerchina/redis,xuzhezhaozhao/redis_reading,mumingv/redis,taoguan/redis,seandsky/redis,colstrom/redis,AplayER/redis,blackmady/redis,MSOpenTech/redis,ReadCode/redis-3.0-annotated,fengshao0907/redis,ofirluzon/redis,xujunhai1991/redis,mumingv/redis,blackmady/redis,linfangrong/redis,ksarch-saas/redis,spinlock/redis,zhaobo1023/redis-3.0-annotated,PradheepShrinivasan/redis,zy416548283/redis-3.0-annotated,huangz1990/redis-3.0-annotated