locked
[MSF-SDK 2.0] - 2830 lines downloaded but 0 inserted ?!? RRS feed

  • General discussion

  • I've provisioned 2 databases (both have data) using somewhat like this:

    SqlSyncScopeProvisioning serverConfig = new SqlSyncScopeProvisioning(scopeDesc);
    serverConfig.SetCreateTableDefault(DbSyncCreationOption.Skip);
    serverConfig.SetPopulateTrackingTableDefault(DbSyncCreationOption.Create);
    serverConfig.ObjectSchema = "dbo";

    then setup the following settings:

    - direction = download

    - use batches : 500kb

    - cleanup metadata after sync (7 days)

     

    the log after doing a sync says:

    Start Time: 6/15/2010 3:14:23 PM

    Total Changes Uploaded: 0

    Total Changes Downloaded: 2832

    Complete Time: 6/15/2010 3:14:36 PM

     

    but this is not true !

    the destination table only contains the initial data !!

    - no errors occur

    - all conflicts are set to "continue" and "PartialSync" if outdated

     

     

    any advice ?!??

    Thanks

    Tuesday, June 15, 2010 2:21 PM

All replies

  • What does DownloadChangesApplied and DownloadChangesFailed show?
    Tuesday, June 15, 2010 3:41 PM
  • You could also enable tracing and see what has happened when you sync. http://msdn.microsoft.com/en-us/library/cc807160.aspx

     

    Tuesday, June 15, 2010 7:10 PM
    Answerer
  • the story continues

     

    the Server has inserted 2 lines and now the Client writes this log every 5 minutes :

     

    Sync Completed...

     

    Start Time: 6/16/2010 2:59:59 AM

    Total Changes Uploaded: 0

    Total Changes Downloaded: 2

    Complete Time: 6/16/2010 3:00:02 AM

     

    Sync Completed...

     

    Start Time: 6/16/2010 3:04:59 AM

    Total Changes Uploaded: 0

    Total Changes Downloaded: 2

    Complete Time: 6/16/2010 3:05:02 AM

     

    Sync Completed...

     

    Start Time: 6/16/2010 3:09:59 AM

    Total Changes Uploaded: 0

    Total Changes Downloaded: 2

    Complete Time: 6/16/2010 3:10:02 AM

     

    Sync Completed...

    Wednesday, June 16, 2010 6:25 AM
  • I'm not quite sure were to find those two properties/events... 

    here's what i got:

     

     

    var SSPServ = new SqlSyncProvider(CurrentSettings.ScopeName, serverConn, null, "dbo");
    SSPServ.ApplyChangeFailed += new EventHandler<DbApplyChangeFailedEventArgs>(SSPServ_ApplyChangeFailed);
    SSPServ.SyncPeerOutdated += new EventHandler<DbOutdatedEventArgs>(SSP_SyncPeerOutdated);
    syncOrchestrator.LocalProvider = SSPServ;
    
    //-------
    
    if (CurrentSettings.DoLogging)
         {
          #region Log
          var log = GetLogger();
          log.WriteLine("Start Time: " + syncStats.SyncStartTime);
          log.WriteLine("Total Changes Uploaded: " + syncStats.UploadChangesTotal);
          log.WriteLine("Total Changes Downloaded: " + syncStats.DownloadChangesTotal);
          log.WriteLine("Complete Time: " + syncStats.SyncEndTime);
          log.WriteLine("");
          log.WriteLine("Sync Completed...");
          log.WriteLine("");
          log.Close();
          #endregion
         }
    
    //---------------
    
    void SSPClient_ApplyChangeFailed(object sender, DbApplyChangeFailedEventArgs e)
      {
       var Log = GetLogger();
       Log.WriteLine("sync error: " + e.Conflict.ErrorMessage);
       Log.Close();
    
       switch (e.Conflict.Type)
       {
        case DbConflictType.ErrorsOccurred:
         e.Action = CurrentSettings.Client_ErrorsOccurred;
         break;
        case DbConflictType.LocalCleanedupDeleteRemoteUpdate:
         e.Action = CurrentSettings.Client_LocalCleanedupDeleteRemoteUpdate;
         break;
        case DbConflictType.LocalDeleteRemoteDelete:
         e.Action = CurrentSettings.Client_LocalDeleteRemoteDelete;
         break;
        case DbConflictType.LocalDeleteRemoteUpdate:
         e.Action = CurrentSettings.Client_LocalDeleteRemoteUpdate;
         break;
        case DbConflictType.LocalInsertRemoteInsert:
         e.Action = CurrentSettings.Client_LocalInsertRemoteInsert;
         break;
        case DbConflictType.LocalUpdateRemoteDelete:
         e.Action = CurrentSettings.Client_LocalUpdateRemoteDelete;
         break;
        case DbConflictType.LocalUpdateRemoteUpdate:
         e.Action = CurrentSettings.Client_LocalUpdateRemoteUpdate;
         break;
        default:
         break;
       }
      }
    
    
    //-------------------------------

     

     

     

    Wednesday, June 16, 2010 6:38 AM
  • i'll take a look, thanks.
    Wednesday, June 16, 2010 6:41 AM
  • What is the difference to the SyncTracer and homebrew Logger ???

    when reading the link you sent, it looks like a logger-pattern - which i already use...

    Thursday, June 17, 2010 7:36 AM
  • Im getting these errors :

    sync error: Cannot insert the value NULL into column 'LXNMETODE', table 'C5.dbo.MEDARBEJDER'; column does not allow nulls. INSERT fails.

     

    The statement has been terminated.

    sync error: Cannot insert the value NULL into column 'LXNMETODE', table 'C5.dbo.MEDARBEJDER'; column does not allow nulls. INSERT fails.

    The statement has been terminated.

    -------------------

    only problem is: THE VALUE IS NOT NULL !!!! - it's '0' 

     

    Thursday, June 17, 2010 9:23 AM
  • the homebrew logger will log only what the developer chooses to log and will not have the internal events/steps inside Sync Framework itself. SyncTracer when enabled will allow the embedded tracing events inside Sync Fx itself.

    Thursday, June 17, 2010 1:38 PM
  • DownloadChangesApplied and DownloadChangesFailed are properties of SyncStatistics. you should be able to access them in the same way you access UploadChangesTotal and DownloadChangesTotal.
    Thursday, June 17, 2010 1:40 PM
  • Now that i've added:

    - the cofiguration options

    - the error-event-handler code from sample

    - the config.txt file


    and nothing happens,  the SyncTacer either doesn't work or it doesn't react on the described settings...  any advice ?

     

    update:

    The Program needed to be run as Administrator in order to create the TraceLog.txt on C-drive... 

    Monday, July 5, 2010 10:56 AM