fix race #967
fix race #967

this looks more like a problem with the test: the test is
waiting for a snapshot to be applied but checks this by
polling the engine, which means that it will go ahead
once the batch which applies the snapshot commits.

since the range stats were updated only after that,
there was a slight chance for a data race.

i have moved up the update to the stats object when
applying the snapshot since it did not seem useful
to switch to general atomic updates.

maxlang/cockroach,maxlang/cockroach,maxlang/cockroach,GokulSrinivas/cockroach,loucash/cockroach,XisiHuang/cockroach,ngaut/cockroach,cockroachdb/cockroach,iqstack/cockroach,cuongdo/cockroach,GokulSrinivas/cockroach,mbonaci/cockroach,mbertschler/cockroach,veteranlu/cockroach,ngaut/cockroach,ngaut/cockroach,veteranlu/cockroach,fengshao0907/cockroach,jess-edwards/cockroach,jgautheron/cockroach,yiixiansheng/cockroach,arjun4084346/cockroach,briceburg/cockroach,iqstack/cockroach,domluna/cockroach,arjun4084346/cockroach,c4pt0r/cockroach,slavau/cockroach,abhishekgahlot/cockroach,freakynit/cockroach,alex/cockroach,ajayaa/cockroach,bg451/cockroach,mbertschler/cockroach,c4pt0r/cockroach,marcuswestin/cockroach,ngaut/cockroach,alunarbeach/cockroach,marcuswestin/cockroach,jmank88/cockroach,chrisseto/cockroach,chrisseto/cockroach,loucash/cockroach,paperstreet/cockroach,ajayaa/cockroach,freakynit/cockroach,alunarbeach/cockroach,vaibhavarora/cockroach,linearb/cockroach,jamesgraves/cockroach,vivekmenezes/cockroach,paperstreet/cockroach,hassyma/cockroach,paperstreet/cockroach,il9ue/cockroach,cuongdo/cockroach,paperstreet/cockroach,XisiHuang/cockroach,glycerine/cockroach,veteranlu/cockroach,chrisseto/cockroach,nkhuyu/cockroach,iqstack/cockroach,GokulSrinivas/cockroach,veteranlu/cockroach,Abioy/cockroach,nkhuyu/cockroach,jgautheron/cockroach,domluna/cockroach,mbertschler/cockroach,domluna/cockroach,SustainFund/cockroach,slavau/cockroach,petermattis/cockroach,alunarbeach/cockroach,nkhuyu/cockroach,veteranlu/cockroach,arjun4084346/cockroach,nieyy/cockroach,marcuswestin/cockroach,Abioy/cockroach,arypurnomoz/cockroach,cuongdo/cockroach,paperstreet/cockroach,petermattis/cockroach,il9ue/cockroach,linearb/cockroach,cockroachdb/cockroach,glycerine/cockroach,jmank88/cockroach,vaibhavarora/cockroach,yiixiansheng/cockroach,arypurnomoz/cockroach,paperstreet/cockroach,SustainFund/cockroach,sunya123/cockroach,maxlang/cockroach,jamesgraves/cockroach,il9ue/cockroach,slavau/cockroach,cockroachdb/cockroach,freakynit/cockroach,il9ue/cockroach,loucash/cockroach,iqstack/cockroach,sunya123/cockroach,XisiHuang/cockroach,briceburg/cockroach,GokulSrinivas/cockroach,briceburg/cockroach,nkhuyu/cockroach,cockroachdb/cockroach,c4pt0r/cockroach,glycerine/cockroach,maxlang/cockroach,glycerine/cockroach,mbertschler/cockroach,mbonaci/cockroach,jmank88/cockroach,mbonaci/cockroach,slavau/cockroach,jamesgraves/cockroach,vaibhavarora/cockroach,linearb/cockroach,cockroachdb/cockroach,SustainFund/cockroach,chrisseto/cockroach,il9ue/cockroach,freakynit/cockroach,ajayaa/cockroach,jess-edwards/cockroach,SustainFund/cockroach,bg451/cockroach,fengshao0907/cockroach,abhishekgahlot/cockroach,paperstreet/cockroach,jmank88/cockroach,sunya123/cockroach,jgautheron/cockroach,arypurnomoz/cockroach,petermattis/cockroach,jess-edwards/cockroach,yosiat/cockroach,marcuswestin/cockroach,fengshao0907/cockroach,jgautheron/cockroach,abhishekgahlot/cockroach,paperstreet/cockroach,alunarbeach/cockroach,alex/cockroach,briceburg/cockroach,Abioy/cockroach,ajayaa/cockroach,sunya123/cockroach,arjun4084346/cockroach,cockroachdb/cockroach,yosiat/cockroach,jmank88/cockroach,sunya123/cockroach,loucash/cockroach,vaibhavarora/cockroach,freakynit/cockroach,iqstack/cockroach,yiixiansheng/cockroach,yosiat/cockroach,linearb/cockroach,vivekmenezes/cockroach,glycerine/cockroach,jamesgraves/cockroach,arjun4084346/cockroach,alex/cockroach,il9ue/cockroach,bg451/cockroach,mbertschler/cockroach,Abioy/cockroach,alex/cockroach,nieyy/cockroach,nkhuyu/cockroach,fengshao0907/cockroach,ajayaa/cockroach,linearb/cockroach,jess-edwards/cockroach,il9ue/cockroach,abhishekgahlot/cockroach,jess-edwards/cockroach,petermattis/cockroach,veteranlu/cockroach,loucash/cockroach,glycerine/cockroach,vivekmenezes/cockroach,bg451/cockroach,nieyy/cockroach,petermattis/cockroach,yosiat/cockroach,hassyma/cockroach,cuongdo/cockroach,mbertschler/cockroach,domluna/cockroach,petermattis/cockroach,marcuswestin/cockroach,iqstack/cockroach,vaibhavarora/cockroach,yosiat/cockroach,alex/cockroach,alunarbeach/cockroach,mbonaci/cockroach,vivekmenezes/cockroach,nieyy/cockroach,alex/cockroach,arjun4084346/cockroach,hassyma/cockroach,slavau/cockroach,jmank88/cockroach,c4pt0r/cockroach,arypurnomoz/cockroach,arypurnomoz/cockroach,bg451/cockroach,maxlang/cockroach,Abioy/cockroach,alunarbeach/cockroach,bg451/cockroach,abhishekgahlot/cockroach,yiixiansheng/cockroach,domluna/cockroach,linearb/cockroach,freakynit/cockroach,linearb/cockroach,loucash/cockroach,jess-edwards/cockroach,nieyy/cockroach,ngaut/cockroach,jamesgraves/cockroach,mbonaci/cockroach,SustainFund/cockroach,il9ue/cockroach,sunya123/cockroach,cuongdo/cockroach,arypurnomoz/cockroach,fengshao0907/cockroach,bg451/cockroach,glycerine/cockroach,abhishekgahlot/cockroach,briceburg/cockroach,SustainFund/cockroach,mbonaci/cockroach,ngaut/cockroach,veteranlu/cockroach,cuongdo/cockroach,c4pt0r/cockroach,cockroachdb/cockroach,maxlang/cockroach,yiixiansheng/cockroach,marcuswestin/cockroach,XisiHuang/cockroach,maxlang/cockroach,vaibhavarora/cockroach,cuongdo/cockroach,hassyma/cockroach,briceburg/cockroach,vivekmenezes/cockroach,c4pt0r/cockroach,domluna/cockroach,fengshao0907/cockroach,cuongdo/cockroach,vaibhavarora/cockroach,marcuswestin/cockroach,hassyma/cockroach,jamesgraves/cockroach,slavau/cockroach,petermattis/cockroach,arjun4084346/cockroach,sunya123/cockroach,nieyy/cockroach,arjun4084346/cockroach,jgautheron/cockroach,ajayaa/cockroach,veteranlu/cockroach,Abioy/cockroach,vivekmenezes/cockroach,hassyma/cockroach,nkhuyu/cockroach,jgautheron/cockroach,mbertschler/cockroach,XisiHuang/cockroach,ngaut/cockroach,vaibhavarora/cockroach,nieyy/cockroach,XisiHuang/cockroach,vivekmenezes/cockroach,nieyy/cockroach,jmank88/cockroach,chrisseto/cockroach,sunya123/cockroach,GokulSrinivas/cockroach,GokulSrinivas/cockroach,jamesgraves/cockroach,domluna/cockroach,iqstack/cockroach,vivekmenezes/cockroach,cockroachdb/cockroach,glycerine/cockroach,chrisseto/cockroach,jess-edwards/cockroach,yiixiansheng/cockroach,petermattis/cockroach,marcuswestin/cockroach,yosiat/cockroach