none
Synchronization error.

    Question

  • I am trying to use sync net framework 2.1  for synchronization of the two  DB Firebird 2.5.2. I create custom DbProvider.

    Before method call "SyncOrchestrator.Synchronize ();"
    syncProvider.SelectScopeInfoCommand="select scope_id, scope_local_id, scope_sync_knowledge, scope_forgotten_knowledge, scope_timestamp from scope_info where scope_name = @sync_scope_name";

    during a call there is an exception - System.InvalidOperationException, syncProvider.SelectScopeInfoCommand=null and connection is close;
    why so occurs?

    PROCEDURE:

    CREATE OR ALTER PROCEDURE SP_GET_NEXT_DBTS 
    returns (
        sync_new_timestamp bigint)
    as
    begin
         sync_new_timestamp=gen_id(G_DBTS, 1);
     suspend;
    end

    method:
    public FbCommand F_SyncProviderGetSelectNewTimestampCommand()
    {
          FbCommand comm = new FbCommand();
          comm.CommandType = CommandType.StoredProcedure;
          comm.CommandText = "SP_GET_NEXT_DBTS";
          comm.Parameters.Add("sync_new_timestamp", FbDbType.BigInt).Direction = ParameterDirection.Output;
          return comm;
    }

    TRACE:

    INFO   , SyncTest.vshost, 8, 12/08/2013 06:00:17:664,    BeginSession() called on Provider FBDbSyncProvider, SyncTest, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
    INFO   , SyncTest.vshost, 8, 12/08/2013 06:00:17:703,    BeginSession() called on Provider FBDbSyncProvider, SyncTest, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
    VERBOSE, SyncTest.vshost, 8, 12/08/2013 06:00:17:754,    Executing Command: select scope_id, scope_local_id, scope_sync_knowledge, scope_forgotten_knowledge, scope_timestamp from scope_info where scope_name = @sync_scope_name
    VERBOSE, SyncTest.vshost, 8, 12/08/2013 06:00:17:771,       Parameter: sync_scope_name Len: 5 Value: sync1
    VERBOSE, SyncTest.vshost, 8, 12/08/2013 06:00:18:160,    Executing Command: SP_GET_NEXT_DBTS
    VERBOSE, SyncTest.vshost, 8, 12/08/2013 06:00:18:165,       Parameter: sync_new_timestamp Value: Skipped since Not Input/InputOutput
    VERBOSE, SyncTest.vshost, 8, 12/08/2013 06:00:18:208,    Executing Command: select scope_id, scope_local_id, scope_sync_knowledge, scope_forgotten_knowledge, scope_timestamp from scope_info where scope_name = @sync_scope_name
    VERBOSE, SyncTest.vshost, 8, 12/08/2013 06:00:18:211,       Parameter: sync_scope_name Len: 5 Value: sync1
    VERBOSE, SyncTest.vshost, 8, 12/08/2013 06:00:18:442,       Updated Cleanup ReplicaKeyMap: [(0:31313131313131313131313131313131)] ScopeRangeSet: [00:[]]
    INFO   , SyncTest.vshost, 8, 12/08/2013 06:00:18:482, ----- Checking for Outdated Peer -----
    VERBOSE, SyncTest.vshost, 8, 12/08/2013 06:00:18:486,    Source Forgotten ReplicaKeyMap: [(0:31313131313131313131313131313131)] ScopeRangeSet: [00:[]]
    VERBOSE, SyncTest.vshost, 8, 12/08/2013 06:00:18:496,         Destination ReplicaKeyMap: [(0:31313131313131313131313131313131)] ScopeRangeSet: [00:[(0:9223372036854775807)]]
    VERBOSE, SyncTest.vshost, 8, 12/08/2013 06:00:18:502, 
    INFO   , SyncTest.vshost, 8, 12/08/2013 06:00:18:511,    Destination is not outdated
    INFO   , SyncTest.vshost, 8, 12/08/2013 06:00:18:522, --- End Checking for Outdated Peer ---
    INFO   , SyncTest.vshost, 8, 12/08/2013 06:00:18:528, 
    INFO   , SyncTest.vshost, 8, 12/08/2013 06:00:18:551, ----- Enumerating Changes for Scope "sync1" -----
    INFO   , SyncTest.vshost, 8, 12/08/2013 06:00:18:555,          Source Scope Id: 31313131313131313131313131313131
    INFO   , SyncTest.vshost, 8, 12/08/2013 06:00:18:560,     Destination Scope Id: 31313131313131313131313131313131
    INFO   , SyncTest.vshost, 8, 12/08/2013 06:00:18:563,    Change Tracking Model: Decoupled
    INFO   , SyncTest.vshost, 8, 12/08/2013 06:00:18:567, 
    INFO   , SyncTest.vshost, 8, 12/08/2013 06:00:18:570,         Source ReplicaKeyMap: [(0:31313131313131313131313131313131)] ScopeRangeSet: [00:[(0:39)]]
    INFO   , SyncTest.vshost, 8, 12/08/2013 06:00:18:574,    Destination ReplicaKeyMap: [(0:31313131313131313131313131313131)] ScopeRangeSet: [00:[(0:9223372036854775807)]]
    INFO   , SyncTest.vshost, 8, 12/08/2013 06:00:18:578, 
    VERBOSE, SyncTest.vshost, 8, 12/08/2013 06:00:18:581,   Id 0 is Scope Id 31313131313131313131313131313131
    VERBOSE, SyncTest.vshost, 8, 12/08/2013 06:00:18:584, 
    INFO   , SyncTest.vshost, 8, 12/08/2013 06:00:18:589,    ----- Table "Sync1" -----
    VERBOSE, SyncTest.vshost, 8, 12/08/2013 06:00:18:635,       Executing Command: Sync1_SP_GETCH
    VERBOSE, SyncTest.vshost, 8, 12/08/2013 06:00:18:638,          Parameter: sync_min_timestamp Value: 9223372036854775807
    VERBOSE, SyncTest.vshost, 8, 12/08/2013 06:00:18:641,          Parameter: sync_metadata_only Value: 0
    VERBOSE, SyncTest.vshost, 8, 12/08/2013 06:00:18:645,          Parameter: sync_scope_local_id Value: 3
    INFO   , SyncTest.vshost, 8, 12/08/2013 06:00:18:689,       Inserts: 0
    INFO   , SyncTest.vshost, 8, 12/08/2013 06:00:18:714,       Deletes: 0
    INFO   , SyncTest.vshost, 8, 12/08/2013 06:00:18:912,       Updates: 0
    INFO   , SyncTest.vshost, 8, 12/08/2013 06:00:18:970,       Changes Enumerated: 0
    INFO   , SyncTest.vshost, 8, 12/08/2013 06:00:19:007,    --- End Table "Sync1" ---
    INFO   , SyncTest.vshost, 8, 12/08/2013 06:00:19:259, 
    INFO   , SyncTest.vshost, 8, 12/08/2013 06:00:19:331, --- End Enumerating Changes for Scope "sync1" ---
    INFO   , SyncTest.vshost, 8, 12/08/2013 06:00:19:464, 
    INFO   , SyncTest.vshost, 8, 12/08/2013 06:00:19:553, Committing transaction
    VERBOSE, SyncTest.vshost, 8, 12/08/2013 06:00:19:594, Closing Connection
    VERBOSE, SyncTest.vshost, 8, 12/08/2013 06:00:19:740,    Executing Command: SP_GET_NEXT_DBTS
    VERBOSE, SyncTest.vshost, 8, 12/08/2013 06:00:19:743,       Parameter: sync_new_timestamp Value: Skipped since Not Input/InputOutput
    VERBOSE, SyncTest.vshost, 8, 12/08/2013 06:00:19:772,    Executing Command: 
    ERROR  , SyncTest.vshost, 8, 12/08/2013 06:00:19:910, Rolling back application transaction.
    VERBOSE, SyncTest.vshost, 8, 12/08/2013 06:00:19:977, Closing Connection
    INFO   , SyncTest.vshost, 8, 12/08/2013 06:00:19:998,    EndSession() called on Provider FBDbSyncProvider, SyncTest, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
    INFO   , SyncTest.vshost, 8, 12/08/2013 06:00:20:005,    EndSession() called on Provider FBDbSyncProvider, SyncTest, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null



    exception:

    System.InvalidOperationException 
      Message=The command text for this Command has not been set.
      Source=Microsoft.Synchronization
      StackTrace:
           в FirebirdSql.Data.FirebirdClient.FbCommand.CheckCommand()
           в FirebirdSql.Data.FirebirdClient.FbCommand.ExecuteReader(CommandBehavior behavior)
           в FirebirdSql.Data.FirebirdClient.FbCommand.ExecuteDbDataReader(CommandBehavior behavior)
           в System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader()
           в Microsoft.Synchronization.Data.DbSyncScopeHandler.ReadScope(IDbConnection connection, IDbTransaction transaction, ReadKnowledgeType readType, ReadForgottenKnowledgeType readFKtype)
           в Microsoft.Synchronization.Data.SyncScopeHandlerBase.ReadScope(IDbConnection connection, ReadKnowledgeType readType)
           в Microsoft.Synchronization.Data.RelationalSyncProvider.InitializeChangeApplicationTransaction()
           в Microsoft.Synchronization.Data.RelationalSyncProvider.SingleTransactionApplyChangesAdapter.PrepareForApplyOrRetry(DataSet ds)
           в Microsoft.Synchronization.Data.RelationalSyncProvider.ApplyChanges(DbSyncScopeMetadata scopeMetadata, DataSet dataSet, DbSyncSession dbSyncSession, Boolean commitTransaction)
           в Microsoft.Synchronization.Data.RelationalSyncProvider.ProcessChangeBatch(ConflictResolutionPolicy resolutionPolicy, ChangeBatch sourceChanges, Object changeDataRetriever, SyncCallbacks syncCallbacks, SyncSessionStatistics sessionStatistics)
           в Microsoft.Synchronization.KnowledgeProviderProxy.ProcessChangeBatch(CONFLICT_RESOLUTION_POLICY resolutionPolicy, ISyncChangeBatch pSourceChangeManager, Object pUnkDataRetriever, ISyncCallback pCallback, _SYNC_SESSION_STATISTICS& pSyncSessionStatistics)
           в Microsoft.Synchronization.CoreInterop.ISyncSession.Start(CONFLICT_RESOLUTION_POLICY resolutionPolicy, _SYNC_SESSION_STATISTICS& pSyncSessionStatistics)
           в Microsoft.Synchronization.KnowledgeSyncOrchestrator.DoOneWaySyncHelper(SyncIdFormatGroup sourceIdFormats, SyncIdFormatGroup destinationIdFormats, KnowledgeSyncProviderConfiguration destinationConfiguration, SyncCallbacks DestinationCallbacks, ISyncProvider sourceProxy, ISyncProvider destinationProxy, ChangeDataAdapter callbackChangeDataAdapter, SyncDataConverter conflictDataConverter, Int32& changesApplied, Int32& changesFailed)
           в Microsoft.Synchronization.KnowledgeSyncOrchestrator.DoOneWayKnowledgeSync(SyncDataConverter sourceConverter, SyncDataConverter destinationConverter, SyncProvider sourceProvider, SyncProvider destinationProvider, Int32& changesApplied, Int32& changesFailed)
           в Microsoft.Synchronization.KnowledgeSyncOrchestrator.Synchronize()
           в Microsoft.Synchronization.SyncOrchestrator.Synchronize()
           в SyncTest.Form1.Sync_Click_1(Object sender, EventArgs e) в C:\Users\Andrey\Desktop\SyncTest\Form1.cs:строка 64
      InnerException: 

     





    • Edited by Andrey1307 Monday, December 09, 2013 1:08 AM
    Sunday, December 08, 2013 6:27 AM

