Re: [Metakit] How to backup a metakit database?

2004-10-13 Thread Jean-Claude Wippler
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


Re: [Metakit] Re: c4_Bytes destructor causes memory deallocation failure

2004-10-13 Thread Jean-Claude Wippler
Arto Stimms wrote:
It seems that the destructor releases the wrong
memory.
In the debug build it gives an assertion at the
deallocation, but in a release build it gives no
error.
This just makes it worse though, since it may later
try to use the released memory, causing a crash.
Check this example program which on my machine fails
after the fourth iteration:
#include mk4.h
#include string
#include iostream
using namespace std;
void main() {
c4_Storage storage(datafile.kit, true);
c4_View v = storage.GetAs(v[b:B]);
v.Add(c4_Row());
c4_BytesProp pBytes(b);
string teststring(Hello, this is a test!); //
len=22
c4_Bytes textbytes(teststring.data(),
teststring.length());
for (int i=0;i  100;++i) {
cout  i  endl;
c4_Bytes newbytes = pBytes(v[0]).Access(0, 17);
pBytes(v[0]).Modify(textbytes, 0, textbytes.Size());
}
}
I am using metakit 2.4.9.3 with the modify patch on
windows.
I am not seeing this with the CVS build on Linux or Mac OS X.  Don't 
have a Windows compile setup ready this minute, could you check with 
latest CVS as well?

(FWIW, I had to add an AutoCommit() call to make anything end up on 
disk)

-jcw
_
Metakit mailing list  -  [EMAIL PROTECTED]
http://www.equi4.com/mailman/listinfo/metakit


Re: [Metakit] Re: c4_Bytes destructor causes memory deallocation failure

2004-10-13 Thread Arto Stimms
 I am not seeing this with the CVS build on Linux or
 Mac OS X.  Don't 
 have a Windows compile setup ready this minute,
 could you check with 
 latest CVS as well?

I just tried it with the latest version from CVS as
well, and still has the same error :-( Maybe someone
else on windows could try it out to verify that it is
not just a problem with my setup?

Best Regards,
  Arto Stimms




__
Do you Yahoo!?
Yahoo! Mail - You care about security. So do we.
http://promotions.yahoo.com/new_mail
_
Metakit mailing list  -  [EMAIL PROTECTED]
http://www.equi4.com/mailman/listinfo/metakit