# Sync

### Planning

Before a brand new sync process starts, dsync creates the read plan. A read plan is simply a set of tasks that need to be executed with some additional metadata. One or more tasks per namespace. Dsync tracks the completion of individual tasks to calculate progress and to provide a point of resume in case the process gets interrupted.

Typically a read plan contains a set of tasks for initial data copy as well as the resume token for CDC.

### Initial data copy

<figure><img src="https://1578314963-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FC1ZH7dsksboQHxNwC4zF%2Fuploads%2FqekiF7IUwTHDzvyI5M8M%2FScreen%20Shot%202024-08-25%20at%209.34.34%20AM.png?alt=media&#x26;token=79734afb-5753-4ba0-b9d1-6f966a4869d2" alt=""><figcaption><p>Initial Sync</p></figcaption></figure>

During the initial data copy stage dsync bulk loads the data from the source to the destination. Depending on the source data partitioning (how many tasks per namespace) and the configured level of parallelism (how many tasks are copied in parallel), the process can be very fast.

### Change stream

<figure><img src="https://1578314963-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FC1ZH7dsksboQHxNwC4zF%2Fuploads%2FsEY5mrmXjZGBmByGDE7N%2FScreen%20Shot%202024-08-25%20at%209.37.24%20AM.png?alt=media&#x26;token=32cc8c14-8601-4d83-934c-156bf0325bee" alt=""><figcaption><p>Change Stream</p></figcaption></figure>

In order to capture data modifications made during and after the initial data copy process, a change stream mechanism is used to capture and track these modifications. Using resume tokens as a checkpoint for the last processed task allows for continuous synchronization and incremental data migration.

### Verification

<figure><img src="https://1578314963-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FC1ZH7dsksboQHxNwC4zF%2Fuploads%2FOptGJmrpyOHC9GP1bcB0%2FScreen%20Shot%202024-08-25%20at%209.38.24%20AM.png?alt=media&#x26;token=6809e0cc-7b0a-4e63-b1d9-ce29d703a2b8" alt=""><figcaption><p>Verification</p></figcaption></figure>

After the data migration, a data integrity check ensures that the data has been accurately and completely transferred.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.adiom.io/basics/how-it-works/sync.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
