Large Tables in Frontier 7.0 OSX (copying and corruption)

Bill Humphries whump at apple.com
Thu Aug 23 18:30:37 PDT 2001


Platform: Frontier 7.0 OSX on G4 dual processor

Working on stablizing an existing application and running into some 
oddities. And I'm working on getting my Frontier chops back up to speed 
as well.

The application had been logging transactions to a table in a GDB, and 
that table had become large (2000+ entries), and there was no process to 
rotate it. I learned this when the GDB became so large that we could no 
longer write to it.

I've created a backup script that creates a new GDB. When I run it on 
copies of the large GDB, it spends some time churning.

Three things:

First, the backup GDB appears in the Guest Databases/opps/backups along 
with a "._<name of backup>" file. So it doesn't appear in the OSX 
finder, but is there when you ls -a in the terminal.

Second, you cannot open the backed up GDB fron Frontier.

Third, although the original table updates. In the finder and from the 
command line, the table shows as having the same size in bytes as the 
original.

Here's the script I'm using. I may not be using the right strategy for 
this backup anyway.

on backupTableFromGDB(gdb,theTable) {
	«Given a name of a Guest Database and a table inside it, create a 
backup database named gdbname.root.yyyy-mm-dd, copy the named table from 
the original, then clear the table in the original.
	«Bill Humphries, (c) Apple Computer, August 2001
	«Parameters
		«gdb: string representing path to guest database
		«theTable: table within GDB specified in 'gdb' to backup
	«Context
		«This script was written to be run from inside a scheduler 
thread.
	local(d,new,old,frontierPath,GDBPath,sep,numItemsRemoved,logname);
	«First, create some strings
	sep = file.getPathChar();
	frontierPath = file.getPath() + sep + "Frontier";
	GDBPath =  "Guest Databases";
	old =  frontierPath + sep + GDBPath + sep  + "apps" + sep + gdb;
	d = date.year() + "-" + date.month() + "-" + date.day();
	«d = d + "." + random(0,999) « Used in testing
	new = frontierPath + sep +  GDBPath + sep + "ops" + sep + 
"backups" + sep + gdb + "." + d;
	logname = "backupTableFromGDBLog";
	try {
		fileMenu.new(new)}
	else {
		log.add ("Unable to create new backup GDB: " + new, logname, true)};
	try {
		fileMenu.open(new)}
	else {
		log.add ("Unable to open new backup GDB: " + new, logname, true)};
	«Copy over the old table to the backup
	[new].[theTable] = [old].[theTable];
	try {
		fileMenu.save(new);
		fileMenu.close(new);
		log.add("Saved backup of " + old + " as " + new,logname,true)}
	else {
		log.add ("Unable to save new backup GDB: " + new, logname, true)};
	«Dump old table
	numItemsRemoved = table.emptyTable(@[old].[theTable]);
	log.add("Removed " + numItemsRemoved + " from " + gdb, logname, true);
	try {
		fileMenu.saveMyRoot(@[old].[theTable])}
	else {
		log.add("Unable to save changes to " + old, logname, true)}}

---
Bill Humphries <whump at apple.com>
Intranet Mechanic, HR Systems




More information about the Frontier-Users mailing list