Logo Search packages:      
Sourcecode: gadfly version File versions  Download package

def gadfly::store::File_Storage0::dump (   self,
  db 
)

perform a checkpoint (no active transactions!)

Definition at line 474 of file store.py.

00474                       :
        """perform a checkpoint (no active transactions!)"""
        # db should be non-shadowing db
        # first thing: back up the log
        backup_file(self.logfilename(), self.backup_logfilename())
        verbose = self.verbose
        if verbose: print "fs0: checkpointing db"
        if db.is_scratch or db.readonly:
            # don't need to do anything.
            if verbose: print "fs0: scratch or readonly, returning"
            return
        log = db.log
        if log:
            log.commit()
            if verbose:
                print "DEBUG LOG TRACE"
                log.dump()
            log.shutdown()
        if db.touched:
            if verbose: print "fs0: db touched, backing up ddf file"
            backup_file(self.dbfilename(),
                        self.backup_dbfilename())
        relations = db.relations()
        for r in relations:
            rel = db[r]
            #print r
            if rel.touched:
                if verbose: print "fs0: backing up touched rel", r
                backup_file(self.relfilename(r),
                            self.backup_relfilename(r))
        for r in relations:
            if verbose: print "fs0: dumping relations now"
            self.dumprelation(r, db[r])
        if verbose: print "fs0: dumping datadefs now"
        self.dumpdatadefs(db)
        # del of logfile signals successful commit.
        if verbose: print "fs0: successful dump, deleting log file"
        logfilename = self.logfilename()
        blogfilename = self.backup_logfilename()
        del_file(logfilename)
        del_file(blogfilename)
        if db.touched:
            if verbose: print "fs0: deleting backup ddf file"
            del_file(self.backup_dbfilename())
            db.touched = 0
        for r in relations:
            rel = db[r]
            if rel.touched:
                if verbose: print "fs0: deleting rel backup", r
                del_file(self.backup_relfilename(r))
            rel.touched = 0
        if verbose: print "fs0: restarting db log"
        log = db.log = DB_Logger(logfilename, blogfilename)
        log.startup()
        if verbose: print "fs0: dump complete"
        self.recovery_mode = 0

    def dumprelation(self, name, rel, force=0):


Generated by  Doxygen 1.6.0   Back to index