Administration Guide : Database synchronization : Syncs: to -delnorm or not to -delnorm

Syncs: to -delnorm or not to -delnorm
The process responsible for synchronizing the database with the file system is called syncvoltodb(8). That process can be called by hand or by another program, such as userperms or dblogd(8). In all of these cases, the sync can be run with or without -delnorm option.
Important note:
Never use the -del flag with syncvoltodb(8) for it can be destructive. Always use -delnorm instead. However, as you have seen earlier, you can safely use a -del flag with userperms. In that instance, -del performs with userperms exactly as -delnorm performs with syncvoltodb(8).
Default behavior
A sync happens on a directory-by-directory basis. The idea is to get the database’s information on the folder’s contents to agree with what’s on the file system, and to do it as quickly as possible. Roughly, here is the procedure for each directory:
1.
What's the modification time?
2.
3.
Is the folder online?
4.
If it’s listed as offline in the database, Xinet will sync that directory and any files it contains.
5.
6.
7.
If the folder is listed as online, Xinet won’t sync it (yet). Instead it will ask a further question:
Is the modification time of the folder (according to the database) the same as the modification time on the file system?
8.
If the modification times are the same, then Xinet doesn’t sync that folder or the files it contains. If the modification times are different, Xinet will sync the folder and its files. Again, any subfolders are treated as new folders.
The idea here is to prevent synchronizing directories where nothing has changed (which is very common.) Any change made to the files inside a folder (renaming, removing, adding) will also update the modification time of the folder itself. Therefore, it’s safe to assume that a folder whose modification time is identical to that in the database doesn't contain files that have been changed since the last sync/update of the database.
In sum, Xinet only synchronizes the contents of a folder if there is a disagreement between the file system and the database about the folder’s online status or its modification time.
There is also one exception to note: when a file has been modified by an application other than Photoshop, the directory’s modification time is not updated. That sort of change will escape the method described above. Therefore, Xinet also checks file modification dates in all directories. Upon finding a file modification discrepancy, Xinet will update that file.
Using -delnorm
The -delnorm flag means:
Set all files as offline.
Setting all files as offline ensures that the syncvoltodb(8) will synchronize every file and folder on the file system without exception. That’s because the answer to Is the folder online? will always be No — and therefore, Xinet will synchronize the entire file system.
There should be nothing different between the database and the file system after a
-delnorm sync.
A -delnorm sync will consult globald for information about any archived files within the Xinet enabled volume.
Not using -delnorm
A sync run without a -del or -delnorm simply uses the procedure outlined in the "Default behavior” on page 652.
This type of sync is designed to catch changes made to the file system that evaded dblogd(8), and to do it quickly. It only consults globald when there is a directory modification discrepancy.
Typical operations that do not use a -delnorm include:
Resubmitting a volume in the Volumes tab without changing any of the options.
Synchronizations run by listdir on the directory being displayed.
Syncs run without a -delnorm flag have one big flaw, known as the “cover-up” case. Normally, any change made to the file system (via SMB, NFS, or Unix) will cause a modification time discrepancy for the folder, thus setting up this directory to be synchronized when a sync is run. However, the modification time discrepancy can be covered up. Consider this scenario:
2 pm
2 pm
3 pm
3 pm
4 pm
3 pm
At this point, a sync (without a -del) will notice the modification time
discrepancy and sync this directory.
5 pm
5 pm
So whatever files where added at 4 pm via Unix or SMB will not be added to the database when the sync happens. The only option is to run a syncvoltodb -delnorm on that directory (or a directory above it). As you can see, this adds an element of chance as to whether files will be caught by the sync or not.