Exemplo n.º 1
0
 def getparentxid(self, xid):
     if not Trans.xidisnormal(xid):
         return 0
     pageno = xid / self.SUBTRANS_XACTS_PER_PAGE
     entry = xid % self.SUBTRANS_XACTS_PER_PAGE
     try:
         page = self.getlrupage(pageno)
     except UPgException:
         return 0
     
     parentxid = pgstruct.gettransactionid(page.data, entry*typesize['TransactionId'])
     return parentxid
Exemplo n.º 2
0
    def getparentxid(self, xid):
        if not Trans.xidisnormal(xid):
            return 0
        pageno = xid / self.SUBTRANS_XACTS_PER_PAGE
        entry = xid % self.SUBTRANS_XACTS_PER_PAGE
        try:
            page = self.getlrupage(pageno)
        except UPgException:
            return 0

        parentxid = pgstruct.gettransactionid(
            page.data, entry * typesize['TransactionId'])
        return parentxid
Exemplo n.º 3
0
 def getmembers(self, multixid, readtoinvalid = False, multixactstate = None):
     result = []
     thisoffset = self.offsetcache.getoffset(multixid, multixactstate)
     if not thisoffset:
         return None
     nextxid = uint32advancedIgnor0(multixid, 1)
     targetoffset = None
     if multixactstate and multixactstate.nextmultixactid == nextxid:
         targetoffset = multixactstate.nextoffset
     else:
         nextoffset = self.offsetcache.getoffset(nextxid, multixactstate)
         if not nextoffset and not readtoinvalid:
             logger.error("could not find next multi transaction's offset:%u"%(nextxid))
             return None
         if nextoffset:
             targetoffset = nextoffset
     
     offset = thisoffset    
     while True:
         if targetoffset and offset == targetoffset:
             break
         pageno = self.__getmemberpagebyoffset(offset)
         memberoff = self.__getmemberinnerpageoffsetbyoffset(offset)
         
         try:
             blockdata = self.getlrupage(pageno).data
         except UPgException:
             if targetoffset:
                 logger.error("could not read member block:%u"%(pageno))
                 return None
             else:
                 return result
         memberxid = pgstruct.gettransactionid(blockdata, memberoff)
         if memberxid == 0:
             if targetoffset:
                 logger.error("found invalid member transaction id in offset:%u"%(offset))
                 return None
             else:
                 return result
         flagoff = self.__getgroupflagoffset(offset)
         bshift = self.__getmemberflagbitsshit(offset)
         flag = pgstruct.getuint(blockdata, flagoff)
         status = (flag >> bshift) & self.MXACT_MEMBER_XACT_BITMASK;
         result.append((memberxid, status))
         offset = uint32advancedIgnor0(offset, 1)
     return result