Ben Combee wrote:
DmSyncDatabase will completely write the changes before it returns. At least, it will make all the calls to VFS to do the file modifications. However, DmSyncDatabase may fail -- if there isn't enough space on the volume that holds the databases to write the changes, the changes will be thrown away and you'll get an error code.

I don't like to be a complainer (and I don't mean to shoot the messenger), but do the people who are responsible for NVFS realize how seriously terrible this behavior is? For all practical purposes, once you've called DmSyncDatabase(), it's far, far too late for the system to be giving an error due to something like lack of space. By that time, you may have put potentially hundreds of records worth of stuff in all kinds of places, and it's hard to know exactly what you should do when DmSyncDatabase() fails, other than just give up and totally forget keeping data integrity.

Yeah, it's possible to design around this from the beginning and cope
with it OK, but the unfortunate fact remains that thousands and thousands
of applications were written with the assumption that DmNewRecord()
and DmResizeRecord() (and their resource database counterparts) tell
the truth and don't promise space that doesn't exist.

The worst thing is, even on NVFS systems, it should be possible for
DmNewRecord() and DmResizeRecord() to fail immediately if the space
isn't available.  Yes, we're talking about two different pools of
space (one in RAM (the DBCache) and one in flash (the backing
filesystem)), but everything is still going through the Data and
Resource Manager routines, and they should know (or have easy
access to) the amount of free space on the filesystem, so that
they can perform the computation.  And yes, this makes the NVFS
implementation more complicated.  But, to my mind, it's better to
add 100 or even 1000 lines of extra code to NVFS rather than
forcing thousands of developers to each struggle with this issue
separately (or worse, just ignore it and play fast and loose with
the user's data).

  - Logan

--
For information on using the Palm Developer Forums, or to unsubscribe, please 
see http://www.palmos.com/dev/support/forums/

Reply via email to