Advanced 2
Previous  Top  Next

Database Corruption Prevention is an important component of UA's data warehousing system. The Advanced 2 screen under General Program Settings of UA Preferences allows you to customize corruption prevention features to meet your needs. Your selection here can dramatically affect the speed of data distribution.


When UA updates your database, the actual data on the hard drive is usually not changed immediately. Windows saves the work of writing to the hard drive in a prioritized task list. Depending upon the priority, Windows may stop everything until the task is done or it may wait until it is convenient or until there is nothing else to be done. The downside of waiting to write files to your drive becomes clear when your computer fails - even for an instant. Sudden system freezes can be caused by seemingly innocuous actions such as plugging in your digital camera's memory card, installing software or attempting to use new hardware with an old driver. Power failures (of course) and a host of other things can cause your system to crash or freeze. If this happens before all data is written to disk, you'll lose some data. The amount of data loss depends upon your settings as described below.

The above screen offers four levels of progressively conservative (and progressively time consuming) settings:

Do not flush writes during updating - (Recommended if speed is a high priority AND regular backups are maintained.) The top setting makes full use of Windows File IO optimization to provide you with the fastest possible distribution. It tells Windows to give the actual writes of the database file lowest priority. This provides an additional advantage when updating multiple days. UA can efficiently update the in-memory copy with all the days before Windows makes a single pass to write all of the changes to disk when everything is done. However, if a hardware or software failure occurs during data distribution, most, if not all, of your UA database will be lost. This is because those wonderfully fast in-memory updates are not written to the hard drive, and the jagged end of the file may contain random data that can destroy your UA database. If a failure occurs during this type of distribution, you will need to restore the full UA system from your recent backup and then re-collect to bring your database current. When this setting is chosen, it is imperative that you back up your UA system weekly.

Flush writes as files are complete and employ a log file. (Default) The second fastest setting (second from top) is a safer alternative than the top setting. When UA has finished writing to a database file, it tells Windows to write the changes to the hard drive while it waits. UA runs slower, but all files are written with each update. Since the directory itself is kept in memory, opening and closing of files is pretty quick. This method is subject to file corruption in the event of a power failure or hardware glitch during distribution. If this happens, you can use Unfair Advantage's DB Integrity search to try to determine which files were damaged. This could be a couple of files or a few hundred, so you'll have to decide for yourself if online replacement is practical or if you should restore from a backup. The setting is recommended if your computer is working reliably and you will not be too inconvenienced by an outage or two per year. Weekly backups are recommended for this setting.

Avoid lazy intermediate writes and flush - The third setting tells Windows to use a higher priority for writing files to the UA database than it employs with ordinary text documents. This should result in the database files being written correctly and the directory list being more current in the event of system failure. The directory list may be inaccurate, but thanks to the higher priority, it should only affect a couple of files. These files can be found and replaced using the DB Integrity Search facility in UA. If you like tinkering with your computer and trying new things (which make your system more prone to failure), the third setting may suit you.

Flush entire drive's cache file with each update - The fourth and safest setting forces Windows to write all changes to the hard drive immediately while UA is updating. Of course, that means that Windows has to constantly wait for the hard drive to do its work, increasing the time required for updating by as much as tenfold. Be aware that this will not only slow UA, but also everything else running on your computer at that time. You could still, theoretically, lose one database file if an interruption occurs after the database file has been updated, but before the directory has been updated. If database failure is not an option for you, we can only recommend this safest setting.

Select your flushing preference by clicking on the pointer and dragging it to the desired setting. Click [OK] when all desired settings have been selected.

Some people have purchased hard drives with onboard memory caches. These certainly speed up UA distribution for all settings except the fastest, but you have to depend on your hard drive to write those 8 MB of updates to the hard drive when there is a problem. Such IDE controller memory cache should result in fewer files being damaged for the same performance, provided you also set UA to a safer setting.