Answers

  • Сould synchronize table in two embedded firebird DB.

    Project reference: uafile.com/file/34572/SyncTest-work-7z.html

    • Marked as answer by Andrey1307 Monday, January 06, 2014 4:42 PM
    Monday, January 06, 2014 4:41 PM

All replies

  • Сould synchronize table in two embedded firebird DB.

    Project reference: uafile.com/file/34572/SyncTest-work-7z.html

    • Marked as answer by Andrey1307 Monday, January 06, 2014 4:42 PM
    Monday, January 06, 2014 4:41 PM
  • I am getting the same result here, did you end up making it work?

    My callstack was slightly different:

       at FirebirdSql.Data.FirebirdClient.FbCommand.CheckCommand() in c:\Build\Sync Services\NETProvider\source\FirebirdSql\Data\FirebirdClient\FbCommand.cs:line 1395
       at FirebirdSql.Data.FirebirdClient.FbCommand.ExecuteReader(CommandBehavior behavior) in c:\Build\Sync Services\NETProvider\source\FirebirdSql\Data\FirebirdClient\FbCommand.cs:line 550
       at FirebirdSql.Data.FirebirdClient.FbCommand.ExecuteDbDataReader(CommandBehavior behavior) in c:\Build\Sync Services\NETProvider\source\FirebirdSql\Data\FirebirdClient\FbCommand.cs:line 666
       at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader()
       at Microsoft.Synchronization.Data.DbSyncScopeHandler.ReadScope(IDbConnection connection, IDbTransaction transaction, ReadKnowledgeType readType, ReadForgottenKnowledgeType readFKtype)
       at Microsoft.Synchronization.Data.SyncScopeHandlerBase.ReadScope(IDbTransaction transaction, ReadKnowledgeType readType, ReadForgottenKnowledgeType readFKtype)
       at Microsoft.Synchronization.Data.RelationalSyncProvider.GetChanges(DbSyncScopeMetadata scopeMetadata, DbSyncSession DbSyncSession, UInt32 memoryBatchSize)
       at Microsoft.Synchronization.Data.RelationalSyncProvider.GetChangeBatch(UInt32 batchSize, SyncKnowledge destinationKnowledge, Object& changeDataRetriever)
       at Microsoft.Synchronization.KnowledgeProviderProxy.GetChangeBatch(UInt32 dwBatchSize, ISyncKnowledge pSyncKnowledge, ISyncChangeBatch& ppChangeBatch, Object& ppUnkDataRetriever)

    This is thrown while calling the orchestrator.Synchronize();

    When going into this call the command is properly initialized, it just gets cleared at some point during the synchronize.

    Any help would be greatly appreciated.

    Brian

    Thursday, March 06, 2014 5:29 AM
  • You use WCF? I met this call stack but I don't remember at what stage. Eventually I did synchronization using WCF with batching.  For my case.
    You are using my example in the source material? If Yes then it has not been tested thoroughly and have to contain different sorts of errors.


    • Edited by Andrey1307 Thursday, March 06, 2014 5:59 AM
    Thursday, March 06, 2014 5:56 AM