Download failure is caused by a communication error during the download or a remote user canceling the download. The MobiLink server holds download data that has not been received by the client so it can be used for a restartable download.
The MobiLink server does not release download data until one of the following occurs:
The user successfully completes the download.
The user comes back with a new synchronization request without attempting to resume.
The cache is needed for new downloads. The oldest unsuccessful download is cleared first.
MobiLink has functionality that can assist with download failure recovery, and prevent retransmission of the entire download. This functionality has separate implementations for SQL Anywhere and UltraLite remote databases. The -ds mlsrv17 option can be used with restartable downloads to specify the maximum amount of data on disk that the MobiLink server can use to store all restartable downloads.
The need for resumable downloads increases as network quality deteriorates and download sizes increase. If you only do small synchronizations or if you synchronize on a LAN or WLAN, then you likely do not need to resume downloads.
When synchronization fails during a download, the downloaded data is not applied to the remote database, however, the successfully transmitted portions of the download are stored in a temporary file on the remote device. Dbmlsync uses this file to avoid lengthy retransmission of data, and to recover from download failure.
There are three ways to implement this functionality. For all options, dbmlsync aborts and the resumed download fails if there is any new data to be uploaded.
After a download fails, use -dc the next time you start dbmlsync to resume the download. If part of the failed download was transmitted, the MobiLink server only transmits the remainder of the download.
When used on the dbmlsync command line, the cd extended option works just like the -dc option. You can also store this option in the database, or use sp_hook_dbmlsync_set_extended_options to set this option in a single synchronization.
You can use the restart parameter to cause a download to resume. You know a download is resumable if the restartable download parameter is set to true. You can also create logic in the hook to resume a download if a download file exists and is a certain size, by using the restartable download size.
You can control the behavior of UltraLite applications following a failed download as follows:
If you set the Keep Partial Download synchronization parameter to true when you synchronize, and the download fails before completion, then UltraLite applies that portion of the changes that were downloaded. UltraLite also sets the Partial Download Retained synchronization parameter to true.
The UltraLite database might be in an inconsistent state at this point. Depending on your application, you may want to ensure that synchronization completes successfully or is rolled back before you allow changes to the data.
To resume the download, set the Resume Partial Download synchronization parameter to true and synchronize again.
The restarted synchronization does not perform an upload, and downloads only those changes that would have been downloaded by the failed download. That is, it completes the failed download but does not synchronize changes made since the previous attempt. To get those changes, you need to synchronize again once the failed download has completed, or call Rollback Partial Download and synchronize with Resume Partial Download set to false.
When you restart the download, many of the synchronization parameters from the failed synchronization are used again automatically. For example, the publications parameter is ignored: the synchronization downloads those publications requested on the initial download. The only parameters that must be set are the Resume Partial Download parameter (which must be set to true) and the User Name parameter. In addition, settings for the following parameters are obeyed, if set:
To roll back the changes from the failed download without resuming synchronization, call the appropriate method or function to roll back the changes. This function is ULRollbackPartialDownload function for Embedded SQL. For UltraLite components, it is a method on the Connection object.
ULConnection.RollbackPartialDownload method [UltraLite.NET]
ULRollbackPartialDownload method [UltraLite Embedded SQL]
You may want to roll back the changes from a failed download if synchronization cannot be completed, for example if the server or network is unavailable, and you want to maintain a consistent set of data while letting the end user continue to work.