Changeset 1584

Show
Ignore:
Timestamp:
10/30/08 12:42:05 (2 months ago)
Author:
peet
Message:

mark node as «undead» after it's re-join

Files:

Legend:

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

    r1582 r1584  
    594594                        return ring 
    595595 
     596        def state_running(self,node,hostname): 
     597                if node.watch.has_key(hostname): 
     598                        del node.watch[hostname] 
     599 
     600                a = self.mdns.getCache(hostname,types=[zeroconf._TYPE_TXT,])[0] 
     601                a.setProperty("state","running") 
     602 
     603 
     604        def state_stale(self,node,hostname): 
     605                node.watch[hostname].setProperty("state","stale") 
     606                del node.watch[hostname] 
     607                x = ACoreService(self.bus,self.bus.address) 
     608                x.nop() 
     609 
    596610        @public 
    597611        def dconfirm(self, index, addr): 
     612                rcpt = addr["from"].split("@")[-1] 
    598613                node = self.get(index) 
    599                 del node.dsync[addr["from"].split("@")[-1]
    600                 del node.watch[addr["from"].split("@")[-1]] 
     614                del node.dsync[rcpt
     615                self.state_running(node,rcpt) 
    601616                node.dconfirmed[addr["from"]] = index 
    602617 
    603618        @public 
    604619        def uconfirm(self, index, data, addr): 
     620                rcpt = addr["from"].split("@")[-1] 
    605621                node = self.get(index) 
    606                 del node.usync[addr["from"].split("@")[-1]
    607                 del node.watch[addr["from"].split("@")[-1]] 
     622                del node.usync[rcpt
     623                self.state_running(node,rcpt) 
    608624                node.uconfirmed[addr["from"]] = { 
    609625                        "index": index, 
     
    613629        @public 
    614630        def confirm(self, new_index, index, data, addr): 
     631                rcpt = addr["from"].split("@")[-1] 
    615632                node = self.get(index) 
    616                 del node.async[addr["from"].split("@")[-1]
    617                 del node.watch[addr["from"].split("@")[-1]] 
     633                del node.async[rcpt
     634                self.state_running(node,rcpt) 
    618635                node.aconfirmed[addr["from"]] = { 
    619636                        "new_index": new_index, 
     
    645662                                if node.watch.has_key(hostname): 
    646663                                        self.log("critical","Node sync (add) watchdog: low watermark touch; mark node as stale") 
    647                                         node.watch[hostname].setProperty("state","stale") 
    648                                         del node.watch[hostname] 
    649                                         x = ACoreService(self.bus,self.bus.address) 
    650                                         x.nop() 
     664                                        self.state_stale(node,hostname) 
    651665                else: 
    652666                        self.log("debug","Node sync watchdog for host `%s` terminated: confirmed" % (hostname)) 
     
    674688                                if node.watch.has_key(hostname): 
    675689                                        self.log("critical","Node sync (update) watchdog: low watermark touch; mark node as stale") 
    676                                         node.watch[hostname].setProperty("state","stale") 
    677                                         del node.watch[hostname] 
    678                                         x = ACoreService(self.bus,self.bus.address) 
    679                                         x.nop() 
     690                                        self.state_stale(node,hostname) 
    680691                else: 
    681692                        self.log("debug","Node sync watchdog for host `%s` terminated: confirmed" % (hostname)) 
     
    703714                                if node.watch.has_key(hostname): 
    704715                                        self.log("critical","Node sync (del) watchdog: low watermark touch; mark node as stale") 
    705                                         node.watch[hostname].setProperty("state","stale") 
    706                                         del node.watch[hostname] 
    707                                         x = ACoreService(self.bus,self.bus.address) 
    708                                         x.nop() 
     716                                        self.state_stale(node,hostname) 
    709717                else: 
    710718                        self.log("debug","Node sync watchdog for host `%s` terminated: confirmed" % (hostname)) 
     
    729737                for i in x: 
    730738                        a = self.mdns.getCache(i,types=[zeroconf._TYPE_TXT,])[0] 
    731                         node.dsync[i] = 2 
     739                        node.dsync[i] = 5 
    732740                        if a.properties.has_key("state"): 
    733741                                if a.properties["state"] != "stale": 
    734742                                        node.watch[i] = a 
    735                                         node.dsync[i] = 5 
    736743                        self._t_del(i,index) 
    737744                         
     
    783790                for i in x: 
    784791                        a = self.mdns.getCache(i,types=[zeroconf._TYPE_TXT,])[0] 
    785                         node.usync[i] = 2 
     792                        node.usync[i] = 5 
    786793                        if a.properties.has_key("state"): 
    787794                                if a.properties["state"] != "stale": 
    788795                                        node.watch[i] = a 
    789                                         node.usync[i] = 5 
    790796                        self._t_update(i,p) 
    791797                         
     
    869875                for i in x: 
    870876                        a = self.mdns.getCache(i,types=[zeroconf._TYPE_TXT,])[0] 
    871                         node.async[i] = 2 
     877                        node.async[i] = 5 
    872878                        if a.properties.has_key("state"): 
    873879                                if a.properties["state"] != "stale": 
    874880                                        node.watch[i] = a 
    875                                         node.async[i] = 5 
    876881                        self._t_add(i,p) 
    877882                #