A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.mongodb.com/docs/atlas/app-services/sync/error-handling/client-resets/ below:

Client Resets - Atlas App Services

A client reset error is a scenario where a client realm cannot sync data with the application backend. Clients in this state may continue to run and save data locally but cannot send or receive sync changesets until they perform a client reset. The Realm SDKs provide methods to automatically handle client resets under most scenarios.

Warning

By default, the client reset process attempts to recover unsynced changes that were successfully saved locally. When your client application has breaking schema changes, or if Recovery Mode is disabled on the server, the client reset process cannot recover unsynced data that may be persisted locally on the device.

Client reset scenarios occur when the server's history is incompatible with the client's history. The most common causes of client resets are:

The SDKs automatically detect the need for client resets. They can automatically perform a client reset in most cases, except in the event of a breaking schema change.

During an automatic client reset, the client:

  1. Downloads a fresh copy of the realm from the backend.

  2. Performs a diff to figure out the steps required to bring the original (local) copy of the realm to the same state as the fresh copy of the backend.

  3. Applies that set of steps to transform the local realm into a state where it can sync with the backend.

    If there are no schema changes, or only non-breaking schema changes, the SDK attempts to recover all local changes that have not yet synced to the backend. It also applies any inserts, updates, and deletes from the backend that haven't yet synced to the client.

    If you have chosen to discard unsynced changes in the SDK, or if Recovery Mode cannot recover unsynced changes, the SDK can discard local changes that have not yet synced to the backend. Then it can apply any inserts, updates, and deletes from the backend that haven't yet synced to the client. To fall back to discard local changes, choose your preferred SDK's version of the recoverOrDiscard client reset mode.

  4. Discards the fresh copy. The app continues to use the original copy of the realm with the diff applied.

In a breaking schema change, or if automatic client reset fails, the client reset falls back to a manual client reset handler that your app must define. The Realm SDKs cannot automatically perform a client reset when you make a breaking schema change.

Automatic client reset mode has several advantages compared to manual recovery:

When Client Recovery is enabled in your Device Sync configuration - as it is by default - client applications can automatically recover unsynced changes. In most scenarios, the client application can detect that a client reset error has occurred and start an automated process to handle the client reset.

After the client reset, the app can open and operate as usual.

Client Recovery can recover unsynced data in client resets except where there has been a breaking schema change. Client Recovery applies Client Reset Recovery Rules when determining how to integrate unsynced data from the device.

You can choose to fall back to Discard Unsynced Changes in the event that the client cannot recover unsynced data. In this case, local data is discarded, but the client can automatically perform the client reset. To fall back to discard local changes, choose your preferred SDK's version of the recoverOrDiscard client reset mode.

In a client reset that does not involve a breaking schema change, the Realm SDKs attempt to recover unsynced changes. The SDK integrates objects created locally that did not sync before the client reset. These rules determine how conflicts are resolved when both the backend and the client make changes to the same object:

Warning Deletes Unsynced Local Changes Permanently

This client reset mode permanently deletes any changes made locally that have not yet synchronized to the backend. Do not use this client reset mode if your application needs to preserve unsynced changes.

The discard unsynced changes client reset mode automatically handles client resets without attempting to recover data from the client device. You might choose this mode if the Client Reset Recovery Rules do not work for your app, or if you don't need to save unsynced data. When this mode uses a diff to bring the local realm to the same state as the backend, unsynced changes are permanently deleted.

Discard Unsynced Changes mode cannot perform an automated client reset in the event of a breaking schema change.

In the event of a breaking schema change, Realm SDKs cannot automatically handle a client reset. You must define a manual client reset handler if you make breaking schema changes.

In this scenario, a manual client reset handler should do something like tell the user to update the app. In Realm SDK versions that automatically handle client resets, a manual client reset only occurs in error scenarios where no meaningful recovery can occur.

For more information on performing a client reset, check out the client reset examples for your SDK:

Recovery Mode is enabled by default in every Device Sync configuration. You can disable Recovery Mode, or re-enable it if you have previously disabled it.

  1. Select the Device Sync menu in the sidebar.

  2. Click the Advanced Configuration pane to display additional configuration options.

  3. Click the Enable Client Recovery toggle.

  4. Press the Save button to confirm your changes.

    If your app uses deployment drafts, you must deploy your application after making changes.

  1. Pull a local copy of the latest version of your app with the following pull command:

    appservices pull --remote="<Your App ID>"
  2. You can configure the number of days for your application's client maximum offline time with the is_recovery_mode_disabled property in your app's sync/config.json file:

    {  ...  "is_recovery_mode_disabled": false,  ...}
  3. Deploy the updated app configuration with the following push command:

    appservices push --remote="<Your App ID>"

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4