Changeset 1586

Show
Ignore:
Timestamp:
10/30/08 16:57:26 (2 months ago)
Author:
peet
Message:

handling cases with unresponsible instances during startup DB resync

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/0.4.7/shell/state/ddb.py

    r1584 r1586  
    3838 
    3939from command import swrapper 
     40import sys 
    4041 
    4142# node masks 
     
    248249                self.prefix = prefix 
    249250                self.sync = {} 
     251                self.watch = 0 
     252                self.fail = 0 
    250253 
    251254                self.createNodeSet("root") 
     
    271274                        if self.sync[hostname] > 0: 
    272275                                self.log("debug","DB resync watchdog for host `%s` started with ttl `%s`" % (hostname,self.sync[hostname])) 
    273                                 Timer(5,self._resync,(hostname,)).start() 
     276                                Timer(1,self._resync,(hostname,)).start() 
    274277                        else: 
    275                                 self.log("critical","DB resync watchdog: low watermark touch") 
     278                                self.log("debug","DB resync watchdog: low watermark touch") 
     279                                del self.sync[hostname] 
     280                                self.fail += 1 
     281                                if self.fail == self.watch: 
     282                                        self.log("critical","No CX instance responded for DB resync, exiting") 
     283                                        self.bus.put("dispatcher2","shutdown") 
     284                                else: 
     285                                        self.log("debug","DB resync: failed %i instances from %s" % (self.fail, self.watch)) 
     286                                        x = ACoreService(self.bus, self.bus.address) 
     287                                        x.nop() 
    276288                else: 
    277289                        self.log("debug","DB resync watchdog for host `%s` terminated" % (hostname)) 
     
    284296                if not ring: 
    285297                        self.log("critical","There are no hostnames (even local hostname) in the ring at DB resync, please check firewall for UDP traffic") 
     298                self.watch = len(ring) 
    286299                for i in ring: 
    287                         self.sync[i] = 20 
     300                        self.sync[i] = 5 
    288301                        self._resync(i) 
    289302                yield None