Synchronization for offline edition is not working for ArcGIS Runtime application

501
4
01-17-2019 07:16 AM
EwaWalewska
New Contributor II

We created a desktop application with the usage of ArcGIS Runtime for .NET 100.2.1.0.

We are testing application on development environment and a separate on test environment. 

To make offline edition available in runtime desktop application we set all necessary requirements:

 

  • Global Id available
  • Sync option available when publishing
  • Versioning available for the feature class that offline edition is referring to.

 

I also select option to create version for each offline map when publishing:

 

The problem is that synchronization for the offline edition is working on a development environment but it’s not working on the test environment.

 

For the test environment, only first download of gdb file for the offline edition is working but synchronizing changes is not working (delta changes).

 

I notice one difference in when I’m listing version in ArcMap:

 

  1. For a development environment version looks like this:

 

You can see replicas are created correctly for every version on downloaded gdb. 

2. For the test environment it’s like this:

 

 

Replicas are created from dbo.DEFAULT version(only one example of creating a separate version), which in my opinion is not correct.

Synchronization for this environment is not working.

 

I don't know if this is related to the lack of synchronization, but it's the only difference I found between those two environments.

How to change creating a version from every downloaded map in a different way than from published service properties?

Why it's working differently (with the same settings)?

Or maybe synchronization is not working for another reason?

Please help!

Tags (2)
0 Kudos
4 Replies
JoeHershman
MVP Regular Contributor

Is it possible that in the Test environment when the replicas were generated it was defined as download only and not bidirectional?  When a download only replica is created it will not create a version, but is associated to default (or whatever version the source service is generated from).  This is certainly what you would see in this case, and also trying to do a bidirectional sync would fail.

A word of warning:  Versioned synchronization does not scale so if you plan to deploy to a large user base I would consider finding a workflow that allows you to use an archive enabled database instead of versioned.

0 Kudos
AnttiKajanus3
New Contributor III

Could you describe what you mean with the sync is not working? Do you get errors from the sync call on the Runtime side? Do you get errors returned as part of the sync objects? Or is it that the sync goes through but you cannot see the edits after that? 

0 Kudos
EwaWalewska
New Contributor II

On Runtime side I'm getting an empty error. Logs on ArcGIS Server look like this:

Error executing tool. SyncFeatureServiceReplica Job ID: jfd86296bb12148ce81ddd73f663e3e12 : ErrorMsg@SyncGPService:{"code":400,"description":""} Failed to execute (Sync Feature Service Replica).

And code for synchronization is look like this:

public async Task SyncGeodatabase()
{

var taskParameters = new SyncGeodatabaseParameters()
{
RollbackOnFailure = false,
GeodatabaseSyncDirection = SyncDirection.Bidirectional
};

System.Net.ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };

var syncTask = await GeodatabaseSyncTask.CreateAsync(new Uri(configurationRepository.GetFeatureServiceUrl()));

var gdb = await Geodatabase.OpenAsync(this.geodatabasePath.Get());


foreach (GeodatabaseFeatureTable table in gdb.GeodatabaseFeatureTables)
{
long tableId = table.ServiceLayerId;
SyncLayerOption option = new SyncLayerOption(tableId);
option.SyncDirection = SyncDirection.Bidirectional;
taskParameters.LayerOptions.Add(option);
}

SyncGeodatabaseJob job = syncTask.SyncGeodatabase(taskParameters, gdb);

job.JobChanged += (s, e) =>
{

if (job.Status == JobStatus.Succeeded)
{

this.log.Debug(this.logHeader, "Synchronization is complete!");
}
else if (job.Status == JobStatus.Failed)
{

this.log.Debug(this.logHeader, job.Error.Message);
}
else
{
this.log.Debug(this.logHeader, "Sync in progress ...");
}
};


var result = await job.GetResultAsync();
}

0 Kudos
JoeHershman
MVP Regular Contributor

As I said in my previous post, to me it looks like something weird happened when the replicas were generated and they are not bidirectional replicas.  I would try and sync just the one pointing to the child version.  However, it is possible that even that one is 'broken.'  There are issues with versioned sync and once a replica fails it will never work again.

I warn you again....This approach of using a non-federated server with versioned synchronization will fail down the line.  The sync versions start to collide and syncs start to fail, and once a replica has failed it needs to be replaced because it will never sync again.  Even esri will tell you this approach is bound to fail, because there are just too many versions all trying to post to default at the same time.  Please heed my warnings before it is too late

0 Kudos