Wolfgang Weisselberg wrote: > > At 2002-05-28 10:18:51 (+0200), Bart Lateur wrote: >
First, thanks Wolfgang and Bart! I really appreciate the fact that you've taken the trouble to think about this and make suggestions. >>On Wed, 22 May 2002 19:27:02 +0200, Wolfgang Weisselberg wrote: >> > >>>BTW, I think zpack could be done better by copying the original >>>to .bak, generate a new DB .new (as done in zpack) and then >>>atomically rename .new to be the database. But currently I lack >>>the time for a patch for that. :-/ >>> > >>The problem with that, at least under Unix and in the generic case, is >>that it's impossible to keep the original owner and permissions of the >>file for your copy. >> > > True. Yep, Bart's reasoning is why I did it the way I did. Also to ensure that both the original and the new version remain flocked during the operation and to not even start the operation unless both flocks are in place. BUT, :-) this is all more off topic for the DBI list than you perhaps suspect because zpack() is a not a method used by *DBD::AnyData*, it is only used by *AnyData* when it's used stand-alone in its tied-hash interface. Basically when you ask DBD::AnyData to delete records, it opens/locks the file, makes an in-memory copy of the database minus the selected records, seeks to the start and truncates the file, writes the in-memory copy back to the file, closes the file, all right then when you ask it without any backup or temporary file. OTOH when you ask AnyData as a tied-hash interface to delete a record, it stores the record in a hash of deleted records and only physically performs the deletion when zpack() is called when you close the file or its tie goes out of scope. The zpack() method returns without doing anything unless there is a hash of deleted records and that hash is only created in the AnyData tied-hash interface, not in the DBD::AnyData interface. (Actually the tied hash interface allows you to delete in either fashion -- physically delete for each deletion or only physically delete with zpack, see the docs on atomicity for how). The rules about atomicity, deletions, and zpack in the pod all apply *only* to the tied-hash interface. Obviously I need to fix the docs to make that clear. Wolfgang, you may already know this, but the same applies to the patch you sent for get_undeleted_record() -- it is a method specific to the tied hash interface and not used by the DBD interface. -- Jeff
