Re: How to backup a metakit database?

Jean-Claude Wippler <[email protected]>
Newsgroups gmane.comp.db.metakit
Message-ID <[email protected]>
Allan Wind wrote:

> How do you backup a metakit database?
>
> The cold case is obvious as usual, ensure that no one else has the
> database file open prior to making a copy of the data with a file level
> tools (cp, tar etc).
>
> What are the options for hot (i.e. open with an active writer) backups?
> I noticed the information in the python api reference for doing this
> from the writer thread/process, but are there any options for doing it
> externally?  If the file is open commit-extend, can you use the same
> trick if you open the datbase read-only in a 2nd process?  If using
> commit-aside, is it then safe to just low-level copy the "main"
> database?

The race is during a commit (from when it starts to until it 
completes), because that is when MK writes to file.  You will need to 
stay out of that time span if you wish to have a solid backup.  It 
seems to me that it could be done on a not-too-active DB simply as 
follows:
	- determine clock time T
	- wait until at least one sec has passed since T
	  (actually: the time resolution of the underlying filesystem)
	- copy entire datafile
	- check mod date of orig, must still be <= T
	- rinse and repeat if this test failed
On Windows, I am not sure this will work: if the O/S does not update 
modtimes right away then the above will not be reliable.

The other way to do it is with support from the committing app so 
independent readers  have a way of telling whether there was a commit, 
say by incrementing a revision number of a separate info file.

> Is journaling planned?  I.e. point in time recoverability between
> backups.

There is a first cut at this via the commit-aside mode.  There have 
also been simple-but-working tricks in the Tcl wrapper to intercept all 
calls (to do remoting, as well as creating transcripts of all requests 
for debugging/replay).

With custom viewers, one could write a view layer which intercepts all 
changes at the C++ level, but that requires more work and discipline 
during use.  I've been hesitant to implement such thing only because I 
am trying to improve the raw core of MK before building more on top.  
They are definitely good ideas and *very* worthwhile, IMO.

-jcw

_____________________________________________
Metakit mailing list  -  [email protected]
http://www.equi4.com/mailman/listinfo/metakit
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.