Select to view content in your preferred language

AGOL replica removal

17103
23
Jump to solution
07-19-2015 09:09 PM
JustinFritz1
New Contributor II

Hi,

I am trying to update two feature services that belong to one map.  All hosted on AGOL.

I have previously never had any trouble however I now get an error right at the end that says:

"Packaging succeeded, but publishing failed. Service cannot be overwritten if Sync is enabled and Replicas exist"

This map can be taken offline in Collector.  I assume this means that someone has synced the map on their iPad and I cannot overwrite the feature services until they remove that sync.

Is it possible to see which user has the map synced so I can contact them or can I just override the lock somehow?

Neither of these feature services are editable. So overriding the lock won't orphan any data.

I have looked online and it appears you can do both if you are using a server but no mention of it if everything is hosted on AGOL.

Thanks

23 Replies
RonKnepper
Occasional Contributor II

Thanks as well, funny thing I just ran into this today and saw the replica issue but had none showing.  I ended up deleting and republishing to resolve.

0 Kudos
GregDunnigan
New Contributor III

Is there a way to unregister the replicas of a Hosted Feature Service via Python or some automated process?  Or is manually doing it the only way to do it?

thanks.

DavidCrabtree
New Contributor II

I ran into this issue this morning when sharing a service from ArcMap. I checked Collector on tablet and downloaded map was not there. I followed the steps listed from Justin Fritz's post to remove replica from AGOL. After removing replica I published the updated service with no issues.

davedoesgis
Occasional Contributor III

@RussRoberts@JustinFritz1@PaulDavidson1 - Do you know of a way to script deleting the replicas in order to overwrite the service? This is not a layer that anyone will edit with Collector. The layer I'm trying to overwrite is reference data for them to use in the field, so I'm not worried about losing any edits made in the field on an iPad if I brute force delete the replicas. Thanks. 

0 Kudos
davedoesgis
Occasional Contributor III

It wasn't too hard to figure out in the ArcGIS API for Python. Connect to the GIS and get your item by its ID. 

 

 

gis = arcgis.GIS(profile_name=profile)
item = gis.content.get('abcdefghij1234567')
flc = FeatureLayerCollection.fromitem(item)
replicas = flc.replicas.get_list()
for r in replicas:
    replica = flc.replicas.get(r['replicaID'])
    create_date = datetime.datetime.fromtimestamp(replica['creationDate'] / 1000)
    last_sync_date = 'n/a' # don't trust this to always be populated 
    if type(replica['lastSyncDate']) is int:
        last_sync_date = datetime.datetime.fromtimestamp(replica['lastSyncDate'] / 1000)
        
    print(f"{replica['replicaOwner']} created {replica['replicaName']} "
          f"(ID {replica['replicaID']}) on {create_date}, last sync "
          f"{last_sync_date}")

    if replica['replicaName'] != 'MyReplica_abcdefgh12345': 
        continue
    r1_flc.replicas.unregister(replica['replicaID'])

 

 

This code should work on layers with no replicas, since replicas will just be an empty list. In this case, I'm print out info for all replicas, looking for one with a specific ID, and deleting it. To overwrite the hosted feature layer, I will eventually want to delete all of them, but I want to coordinate that with my users first. 

Note that this will break a Collector offline area connected to this replica. In my experiment, this layer is just a reference/background polygon layer, and I was entering new data into a different point layer. I collected a point in Collector, deleted the polygon layer's replica on the server, and was still able to sync my point back to AGOL. That said, I couldn't do anything else with the offline area after that (Collector won't open it), so I had to delete the offline area and re-create it. 

 

DougBrowning
MVP Esteemed Contributor

This script works thanks.  For others who also need the top import part which was missing.

import arcpy
from arcgis.gis import GIS
from arcgis.features import FeatureLayerCollection

Now anyone know how to see jobs?  The link /jobs only works if you have a jobid for some reason.  Would love to see an admin page that just showed me all the jobs.

With the new popup rest links it is so easy to go back and have it close the popup and lose the link to the job.  Not liking the new REST page popups for sure.

thanks

BruceMiller
New Contributor III

Thanks for posting the solution!

I ran into this today after I had downloaded a service into collector, but it was abruptly stopped by an IOS update. I was able to find and unregister the Replica.

Regards

Bruce

0 Kudos
Sveinung_Bertnes_Råheim
New Contributor III

I followed the suggestion to solve this problem, but it did not work. I removed to replicas, but I still get the same error.

Here are the service-url:

http://services.arcgis.com/2JlC1JM9VNKvqb4F/ArcGIS/rest/services/Feltdagbok_AGonline/FeatureServer

ANy suggestions? I use arcmap 10.4.1 to publish. Basic version.

0 Kudos
KellyGerrow
Esri Frequent Contributor

I would recommend reaching out to technical support to look into this specific issue further.

-Kelly

0 Kudos
deleted-user-M0V5-IqusbtS
New Contributor III

I'm having the same issue - I have successfully unregistered the lingering replicas but the republish fails with the same message.  Any help is greatly appreciated.

Thanks- Eric

0 Kudos