From 47a43c4a3f8b41e7fc9f42fd908f1f662be63043 Mon Sep 17 00:00:00 2001 From: rasika-chivate <95711051+rasika-chivate@users.noreply.github.com> Date: Tue, 1 Sep 2026 15:02:05 +0530 Subject: [PATCH 01/39] PCSM-283 Skip sharding operations for replica set --- mkdocs-base.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/mkdocs-base.yml b/mkdocs-base.yml index bb68e601..f29d0687 100644 --- a/mkdocs-base.yml +++ b/mkdocs-base.yml @@ -166,6 +166,7 @@ nav: - compare.md - deployment.md - sharding.md + - sharded-source-to-replica-set-target.md - limitations.md - Get started: - Quickstart: installation.md From 542e25e56034c9a893e0b06030f6960217337741 Mon Sep 17 00:00:00 2001 From: rasika-chivate <95711051+rasika-chivate@users.noreply.github.com> Date: Tue, 1 Sep 2026 18:39:58 +0530 Subject: [PATCH 02/39] Create sharded-source-to-replica-set-target.md --- docs/sharded-source-to-replica-set-target.md | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 docs/sharded-source-to-replica-set-target.md diff --git a/docs/sharded-source-to-replica-set-target.md b/docs/sharded-source-to-replica-set-target.md new file mode 100644 index 00000000..85f7a367 --- /dev/null +++ b/docs/sharded-source-to-replica-set-target.md @@ -0,0 +1,11 @@ +# Replicate from a sharded cluster to a replica set + +Percona ClusterSync for MongoDB (PCSM) supports replication from a sharded MongoDB cluster to a replica set. This lets you migrate data from a sharded deployment without having to recreate the source sharding configuration on the target. + +!!! info "Important" + Sharding support in PCSM is a technical preview. We recommend that early adopters use this release for testing purposes only and not in production environments. + +For example, you can use this topology when moving data from a sharded MongoDB Atlas or MongoDB Enterprise deployment to a Percona Server for MongoDB replica set. + +For information about sharded cluster support, see [Sharding support in Percona ClusterSync for MongoDB](sharding.md). + From b789c70d883172a195af89bd155875103597e996 Mon Sep 17 00:00:00 2001 From: rasika-chivate <95711051+rasika-chivate@users.noreply.github.com> Date: Tue, 1 Sep 2026 19:35:26 +0530 Subject: [PATCH 03/39] Update sharded-source-to-replica-set-target.md --- docs/sharded-source-to-replica-set-target.md | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/docs/sharded-source-to-replica-set-target.md b/docs/sharded-source-to-replica-set-target.md index 85f7a367..1f7e73a6 100644 --- a/docs/sharded-source-to-replica-set-target.md +++ b/docs/sharded-source-to-replica-set-target.md @@ -2,10 +2,21 @@ Percona ClusterSync for MongoDB (PCSM) supports replication from a sharded MongoDB cluster to a replica set. This lets you migrate data from a sharded deployment without having to recreate the source sharding configuration on the target. -!!! info "Important" - Sharding support in PCSM is a technical preview. We recommend that early adopters use this release for testing purposes only and not in production environments. - For example, you can use this topology when moving data from a sharded MongoDB Atlas or MongoDB Enterprise deployment to a Percona Server for MongoDB replica set. For information about sharded cluster support, see [Sharding support in Percona ClusterSync for MongoDB](sharding.md). +## How PCSM handles the topology difference + +When replication starts, PCSM detects that the source is sharded and the target is a replica set. + +If a source collection is sharded, PCSM skips sharding operations such as shardCollection on the target. These operations apply only to sharded clusters. + +PCSM then continues with the standard clone and replication workflow. No additional configuration is required. + +!!! note + !!! note + A collection that is sharded on the source is created as a regular collection on the replica set target. The collection data is copied, but the target collection isn't sharded. + + + From b43c0bcb232f2513f9c31f1cc8f50884a8e81ab7 Mon Sep 17 00:00:00 2001 From: rasika-chivate <95711051+rasika-chivate@users.noreply.github.com> Date: Tue, 1 Sep 2026 19:40:05 +0530 Subject: [PATCH 04/39] Update sharded-source-to-replica-set-target.md --- docs/sharded-source-to-replica-set-target.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/docs/sharded-source-to-replica-set-target.md b/docs/sharded-source-to-replica-set-target.md index 1f7e73a6..ebee7732 100644 --- a/docs/sharded-source-to-replica-set-target.md +++ b/docs/sharded-source-to-replica-set-target.md @@ -10,7 +10,7 @@ For information about sharded cluster support, see [Sharding support in Percona When replication starts, PCSM detects that the source is sharded and the target is a replica set. -If a source collection is sharded, PCSM skips sharding operations such as shardCollection on the target. These operations apply only to sharded clusters. +If a source collection is sharded, PCSM skips sharding operations such as `shardCollection` on the target. These operations apply only to sharded clusters. PCSM then continues with the standard clone and replication workflow. No additional configuration is required. @@ -18,5 +18,13 @@ PCSM then continues with the standard clone and replication workflow. No additio !!! note A collection that is sharded on the source is created as a regular collection on the replica set target. The collection data is copied, but the target collection isn't sharded. +## What carries over + +| **On the source** | **On the replica set target** | +|---|---| +| Sharded collection | Created as a regular collection. All documents are copied. The shard key isn't applied because it doesn't apply to a replica set. | +| Unsharded collection | Created and copied as in a replica set to replica set sync. | +| Chunk distribution and primary shard | Not preserved. PCSM replicates data, not cluster metadata. | + From ed44f223d74e6cdfa1998f2ab72d2bfd86bde7ed Mon Sep 17 00:00:00 2001 From: rasika-chivate <95711051+rasika-chivate@users.noreply.github.com> Date: Tue, 1 Sep 2026 22:09:29 +0530 Subject: [PATCH 05/39] Update sharded-source-to-replica-set-target.md --- docs/sharded-source-to-replica-set-target.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sharded-source-to-replica-set-target.md b/docs/sharded-source-to-replica-set-target.md index ebee7732..f74df33d 100644 --- a/docs/sharded-source-to-replica-set-target.md +++ b/docs/sharded-source-to-replica-set-target.md @@ -18,7 +18,7 @@ PCSM then continues with the standard clone and replication workflow. No additio !!! note A collection that is sharded on the source is created as a regular collection on the replica set target. The collection data is copied, but the target collection isn't sharded. -## What carries over +## What is replicated | **On the source** | **On the replica set target** | |---|---| From 8cadb8512b55e4aadaa1efe83ecf8ef95486229f Mon Sep 17 00:00:00 2001 From: rasika-chivate <95711051+rasika-chivate@users.noreply.github.com> Date: Wed, 2 Sep 2026 17:41:56 +0530 Subject: [PATCH 06/39] Update sharded-source-to-replica-set-target.md --- docs/sharded-source-to-replica-set-target.md | 21 ++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/docs/sharded-source-to-replica-set-target.md b/docs/sharded-source-to-replica-set-target.md index f74df33d..6506dffa 100644 --- a/docs/sharded-source-to-replica-set-target.md +++ b/docs/sharded-source-to-replica-set-target.md @@ -26,5 +26,26 @@ PCSM then continues with the standard clone and replication workflow. No additio | Unsharded collection | Created and copied as in a replica set to replica set sync. | | Chunk distribution and primary shard | Not preserved. PCSM replicates data, not cluster metadata. | +## Before you start + +- Ensure the source and target MongoDB versions meet the [version requirements](.). +- Configure authentication for both deployments. Refer to [Configure authentication in MongoDB](#). +- Verify that PCSM can connect to the source sharded cluster and the target replica set. +- Review the known issues and limitations before proceeding. + + + + + + + + + + + + + + + From 7a02a06debfcc37864d335e1a64643053cba7e04 Mon Sep 17 00:00:00 2001 From: rasika-chivate <95711051+rasika-chivate@users.noreply.github.com> Date: Thu, 3 Sep 2026 11:56:52 +0530 Subject: [PATCH 07/39] Update sharded-source-to-replica-set-target.md --- docs/sharded-source-to-replica-set-target.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/sharded-source-to-replica-set-target.md b/docs/sharded-source-to-replica-set-target.md index 6506dffa..80abd138 100644 --- a/docs/sharded-source-to-replica-set-target.md +++ b/docs/sharded-source-to-replica-set-target.md @@ -28,10 +28,9 @@ PCSM then continues with the standard clone and replication workflow. No additio ## Before you start -- Ensure the source and target MongoDB versions meet the [version requirements](.). -- Configure authentication for both deployments. Refer to [Configure authentication in MongoDB](#). +- Ensure the source and target MongoDB versions meet the [version requirements](version-compatibility.md#version-compatibility-matrix). +- Configure authentication for both deployments. Refer to [Configure authentication in MongoDB](./install/authentication.md). - Verify that PCSM can connect to the source sharded cluster and the target replica set. -- Review the known issues and limitations before proceeding. From bccb242a889755e0774aba78c54436ea462eef5a Mon Sep 17 00:00:00 2001 From: rasika-chivate <95711051+rasika-chivate@users.noreply.github.com> Date: Thu, 3 Sep 2026 12:39:10 +0530 Subject: [PATCH 08/39] examples before and after cross topology support --- docs/sharded-source-to-replica-set-target.md | 166 +++++++++++++++++++ 1 file changed, 166 insertions(+) diff --git a/docs/sharded-source-to-replica-set-target.md b/docs/sharded-source-to-replica-set-target.md index 80abd138..a992fac7 100644 --- a/docs/sharded-source-to-replica-set-target.md +++ b/docs/sharded-source-to-replica-set-target.md @@ -32,6 +32,172 @@ PCSM then continues with the standard clone and replication workflow. No additio - Configure authentication for both deployments. Refer to [Configure authentication in MongoDB](./install/authentication.md). - Verify that PCSM can connect to the source sharded cluster and the target replica set. +## Replication before and after cross-topology support + +=== "Before cross-topology support" + + ??? example "Example" + + Follow these steps: + {.power-number} + + 1. Create two clusters, one sharded (source) and the other replicaset (destination). + + 2. Set up PCSM. + + ```text + pcsm version + Version: v0.9.0 + Platform: linux + GitCommit: 33567da + GitBranch: HEAD + BuildTime: 2026-08-25_07:48_UTC + ``` + 3. Create two collections on the sharded cluster: + + 1. Sharded_collection (sharded) + 2. Plain_collection (non-sharded) + + 4. Add documents to both the collections. + + 5. Start replication: + + ```sh + pcsm start + ``` + 6. Check the replication status: + + ```json + pcsm status + { + "ok": false, + "error": "clone: copy: clone_shard_test_db.sharded_coll: shard collection: (CommandNotFound) no such command: 'shardCollection'", + "state": "failed", + "info": "Failed", + "lagTimeSeconds": 0, + "eventsRead": 0, + "eventsApplied": 0, + "initialSync": { + "estimatedCloneSizeBytes": 7490, + "clonedSizeBytes": 1490, + "completed": false, + "cloneCompleted": true + } + } + Error: clone: copy: clone_shard_test_db.sharded_coll: shard collection: (CommandNotFound) no such command: 'shardCollection' + 2026-08-25T07:51:17.586Z FTL error="clone: copy: clone_shard_test_db.sharded_coll: shard collection: (CommandNotFound) no such command: 'shardCollection'" + ``` + + 7. Check the logs: + + `pcsm start 2> pcsm.log` + + Output: + + ```json + 2026-08-25T07:56:21.508Z ERR Data Clone has failed: 0 B in 0s error="copy: clone_shard_test_db.sharded_coll: shard collection: shard collection: (CommandNotFound) no such command: 'shardCollection'" elapsed_secs=0.114 s=clone + 2026-08-25T07:56:21.508Z ERR Cluster Replication has failed error="clone: copy: clone_shard_test_db.sharded_coll: shard collection: shard collection: (CommandNotFound) no such command: 'shardCollection'" s=pcsm + ``` + + 8. Confirm that the documents for both `plain_collection` and `sharded_collection` did not copy to the destination cluster. + + Replication fails when PCSM attempts to run `shardCollection` against the replica set target. Before cross-topology support, PCSM attempted to run `shardCollection` on the replica set target when the source collection had a shard key. Because `shardCollection` is only valid on a sharded cluster, the migration failed. + + +=== "After cross-topology support" + + ??? example "Example" + + Follow these steps: + {.power-number} + + 1. Create two clusters, one sharded (source) and the other replicaset (destination). + + 2. Set up PCSM. + + ```text + pcsm version + Version: v0.9.0 + Platform: linux + GitCommit: f12f81 + GitBranch: main + BuildTime: 2026-08-25_08:14_UTC + GoVersion: go1.27.0 + ``` + 3. Create two collections on the sharded cluster: + + 1. Sharded_collection (sharded) + 2. Plain_collection (non-sharded) + + 4. Add documents to both the collections. + + 5. Start replication: + + ```sh + pcsm start + ``` + 6. Check the replication status: + + ```json + pcsm status + { + "ok": true, + "state": "running", + "info": "Replicating Changes", + "lagTimeSeconds": 0, + "eventsRead": 0, + "eventsApplied": 0, + "lastReplicatedOpTime": { + "ts": "1787645813.1", + "isoDate": "2026-08-25T08:16:53Z" + }, + "initialSync": { + "estimatedCloneSizeBytes": 7490, + "clonedSizeBytes": 7490, + "completed": true, + "cloneCompleted": true + } + } + ``` + 7. Check if if it has successfully finalized + + ```json + pcsm status  + {  +   "ok": true,  +   "state": "finalized",  +   "info": "Finalized",  +   "lagTimeSeconds": 1,  +   "eventsRead": 0,  +   "eventsApplied": 0,  +   "lastReplicatedOpTime": {  +     "ts": "1787645817.1",  +     "isoDate": "2026-08-25T08:16:57Z"  +   },  +   "initialSync": {  +     "estimatedCloneSizeBytes": 7490,  +     "clonedSizeBytes": 7490,  +     "completed": true,  +     "cloneCompleted": true  +   },  +   "finalization": {  +     "completed": true,  +     "startedAt": "2026-08-25T08:16:57.539447026Z",  +     "completedAt": "2026-08-25T08:16:57.539557888Z"  +   }  + }  + ``` + + 8. Check the logs: + + `pcsm start 2> pcsm.log` + + 8. Confirm that the documents for both `plain_collection` and `sharded_collection` did not copy to the destination cluster. + + Replication is successful when PCSM runs `shardCollection` against the replica set target. + + + From 675429fd257154ba3909b1e833d4345506f01bdc Mon Sep 17 00:00:00 2001 From: rasika-chivate <95711051+rasika-chivate@users.noreply.github.com> Date: Thu, 3 Sep 2026 12:56:06 +0530 Subject: [PATCH 09/39] Update sharded-source-to-replica-set-target.md --- docs/sharded-source-to-replica-set-target.md | 55 ++++++-------------- 1 file changed, 16 insertions(+), 39 deletions(-) diff --git a/docs/sharded-source-to-replica-set-target.md b/docs/sharded-source-to-replica-set-target.md index a992fac7..d13da7be 100644 --- a/docs/sharded-source-to-replica-set-target.md +++ b/docs/sharded-source-to-replica-set-target.md @@ -36,6 +36,8 @@ PCSM then continues with the standard clone and replication workflow. No additio === "Before cross-topology support" + Without cross-topology handling, PCSM attempts to apply the source collection's sharding configuration to the replica set. The clone fails because the target doesn't support `shardCollection`. + ??? example "Example" Follow these steps: @@ -43,29 +45,19 @@ PCSM then continues with the standard clone and replication workflow. No additio 1. Create two clusters, one sharded (source) and the other replicaset (destination). - 2. Set up PCSM. - - ```text - pcsm version - Version: v0.9.0 - Platform: linux - GitCommit: 33567da - GitBranch: HEAD - BuildTime: 2026-08-25_07:48_UTC - ``` - 3. Create two collections on the sharded cluster: + 2. Create two collections on the sharded cluster: 1. Sharded_collection (sharded) 2. Plain_collection (non-sharded) - 4. Add documents to both the collections. + 3. Add documents to both the collections. - 5. Start replication: + 4. Start replication: ```sh pcsm start ``` - 6. Check the replication status: + 5. Check the replication status: ```json pcsm status @@ -88,7 +80,7 @@ PCSM then continues with the standard clone and replication workflow. No additio 2026-08-25T07:51:17.586Z FTL error="clone: copy: clone_shard_test_db.sharded_coll: shard collection: (CommandNotFound) no such command: 'shardCollection'" ``` - 7. Check the logs: + 6. Check the logs: `pcsm start 2> pcsm.log` @@ -99,13 +91,12 @@ PCSM then continues with the standard clone and replication workflow. No additio 2026-08-25T07:56:21.508Z ERR Cluster Replication has failed error="clone: copy: clone_shard_test_db.sharded_coll: shard collection: shard collection: (CommandNotFound) no such command: 'shardCollection'" s=pcsm ``` - 8. Confirm that the documents for both `plain_collection` and `sharded_collection` did not copy to the destination cluster. - - Replication fails when PCSM attempts to run `shardCollection` against the replica set target. Before cross-topology support, PCSM attempted to run `shardCollection` on the replica set target when the source collection had a shard key. Because `shardCollection` is only valid on a sharded cluster, the migration failed. - + 7. Confirm that neither collection reached the target. The clone stops at the first failure, so even the unsharded collection is missing. === "After cross-topology support" + With cross-topology support, PCSM detects the replica set target and skips the unsupported sharding operations. + ??? example "Example" Follow these steps: @@ -113,30 +104,19 @@ PCSM then continues with the standard clone and replication workflow. No additio 1. Create two clusters, one sharded (source) and the other replicaset (destination). - 2. Set up PCSM. - - ```text - pcsm version - Version: v0.9.0 - Platform: linux - GitCommit: f12f81 - GitBranch: main - BuildTime: 2026-08-25_08:14_UTC - GoVersion: go1.27.0 - ``` - 3. Create two collections on the sharded cluster: + 2. Create two collections on the sharded cluster: 1. Sharded_collection (sharded) 2. Plain_collection (non-sharded) - 4. Add documents to both the collections. + 3. Add documents to both the collections. - 5. Start replication: + 4. Start replication: ```sh pcsm start ``` - 6. Check the replication status: + 5. Check the replication status: ```json pcsm status @@ -159,7 +139,7 @@ PCSM then continues with the standard clone and replication workflow. No additio } } ``` - 7. Check if if it has successfully finalized + 6. Check if it has successfully finalized: ```json pcsm status  @@ -188,15 +168,12 @@ PCSM then continues with the standard clone and replication workflow. No additio }  ``` - 8. Check the logs: + 7. Check the logs: `pcsm start 2> pcsm.log` 8. Confirm that the documents for both `plain_collection` and `sharded_collection` did not copy to the destination cluster. - Replication is successful when PCSM runs `shardCollection` against the replica set target. - - From ba79a338aa583bdaf6b3d624d02154c915b24d91 Mon Sep 17 00:00:00 2001 From: rasika-chivate <95711051+rasika-chivate@users.noreply.github.com> Date: Thu, 3 Sep 2026 13:00:43 +0530 Subject: [PATCH 10/39] Update sharded-source-to-replica-set-target.md --- docs/sharded-source-to-replica-set-target.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/docs/sharded-source-to-replica-set-target.md b/docs/sharded-source-to-replica-set-target.md index d13da7be..008c34fa 100644 --- a/docs/sharded-source-to-replica-set-target.md +++ b/docs/sharded-source-to-replica-set-target.md @@ -15,8 +15,7 @@ If a source collection is sharded, PCSM skips sharding operations such as `shard PCSM then continues with the standard clone and replication workflow. No additional configuration is required. !!! note - !!! note - A collection that is sharded on the source is created as a regular collection on the replica set target. The collection data is copied, but the target collection isn't sharded. + A collection that is sharded on the source is created as a regular collection on the replica set target. The collection data is copied, but the target collection isn't sharded. ## What is replicated @@ -88,8 +87,8 @@ PCSM then continues with the standard clone and replication workflow. No additio ```json 2026-08-25T07:56:21.508Z ERR Data Clone has failed: 0 B in 0s error="copy: clone_shard_test_db.sharded_coll: shard collection: shard collection: (CommandNotFound) no such command: 'shardCollection'" elapsed_secs=0.114 s=clone - 2026-08-25T07:56:21.508Z ERR Cluster Replication has failed error="clone: copy: clone_shard_test_db.sharded_coll: shard collection: shard collection: (CommandNotFound) no such command: 'shardCollection'" s=pcsm - ``` + 2026-08-25T07:56:21.508Z ERR Cluster Replication has failed error="clone: copy: clone_shard_test_db.sharded_coll: shard collection: shard collection: (CommandNotFound) no such command: 'shardCollection'" s=pcsm + ``` 7. Confirm that neither collection reached the target. The clone stops at the first failure, so even the unsharded collection is missing. From 9a972b721135821a3a6512418867a13b443da1c2 Mon Sep 17 00:00:00 2001 From: rasika-chivate <95711051+rasika-chivate@users.noreply.github.com> Date: Thu, 3 Sep 2026 13:10:36 +0530 Subject: [PATCH 11/39] Update sharded-source-to-replica-set-target.md --- docs/sharded-source-to-replica-set-target.md | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/docs/sharded-source-to-replica-set-target.md b/docs/sharded-source-to-replica-set-target.md index 008c34fa..99d08171 100644 --- a/docs/sharded-source-to-replica-set-target.md +++ b/docs/sharded-source-to-replica-set-target.md @@ -115,7 +115,7 @@ PCSM then continues with the standard clone and replication workflow. No additio ```sh pcsm start ``` - 5. Check the replication status: + 5. Check the replication status. `clonedSizeBytes` matches `estimatedCloneSizeBytes`, and the state is `running`: ```json pcsm status @@ -138,7 +138,17 @@ PCSM then continues with the standard clone and replication workflow. No additio } } ``` - 6. Check if it has successfully finalized: + + 6. Confirm that both collections are present on the target and that document counts match: + + ```javascript + db..countDocuments() + ``` + + The collection that was sharded on the source appears here as a regular collection. That is expected. + + + 7. Finalize the sync and check the status again: ```json pcsm status  @@ -167,7 +177,7 @@ PCSM then continues with the standard clone and replication workflow. No additio }  ``` - 7. Check the logs: + 7. Check the logs and confirm that no errors were recorded. `pcsm start 2> pcsm.log` From 15dd91376be1e66f61b3f38f387364a5c88242e3 Mon Sep 17 00:00:00 2001 From: rasika-chivate <95711051+rasika-chivate@users.noreply.github.com> Date: Thu, 3 Sep 2026 13:19:25 +0530 Subject: [PATCH 12/39] Update sharded-source-to-replica-set-target.md --- docs/sharded-source-to-replica-set-target.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/sharded-source-to-replica-set-target.md b/docs/sharded-source-to-replica-set-target.md index 99d08171..5af10f67 100644 --- a/docs/sharded-source-to-replica-set-target.md +++ b/docs/sharded-source-to-replica-set-target.md @@ -141,11 +141,11 @@ PCSM then continues with the standard clone and replication workflow. No additio 6. Confirm that both collections are present on the target and that document counts match: - ```javascript - db..countDocuments() - ``` + ```javascript + db..countDocuments() + ``` - The collection that was sharded on the source appears here as a regular collection. That is expected. + The collection that was sharded on the source appears here as a regular collection. That is expected. 7. Finalize the sync and check the status again: @@ -177,11 +177,11 @@ PCSM then continues with the standard clone and replication workflow. No additio }  ``` - 7. Check the logs and confirm that no errors were recorded. + 8. Check the logs and confirm that no errors were recorded. `pcsm start 2> pcsm.log` - 8. Confirm that the documents for both `plain_collection` and `sharded_collection` did not copy to the destination cluster. + 9. Confirm that the documents for both `plain_collection` and `sharded_collection` did not copy to the destination cluster. From 9266ff8b0465b1ce2c51d8f2aa5284a15591963f Mon Sep 17 00:00:00 2001 From: Rasika Chivate <95711051+rasika-chivate@users.noreply.github.com> Date: Thu, 3 Sep 2026 13:23:42 +0530 Subject: [PATCH 13/39] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- docs/sharded-source-to-replica-set-target.md | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/docs/sharded-source-to-replica-set-target.md b/docs/sharded-source-to-replica-set-target.md index 5af10f67..96277fef 100644 --- a/docs/sharded-source-to-replica-set-target.md +++ b/docs/sharded-source-to-replica-set-target.md @@ -148,10 +148,19 @@ PCSM then continues with the standard clone and replication workflow. No additio The collection that was sharded on the source appears here as a regular collection. That is expected. - 7. Finalize the sync and check the status again: + 7. Finalize the sync: - ```json - pcsm status  + ```{.bash data-prompt="$"} + $ pcsm finalize + ``` + + 8. Check the status again: + + ```{.bash data-prompt="$"} + $ pcsm status + ``` + + ```{.json .no-copy} {    "ok": true,    "state": "finalized",  From e84e92c7c596862220bfdf6fd4f0ac361ff8220b Mon Sep 17 00:00:00 2001 From: Rasika Chivate <95711051+rasika-chivate@users.noreply.github.com> Date: Thu, 3 Sep 2026 13:24:20 +0530 Subject: [PATCH 14/39] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- docs/sharded-source-to-replica-set-target.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sharded-source-to-replica-set-target.md b/docs/sharded-source-to-replica-set-target.md index 96277fef..14c90881 100644 --- a/docs/sharded-source-to-replica-set-target.md +++ b/docs/sharded-source-to-replica-set-target.md @@ -42,7 +42,7 @@ PCSM then continues with the standard clone and replication workflow. No additio Follow these steps: {.power-number} - 1. Create two clusters, one sharded (source) and the other replicaset (destination). + 1. Create two clusters, one sharded (source) and the other replica set (destination). 2. Create two collections on the sharded cluster: From 003e8e228b9c343c966d5d7f2e9d307d1eb8f6c1 Mon Sep 17 00:00:00 2001 From: Rasika Chivate <95711051+rasika-chivate@users.noreply.github.com> Date: Thu, 3 Sep 2026 13:24:30 +0530 Subject: [PATCH 15/39] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- docs/sharded-source-to-replica-set-target.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sharded-source-to-replica-set-target.md b/docs/sharded-source-to-replica-set-target.md index 14c90881..73647a4b 100644 --- a/docs/sharded-source-to-replica-set-target.md +++ b/docs/sharded-source-to-replica-set-target.md @@ -58,7 +58,7 @@ PCSM then continues with the standard clone and replication workflow. No additio ``` 5. Check the replication status: - ```json + ```{.text .no-copy} pcsm status { "ok": false, From f67df557a1aa30bd887066e32919fbddbda801b3 Mon Sep 17 00:00:00 2001 From: Rasika Chivate <95711051+rasika-chivate@users.noreply.github.com> Date: Thu, 3 Sep 2026 13:25:02 +0530 Subject: [PATCH 16/39] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- docs/sharded-source-to-replica-set-target.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/sharded-source-to-replica-set-target.md b/docs/sharded-source-to-replica-set-target.md index 73647a4b..0d46801c 100644 --- a/docs/sharded-source-to-replica-set-target.md +++ b/docs/sharded-source-to-replica-set-target.md @@ -46,8 +46,8 @@ PCSM then continues with the standard clone and replication workflow. No additio 2. Create two collections on the sharded cluster: - 1. Sharded_collection (sharded) - 2. Plain_collection (non-sharded) + 1. `sharded_coll` (sharded) + 2. `plain_collection` (unsharded) 3. Add documents to both the collections. From 5a290f03d46365414393af19ddfee2994ca43125 Mon Sep 17 00:00:00 2001 From: rasika-chivate <95711051+rasika-chivate@users.noreply.github.com> Date: Thu, 3 Sep 2026 13:28:45 +0530 Subject: [PATCH 17/39] Update sharded-source-to-replica-set-target.md --- docs/sharded-source-to-replica-set-target.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sharded-source-to-replica-set-target.md b/docs/sharded-source-to-replica-set-target.md index 73647a4b..7d7417c1 100644 --- a/docs/sharded-source-to-replica-set-target.md +++ b/docs/sharded-source-to-replica-set-target.md @@ -190,7 +190,7 @@ PCSM then continues with the standard clone and replication workflow. No additio `pcsm start 2> pcsm.log` - 9. Confirm that the documents for both `plain_collection` and `sharded_collection` did not copy to the destination cluster. + 9. Confirm that the documents for both `plain_collection` and `sharded_collection` got copied to the destination cluster. From 090cd53034344d6923e35db136fab40a9a49c360 Mon Sep 17 00:00:00 2001 From: Rasika Chivate <95711051+rasika-chivate@users.noreply.github.com> Date: Thu, 3 Sep 2026 13:32:08 +0530 Subject: [PATCH 18/39] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- docs/sharded-source-to-replica-set-target.md | 46 ++++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/docs/sharded-source-to-replica-set-target.md b/docs/sharded-source-to-replica-set-target.md index a52724a8..e98b22f3 100644 --- a/docs/sharded-source-to-replica-set-target.md +++ b/docs/sharded-source-to-replica-set-target.md @@ -161,29 +161,29 @@ PCSM then continues with the standard clone and replication workflow. No additio ``` ```{.json .no-copy} - {  -   "ok": true,  -   "state": "finalized",  -   "info": "Finalized",  -   "lagTimeSeconds": 1,  -   "eventsRead": 0,  -   "eventsApplied": 0,  -   "lastReplicatedOpTime": {  -     "ts": "1787645817.1",  -     "isoDate": "2026-08-25T08:16:57Z"  -   },  -   "initialSync": {  -     "estimatedCloneSizeBytes": 7490,  -     "clonedSizeBytes": 7490,  -     "completed": true,  -     "cloneCompleted": true  -   },  -   "finalization": {  -     "completed": true,  -     "startedAt": "2026-08-25T08:16:57.539447026Z",  -     "completedAt": "2026-08-25T08:16:57.539557888Z"  -   }  - }  + { + "ok": true, + "state": "finalized", + "info": "Finalized", + "lagTimeSeconds": 1, + "eventsRead": 0, + "eventsApplied": 0, + "lastReplicatedOpTime": { + "ts": "1787645817.1", + "isoDate": "2026-08-25T08:16:57Z" + }, + "initialSync": { + "estimatedCloneSizeBytes": 7490, + "clonedSizeBytes": 7490, + "completed": true, + "cloneCompleted": true + }, + "finalization": { + "completed": true, + "startedAt": "2026-08-25T08:16:57.539447026Z", + "completedAt": "2026-08-25T08:16:57.539557888Z" + } + } ``` 8. Check the logs and confirm that no errors were recorded. From 6cd6e6604bd5e3d408b02e34d90d28aeef980ebf Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 3 Sep 2026 08:03:14 +0000 Subject: [PATCH 19/39] Address documentation review feedback Co-authored-by: rasika-chivate <95711051+rasika-chivate@users.noreply.github.com> --- docs/sharded-source-to-replica-set-target.md | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/docs/sharded-source-to-replica-set-target.md b/docs/sharded-source-to-replica-set-target.md index e98b22f3..475ef077 100644 --- a/docs/sharded-source-to-replica-set-target.md +++ b/docs/sharded-source-to-replica-set-target.md @@ -85,7 +85,7 @@ PCSM then continues with the standard clone and replication workflow. No additio Output: - ```json + ```{.text .no-copy} 2026-08-25T07:56:21.508Z ERR Data Clone has failed: 0 B in 0s error="copy: clone_shard_test_db.sharded_coll: shard collection: shard collection: (CommandNotFound) no such command: 'shardCollection'" elapsed_secs=0.114 s=clone 2026-08-25T07:56:21.508Z ERR Cluster Replication has failed error="clone: copy: clone_shard_test_db.sharded_coll: shard collection: shard collection: (CommandNotFound) no such command: 'shardCollection'" s=pcsm ``` @@ -101,12 +101,12 @@ PCSM then continues with the standard clone and replication workflow. No additio Follow these steps: {.power-number} - 1. Create two clusters, one sharded (source) and the other replicaset (destination). + 1. Create two clusters, one sharded (source) and the other replica set (destination). 2. Create two collections on the sharded cluster: - 1. Sharded_collection (sharded) - 2. Plain_collection (non-sharded) + 1. `sharded_coll` (sharded) + 2. `plain_collection` (unsharded) 3. Add documents to both the collections. @@ -117,7 +117,7 @@ PCSM then continues with the standard clone and replication workflow. No additio ``` 5. Check the replication status. `clonedSizeBytes` matches `estimatedCloneSizeBytes`, and the state is `running`: - ```json + ```{.text .no-copy} pcsm status { "ok": true, @@ -186,12 +186,11 @@ PCSM then continues with the standard clone and replication workflow. No additio } ``` - 8. Check the logs and confirm that no errors were recorded. - - `pcsm start 2> pcsm.log` + 9. Check the logs from the replication run and confirm that no errors were recorded. - 9. Confirm that the documents for both `plain_collection` and `sharded_collection` got copied to the destination cluster. + Review the `pcsm.log` file created when you started replication. + 10. Confirm that the documents for both `plain_collection` and `sharded_coll` got copied to the destination cluster. From 2d569626063d3b9f60786ca66ec73ef05e65af3c Mon Sep 17 00:00:00 2001 From: rasika-chivate <95711051+rasika-chivate@users.noreply.github.com> Date: Thu, 3 Sep 2026 13:36:12 +0530 Subject: [PATCH 20/39] Update sharded-source-to-replica-set-target.md --- docs/sharded-source-to-replica-set-target.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sharded-source-to-replica-set-target.md b/docs/sharded-source-to-replica-set-target.md index e98b22f3..31ec1d7d 100644 --- a/docs/sharded-source-to-replica-set-target.md +++ b/docs/sharded-source-to-replica-set-target.md @@ -192,7 +192,7 @@ PCSM then continues with the standard clone and replication workflow. No additio 9. Confirm that the documents for both `plain_collection` and `sharded_collection` got copied to the destination cluster. - +To learn how MongoDB uses shard keys to distribute documents across shards, see [Shard Keys octicons-link-external-16:](https://www.mongodb.com/docs/manual/core/sharding-shard-key/){:target="_blank"} in the MongoDB documentation. From 895a309af9574d8d20a5c132056da12c0793c2f8 Mon Sep 17 00:00:00 2001 From: rasika-chivate <95711051+rasika-chivate@users.noreply.github.com> Date: Thu, 3 Sep 2026 13:39:54 +0530 Subject: [PATCH 21/39] Update sharded-source-to-replica-set-target.md --- docs/sharded-source-to-replica-set-target.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs/sharded-source-to-replica-set-target.md b/docs/sharded-source-to-replica-set-target.md index 364f3ec2..d0666c3c 100644 --- a/docs/sharded-source-to-replica-set-target.md +++ b/docs/sharded-source-to-replica-set-target.md @@ -81,8 +81,6 @@ PCSM then continues with the standard clone and replication workflow. No additio 6. Check the logs: - `pcsm start 2> pcsm.log` - Output: ```{.text .no-copy} From b63a5ff756deaf5d1190c5c285da70553fb69c42 Mon Sep 17 00:00:00 2001 From: Rasika Chivate <95711051+rasika-chivate@users.noreply.github.com> Date: Thu, 3 Sep 2026 13:46:50 +0530 Subject: [PATCH 22/39] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- docs/sharded-source-to-replica-set-target.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sharded-source-to-replica-set-target.md b/docs/sharded-source-to-replica-set-target.md index d0666c3c..d57d7275 100644 --- a/docs/sharded-source-to-replica-set-target.md +++ b/docs/sharded-source-to-replica-set-target.md @@ -111,7 +111,7 @@ PCSM then continues with the standard clone and replication workflow. No additio 4. Start replication: ```sh - pcsm start + pcsm start 2> pcsm.log ``` 5. Check the replication status. `clonedSizeBytes` matches `estimatedCloneSizeBytes`, and the state is `running`: From 3f8f690c3cab2152c33735218498078bcdd5a69b Mon Sep 17 00:00:00 2001 From: Rasika Chivate <95711051+rasika-chivate@users.noreply.github.com> Date: Thu, 3 Sep 2026 13:47:06 +0530 Subject: [PATCH 23/39] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- docs/sharded-source-to-replica-set-target.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sharded-source-to-replica-set-target.md b/docs/sharded-source-to-replica-set-target.md index d57d7275..f1738f7d 100644 --- a/docs/sharded-source-to-replica-set-target.md +++ b/docs/sharded-source-to-replica-set-target.md @@ -190,7 +190,7 @@ PCSM then continues with the standard clone and replication workflow. No additio 10. Confirm that the documents for both `plain_collection` and `sharded_coll` got copied to the destination cluster. -To learn how MongoDB uses shard keys to distribute documents across shards, see [Shard Keys octicons-link-external-16:](https://www.mongodb.com/docs/manual/core/sharding-shard-key/){:target="_blank"} in the MongoDB documentation. +To learn how MongoDB uses shard keys to distribute documents across shards, see [Shard Keys :octicons-link-external-16:](https://www.mongodb.com/docs/manual/core/sharding-shard-key/){:target="_blank"} in the MongoDB documentation. From db72be9159dfab9d6894b445681ca1a2295c0d8a Mon Sep 17 00:00:00 2001 From: Rasika Chivate <95711051+rasika-chivate@users.noreply.github.com> Date: Mon, 7 Sep 2026 12:27:18 +0530 Subject: [PATCH 24/39] Update docs/sharded-source-to-replica-set-target.md Co-authored-by: Adnan --- docs/sharded-source-to-replica-set-target.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/sharded-source-to-replica-set-target.md b/docs/sharded-source-to-replica-set-target.md index f1738f7d..aefdd979 100644 --- a/docs/sharded-source-to-replica-set-target.md +++ b/docs/sharded-source-to-replica-set-target.md @@ -140,7 +140,8 @@ PCSM then continues with the standard clone and replication workflow. No additio 6. Confirm that both collections are present on the target and that document counts match: ```javascript - db..countDocuments() + db.sharded_coll.countDocuments() + db.plain_collection.countDocuments() ``` The collection that was sharded on the source appears here as a regular collection. That is expected. From 19e103e53ae26226bfa3b01a9791327573774230 Mon Sep 17 00:00:00 2001 From: rasika-chivate <95711051+rasika-chivate@users.noreply.github.com> Date: Mon, 7 Sep 2026 12:27:34 +0530 Subject: [PATCH 25/39] PCSM-335 Use RFC 3339 format for log timestamps --- docs/deployment.md | 1 + docs/sharded-source-to-replica-set-target.md | 16 ++++++++++------ docs/sharding.md | 9 +++++++-- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/docs/deployment.md b/docs/deployment.md index b3e31266..12f41539 100644 --- a/docs/deployment.md +++ b/docs/deployment.md @@ -4,6 +4,7 @@ * **Replica Set to Replica Set**: The source and target replica sets can have different numbers of nodes. * **Sharded cluster to Sharded cluster**: The source and target sharded clusters can have different numbers of shards. This functionality is in tech preview stage. See [Sharding support in {{pcsm.full_name}}](sharding.md) for details. +* **Sharded cluster to Replica Set**: A sharded source cluster can replicate to a replica set target. Collections that are sharded on the source are created as regular collections on the target. See [Replicate from a sharded cluster to a replica set](sharded-source-to-replica-set-target.md) for details. ## Version requirements diff --git a/docs/sharded-source-to-replica-set-target.md b/docs/sharded-source-to-replica-set-target.md index f1738f7d..da8fb437 100644 --- a/docs/sharded-source-to-replica-set-target.md +++ b/docs/sharded-source-to-replica-set-target.md @@ -1,6 +1,8 @@ # Replicate from a sharded cluster to a replica set -Percona ClusterSync for MongoDB (PCSM) supports replication from a sharded MongoDB cluster to a replica set. This lets you migrate data from a sharded deployment without having to recreate the source sharding configuration on the target. +!!! admonition "Version added: 0.10.0" + +{{pcsm.full_name}} (PCSM) supports replication from a sharded MongoDB cluster to a replica set. This lets you migrate data from a sharded deployment without having to recreate the source sharding configuration on the target. For example, you can use this topology when moving data from a sharded MongoDB Atlas or MongoDB Enterprise deployment to a Percona Server for MongoDB replica set. @@ -10,9 +12,12 @@ For information about sharded cluster support, see [Sharding support in Percona When replication starts, PCSM detects that the source is sharded and the target is a replica set. -If a source collection is sharded, PCSM skips sharding operations such as `shardCollection` on the target. These operations apply only to sharded clusters. +During the initial sync, {{pcsm.short}} creates collections that are sharded on the source as regular collections on the replica set target. It doesn't apply the source shard key because `shardCollection` isn't supported on replica sets. + +During ongoing replication, {{pcsm.short}} skips `shardCollection` operations from the source and continues applying supported data changes to the target. + +No additional configuration is required. -PCSM then continues with the standard clone and replication workflow. No additional configuration is required. !!! note A collection that is sharded on the source is created as a regular collection on the replica set target. The collection data is copied, but the target collection isn't sharded. @@ -111,7 +116,7 @@ PCSM then continues with the standard clone and replication workflow. No additio 4. Start replication: ```sh - pcsm start 2> pcsm.log + pcsm start ``` 5. Check the replication status. `clonedSizeBytes` matches `estimatedCloneSizeBytes`, and the state is `running`: @@ -184,9 +189,8 @@ PCSM then continues with the standard clone and replication workflow. No additio } ``` - 9. Check the logs from the replication run and confirm that no errors were recorded. + 9. Check the replication logs and confirm that no errors were recorded. For details, see [Logging in Percona ClusterSync for MongoDB](logging.md) - Review the `pcsm.log` file created when you started replication. 10. Confirm that the documents for both `plain_collection` and `sharded_coll` got copied to the destination cluster. diff --git a/docs/sharding.md b/docs/sharding.md index 34b13d88..bc2c0c73 100644 --- a/docs/sharding.md +++ b/docs/sharding.md @@ -4,7 +4,11 @@ Sharding support is available starting with {{pcsm.full_name}} 0.7.0 and is currently in technical preview stage. We encourage you to try it out and share your feedback. This will help us improve the feature in future releases. -{{pcsm.full_name}} supports replication between sharded MongoDB clusters, enabling you to migrate or synchronize data from one sharded deployment to another. This capability allows you to migrate sharded clusters with minimal downtime and synchronize data between sharded clusters for testing or development purposes. +{{pcsm.full_name}} supports replication from a sharded MongoDB cluster to another sharded cluster or to a replica set. + +With a sharded target, you can migrate or synchronize data between sharded deployments with minimal downtime. With a replica set target, {{pcsm.full_name}} copies the data and skips the source sharding configuration. + +For details about using a replica set as the target, see [Replicate from a sharded cluster to a replica set](sharded-source-to-replica-set-target.md). ## Overview @@ -17,7 +21,8 @@ Also, {{pcsm.short}} replicates data and not metadata. This means chunk distribu ## Prerequisites * {{pcsm.full_name}} version 0.7.0 or later -* Source and target clusters must be sharded MongoDB deployments +* The source must be a sharded MongoDB deployment. +* The target can be either a sharded MongoDB deployment or a replica set. * Both clusters must be running the same MongoDB version. Check [Version requirements](deployment.md#version-requirements) for more information about supported versions. ## Connection string format From 91c9e95af4597008d35b8c46e0013c07e7e0c45f Mon Sep 17 00:00:00 2001 From: Rasika Chivate <95711051+rasika-chivate@users.noreply.github.com> Date: Mon, 7 Sep 2026 12:27:59 +0530 Subject: [PATCH 26/39] Update docs/sharded-source-to-replica-set-target.md Co-authored-by: Adnan --- docs/sharded-source-to-replica-set-target.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sharded-source-to-replica-set-target.md b/docs/sharded-source-to-replica-set-target.md index 016330fd..0f9a9ce6 100644 --- a/docs/sharded-source-to-replica-set-target.md +++ b/docs/sharded-source-to-replica-set-target.md @@ -10,7 +10,7 @@ For information about sharded cluster support, see [Sharding support in Percona ## How PCSM handles the topology difference -When replication starts, PCSM detects that the source is sharded and the target is a replica set. +When the PCSM server starts, it detects that the source is sharded and the target is a replica set. During the initial sync, {{pcsm.short}} creates collections that are sharded on the source as regular collections on the replica set target. It doesn't apply the source shard key because `shardCollection` isn't supported on replica sets. From 271c7642a49555df969c1d4d42d1bbe3d027698c Mon Sep 17 00:00:00 2001 From: rasika-chivate <95711051+rasika-chivate@users.noreply.github.com> Date: Mon, 7 Sep 2026 12:40:43 +0530 Subject: [PATCH 27/39] Update sharded-source-to-replica-set-target.md --- docs/sharded-source-to-replica-set-target.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/sharded-source-to-replica-set-target.md b/docs/sharded-source-to-replica-set-target.md index 016330fd..70539b49 100644 --- a/docs/sharded-source-to-replica-set-target.md +++ b/docs/sharded-source-to-replica-set-target.md @@ -93,7 +93,9 @@ No additional configuration is required. 2026-08-25T07:56:21.508Z ERR Cluster Replication has failed error="clone: copy: clone_shard_test_db.sharded_coll: shard collection: shard collection: (CommandNotFound) no such command: 'shardCollection'" s=pcsm ``` - 7. Confirm that neither collection reached the target. The clone stops at the first failure, so even the unsharded collection is missing. + 7. Check the target collections. In this example, neither collection was copied to the target before the clone failed. + + Because the initial clone processes collections in parallel, the result can vary. An unsharded collection such as `plain_collection` may already be created or partially copied when cloning `sharded_coll` fails. === "After cross-topology support" From 5465fc35fa6c93025bf9cd416d7e83063b8c3a16 Mon Sep 17 00:00:00 2001 From: rasika-chivate <95711051+rasika-chivate@users.noreply.github.com> Date: Mon, 7 Sep 2026 12:52:20 +0530 Subject: [PATCH 28/39] implement feedback from dev --- docs/sharded-source-to-replica-set-target.md | 248 +++++++------------ 1 file changed, 96 insertions(+), 152 deletions(-) diff --git a/docs/sharded-source-to-replica-set-target.md b/docs/sharded-source-to-replica-set-target.md index c5169146..92b5f01c 100644 --- a/docs/sharded-source-to-replica-set-target.md +++ b/docs/sharded-source-to-replica-set-target.md @@ -12,9 +12,9 @@ For information about sharded cluster support, see [Sharding support in Percona When the PCSM server starts, it detects that the source is sharded and the target is a replica set. -During the initial sync, {{pcsm.short}} creates collections that are sharded on the source as regular collections on the replica set target. It doesn't apply the source shard key because `shardCollection` isn't supported on replica sets. +During the initial sync, PCSM creates collections that are sharded on the source as regular collections on the replica set target. It doesn't apply the source shard key because `shardCollection` isn't supported on replica sets. -During ongoing replication, {{pcsm.short}} skips `shardCollection` operations from the source and continues applying supported data changes to the target. +During ongoing replication, PCSM skips `shardCollection` operations from the source and continues applying supported data changes to the target. No additional configuration is required. @@ -32,170 +32,114 @@ No additional configuration is required. ## Before you start -- Ensure the source and target MongoDB versions meet the [version requirements](version-compatibility.md#version-compatibility-matrix). -- Configure authentication for both deployments. Refer to [Configure authentication in MongoDB](./install/authentication.md). -- Verify that PCSM can connect to the source sharded cluster and the target replica set. +* vEnsure the source and target MongoDB versions meet the version requirements. +* Configure authentication for both deployments. +* Configure the source connection string with the mongos hostname and port. Configure the target connection string with the replica set members. -## Replication before and after cross-topology support + For example: -=== "Before cross-topology support" + `PCSM_SOURCE_URI="mongodb://source-user:password@mongos-source:27017/admin"` + PCSM_TARGET_URI="mongodb://target-`user:password@target1:27017,target2:27017,target3:27017/admin?replicaSet=rs0"` +* Verify that {{pcsm.short}} can connect to both the source sharded cluster and the target replica set. - Without cross-topology handling, PCSM attempts to apply the source collection's sharding configuration to the replica set. The clone fails because the target doesn't support `shardCollection`. +## Replication after cross-topology support - ??? example "Example" +With cross-topology support, PCSM detects the replica set target and skips the unsupported sharding operations. - Follow these steps: - {.power-number} +??? example "Example" - 1. Create two clusters, one sharded (source) and the other replica set (destination). + Follow these steps: + {.power-number} - 2. Create two collections on the sharded cluster: + 1. Create two clusters, one sharded (source) and the other replica set (destination). - 1. `sharded_coll` (sharded) - 2. `plain_collection` (unsharded) + 2. Create two collections on the sharded cluster: + + 1. `sharded_coll` (sharded) + 2. `plain_collection` (unsharded) - 3. Add documents to both the collections. + 3. Add documents to both the collections. - 4. Start replication: + 4. Start replication: - ```sh - pcsm start - ``` - 5. Check the replication status: + ```sh + pcsm start + ``` - ```{.text .no-copy} - pcsm status - { - "ok": false, - "error": "clone: copy: clone_shard_test_db.sharded_coll: shard collection: (CommandNotFound) no such command: 'shardCollection'", - "state": "failed", - "info": "Failed", - "lagTimeSeconds": 0, - "eventsRead": 0, - "eventsApplied": 0, - "initialSync": { - "estimatedCloneSizeBytes": 7490, - "clonedSizeBytes": 1490, - "completed": false, - "cloneCompleted": true - } - } - Error: clone: copy: clone_shard_test_db.sharded_coll: shard collection: (CommandNotFound) no such command: 'shardCollection' - 2026-08-25T07:51:17.586Z FTL error="clone: copy: clone_shard_test_db.sharded_coll: shard collection: (CommandNotFound) no such command: 'shardCollection'" - ``` - - 6. Check the logs: + 5. Check the replication status. `clonedSizeBytes` matches `estimatedCloneSizeBytes`, and the state is `running`: - Output: - - ```{.text .no-copy} - 2026-08-25T07:56:21.508Z ERR Data Clone has failed: 0 B in 0s error="copy: clone_shard_test_db.sharded_coll: shard collection: shard collection: (CommandNotFound) no such command: 'shardCollection'" elapsed_secs=0.114 s=clone - 2026-08-25T07:56:21.508Z ERR Cluster Replication has failed error="clone: copy: clone_shard_test_db.sharded_coll: shard collection: shard collection: (CommandNotFound) no such command: 'shardCollection'" s=pcsm - ``` - - 7. Check the target collections. In this example, neither collection was copied to the target before the clone failed. - - Because the initial clone processes collections in parallel, the result can vary. An unsharded collection such as `plain_collection` may already be created or partially copied when cloning `sharded_coll` fails. - -=== "After cross-topology support" - - With cross-topology support, PCSM detects the replica set target and skips the unsupported sharding operations. - - ??? example "Example" - - Follow these steps: - {.power-number} - - 1. Create two clusters, one sharded (source) and the other replica set (destination). - - 2. Create two collections on the sharded cluster: - - 1. `sharded_coll` (sharded) - 2. `plain_collection` (unsharded) - - 3. Add documents to both the collections. - - 4. Start replication: - - ```sh - pcsm start - ``` - 5. Check the replication status. `clonedSizeBytes` matches `estimatedCloneSizeBytes`, and the state is `running`: - - ```{.text .no-copy} - pcsm status - { - "ok": true, - "state": "running", - "info": "Replicating Changes", - "lagTimeSeconds": 0, - "eventsRead": 0, - "eventsApplied": 0, - "lastReplicatedOpTime": { - "ts": "1787645813.1", - "isoDate": "2026-08-25T08:16:53Z" - }, + ```{.text .no-copy} + pcsm status + { + "ok": true, + "state": "running", + "info": "Replicating Changes", + "lagTimeSeconds": 0, + "eventsRead": 0, + "eventsApplied": 0, + "lastReplicatedOpTime": { + "ts": "1787645813.1", + "isoDate": "2026-08-25T08:16:53Z" + }, "initialSync": { - "estimatedCloneSizeBytes": 7490, - "clonedSizeBytes": 7490, - "completed": true, - "cloneCompleted": true - } - } - ``` - - 6. Confirm that both collections are present on the target and that document counts match: - - ```javascript - db.sharded_coll.countDocuments() - db.plain_collection.countDocuments() - ``` - - The collection that was sharded on the source appears here as a regular collection. That is expected. - - - 7. Finalize the sync: - - ```{.bash data-prompt="$"} - $ pcsm finalize - ``` - - 8. Check the status again: - - ```{.bash data-prompt="$"} - $ pcsm status - ``` - - ```{.json .no-copy} - { - "ok": true, - "state": "finalized", - "info": "Finalized", - "lagTimeSeconds": 1, - "eventsRead": 0, - "eventsApplied": 0, - "lastReplicatedOpTime": { - "ts": "1787645817.1", - "isoDate": "2026-08-25T08:16:57Z" - }, - "initialSync": { - "estimatedCloneSizeBytes": 7490, - "clonedSizeBytes": 7490, - "completed": true, - "cloneCompleted": true - }, - "finalization": { - "completed": true, - "startedAt": "2026-08-25T08:16:57.539447026Z", - "completedAt": "2026-08-25T08:16:57.539557888Z" - } - } - ``` - - 9. Check the replication logs and confirm that no errors were recorded. For details, see [Logging in Percona ClusterSync for MongoDB](logging.md) - - - 10. Confirm that the documents for both `plain_collection` and `sharded_coll` got copied to the destination cluster. + "estimatedCloneSizeBytes": 7490, + "clonedSizeBytes": 7490, + "completed": true, + "cloneCompleted": true + } + } + ``` + + 6. Confirm that both collections are present on the target and that document counts match: + + ```javascript + db.sharded_coll.countDocuments() + db.plain_collection.countDocuments() + ``` + + The collection that was sharded on the source appears here as a regular collection. That is expected. + + 7. Finalize the sync: + + ```{.bash data-prompt="$"} + $ pcsm finalize + ``` + + 8. Check the status again: + + ```{.bash data-prompt="$"} + $ pcsm status + ``` + + ```{.json .no-copy} + { + "ok": true, + "state": "finalized", + "info": "Finalized", + "lagTimeSeconds": 1, + "eventsRead": 0, + "eventsApplied": 0, + "lastReplicatedOpTime": { + "ts": "1787645817.1", + "isoDate": "2026-08-25T08:16:57Z" + }, + "initialSync": { + "estimatedCloneSizeBytes": 7490, + "clonedSizeBytes": 7490, + "completed": true, + "cloneCompleted": true + }, + "finalization": { + "completed": true, + "startedAt": "2026-08-25T08:16:57.539447026Z", + "completedAt": "2026-08-25T08:16:57.539557888Z" + } + } + ``` + + 9. Check the replication logs and confirm that no errors were recorded. For details, see [Logging in Percona ClusterSync for MongoDB](logging.md). + + 10. Confirm that the documents for both `plain_collection` and `sharded_coll` got copied to the destination cluster. To learn how MongoDB uses shard keys to distribute documents across shards, see [Shard Keys :octicons-link-external-16:](https://www.mongodb.com/docs/manual/core/sharding-shard-key/){:target="_blank"} in the MongoDB documentation. From d8a7af01cfc0be6a5cee662c7905c44ea712cf96 Mon Sep 17 00:00:00 2001 From: rasika-chivate <95711051+rasika-chivate@users.noreply.github.com> Date: Mon, 7 Sep 2026 12:57:41 +0530 Subject: [PATCH 29/39] Update sharded-source-to-replica-set-target.md --- docs/sharded-source-to-replica-set-target.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sharded-source-to-replica-set-target.md b/docs/sharded-source-to-replica-set-target.md index 92b5f01c..b5aa6277 100644 --- a/docs/sharded-source-to-replica-set-target.md +++ b/docs/sharded-source-to-replica-set-target.md @@ -40,7 +40,7 @@ No additional configuration is required. `PCSM_SOURCE_URI="mongodb://source-user:password@mongos-source:27017/admin"` PCSM_TARGET_URI="mongodb://target-`user:password@target1:27017,target2:27017,target3:27017/admin?replicaSet=rs0"` -* Verify that {{pcsm.short}} can connect to both the source sharded cluster and the target replica set. +* Verify that PCSM can connect to both the source sharded cluster and the target replica set. ## Replication after cross-topology support From 319653629cdeb1479ef1ed4d82bb323cf7dd9cf3 Mon Sep 17 00:00:00 2001 From: rasika-chivate <95711051+rasika-chivate@users.noreply.github.com> Date: Mon, 7 Sep 2026 12:58:53 +0530 Subject: [PATCH 30/39] Update sharded-source-to-replica-set-target.md --- docs/sharded-source-to-replica-set-target.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/sharded-source-to-replica-set-target.md b/docs/sharded-source-to-replica-set-target.md index b5aa6277..916d151a 100644 --- a/docs/sharded-source-to-replica-set-target.md +++ b/docs/sharded-source-to-replica-set-target.md @@ -18,7 +18,6 @@ During ongoing replication, PCSM skips `shardCollection` operations from the sou No additional configuration is required. - !!! note A collection that is sharded on the source is created as a regular collection on the replica set target. The collection data is copied, but the target collection isn't sharded. From 2b9c87efc16cbeeaa117f76da8f30e7c5093e864 Mon Sep 17 00:00:00 2001 From: Rasika Chivate <95711051+rasika-chivate@users.noreply.github.com> Date: Mon, 7 Sep 2026 13:00:14 +0530 Subject: [PATCH 31/39] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- docs/sharded-source-to-replica-set-target.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sharded-source-to-replica-set-target.md b/docs/sharded-source-to-replica-set-target.md index 916d151a..f8e9a10d 100644 --- a/docs/sharded-source-to-replica-set-target.md +++ b/docs/sharded-source-to-replica-set-target.md @@ -31,7 +31,7 @@ No additional configuration is required. ## Before you start -* vEnsure the source and target MongoDB versions meet the version requirements. +* Ensure the source and target MongoDB versions meet the version requirements. * Configure authentication for both deployments. * Configure the source connection string with the mongos hostname and port. Configure the target connection string with the replica set members. From 644794e02cd38af09a299d22ecc1de2f973a5790 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 7 Sep 2026 07:33:06 +0000 Subject: [PATCH 32/39] Clarify sharded-target vs replica-set-target guidance in sharding docs Co-authored-by: rasika-chivate <95711051+rasika-chivate@users.noreply.github.com> --- docs/sharding.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/sharding.md b/docs/sharding.md index bc2c0c73..56a4b0e6 100644 --- a/docs/sharding.md +++ b/docs/sharding.md @@ -12,9 +12,9 @@ For details about using a replica set as the target, see [Replicate from a shard ## Overview -The workflow for sharded clusters is similar to replica sets. See [How {{pcsm.full_name}} works](intro.md#replication-workflows) for the complete workflow overview. The key difference is that {{pcsm.short}} connects to `mongos` instances on both the source and target clusters instead of replica set members. +The workflow for sharded clusters is similar to replica sets. See [How {{pcsm.full_name}} works](intro.md#replication-workflows) for the complete workflow overview. The key difference is the target topology: when the target is a sharded cluster, {{pcsm.short}} connects through `mongos` on both the source and target. When the target is a replica set, it connects through the source `mongos` and then the target replica set members instead of a target `mongos`. -Since {{pcsm.short}} connects through `mongos`, the cluster topology doesn't matter. This means the source and target clusters can have different numbers of shards. +In both cases, the source must be a sharded MongoDB deployment. The source and target can have different numbers of shards, and a replica set target does not require a target `mongos` instance. Also, {{pcsm.short}} replicates data and not metadata. This means chunk distribution as well as the primary shard name for a collection may differ on source and target clusters. @@ -27,13 +27,13 @@ Also, {{pcsm.short}} replicates data and not metadata. This means chunk distribu ## Connection string format -When connecting to sharded clusters, use the standard MongoDB connection string format but specify `mongos` hostname and port instead of replica set members: +When connecting to a sharded source or a sharded target, use the standard MongoDB connection string format but specify the `mongos` hostname and port instead of replica set members: ```{.text .no-copy} mongodb://user:pwd@mongos-host:port/[authdb]?[options] ``` -Since {{pcsm.short}} connects through `mongos`, you don't need to specify individual shard members or config servers in the connection string. The `mongos` router handles routing to the appropriate shards. +When the target is a replica set, specify the target replica set members in the target connection string instead of a `mongos` URI. {{pcsm.short}} does not require a target `mongos` instance in that topology. For detailed information about authentication and connection string configuration, see [Configure authentication in MongoDB](install/authentication.md). From ea37bd190f6dc30b862739ef687857511ed18355 Mon Sep 17 00:00:00 2001 From: rasika-chivate <95711051+rasika-chivate@users.noreply.github.com> Date: Mon, 7 Sep 2026 13:17:08 +0530 Subject: [PATCH 33/39] Update sharded-source-to-replica-set-target.md --- docs/sharded-source-to-replica-set-target.md | 28 +++++++++++--------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/docs/sharded-source-to-replica-set-target.md b/docs/sharded-source-to-replica-set-target.md index f8e9a10d..027b093a 100644 --- a/docs/sharded-source-to-replica-set-target.md +++ b/docs/sharded-source-to-replica-set-target.md @@ -8,14 +8,13 @@ For example, you can use this topology when moving data from a sharded MongoDB A For information about sharded cluster support, see [Sharding support in Percona ClusterSync for MongoDB](sharding.md). -## How PCSM handles the topology difference +## Overview When the PCSM server starts, it detects that the source is sharded and the target is a replica set. -During the initial sync, PCSM creates collections that are sharded on the source as regular collections on the replica set target. It doesn't apply the source shard key because `shardCollection` isn't supported on replica sets. - -During ongoing replication, PCSM skips `shardCollection` operations from the source and continues applying supported data changes to the target. +During the initial sync, PCSM creates every source collection on the target, including the sharded ones, as a regular collection. It doesn't carry over the source shard key, because a replica set has no shards to distribute documents across and doesn't support [`shardCollection` :octicons-link-external-16:](https://www.mongodb.com/docs/manual/reference/command/shardCollection/){:target="_blank"}. +During change replication, PCSM skips `shardCollection` events coming from the source [change stream :octicons-link-external-16:](https://www.mongodb.com/docs/manual/changeStreams/){:target="_blank"} and keeps applying the data changes it supports. No additional configuration is required. !!! note @@ -33,19 +32,24 @@ No additional configuration is required. * Ensure the source and target MongoDB versions meet the version requirements. * Configure authentication for both deployments. -* Configure the source connection string with the mongos hostname and port. Configure the target connection string with the replica set members. +* Configure the source connection string with the `mongos` hostname and port. Configure the target connection string with the replica set members. +* Verify that PCSM can connect to both the source sharded cluster and the target replica set. - For example: +## Connection string format - `PCSM_SOURCE_URI="mongodb://source-user:password@mongos-source:27017/admin"` - PCSM_TARGET_URI="mongodb://target-`user:password@target1:27017,target2:27017,target3:27017/admin?replicaSet=rs0"` -* Verify that PCSM can connect to both the source sharded cluster and the target replica set. +Point the source URI at the mongos hostname and port. Point the target URI at the replica set members and name the replica set: + +```sh +PCSM_SOURCE_URI="mongodb://source-user:password@mongos-source:27017/admin" + +PCSM_TARGET_URI="mongodb://target-`user:password@target1:27017,target2:27017,target3:27017/admin?replicaSet=rs0" +``` -## Replication after cross-topology support +## usage -With cross-topology support, PCSM detects the replica set target and skips the unsupported sharding operations. +The commands and API endpoints are the same as for any other topology. See, [Percona ClusterSync for MongoDB commands](pcsm-commands.md) for the command reference. -??? example "Example" +??? example "Walkthrough: sharded source to replica set target" Follow these steps: {.power-number} From 470c43dd3082cebed5474dc9ba1d6e8bd9d15337 Mon Sep 17 00:00:00 2001 From: rasika-chivate <95711051+rasika-chivate@users.noreply.github.com> Date: Mon, 7 Sep 2026 13:20:06 +0530 Subject: [PATCH 34/39] Update sharded-source-to-replica-set-target.md --- docs/sharded-source-to-replica-set-target.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/docs/sharded-source-to-replica-set-target.md b/docs/sharded-source-to-replica-set-target.md index 027b093a..11c89430 100644 --- a/docs/sharded-source-to-replica-set-target.md +++ b/docs/sharded-source-to-replica-set-target.md @@ -144,7 +144,19 @@ The commands and API endpoints are the same as for any other topology. See, [Per 10. Confirm that the documents for both `plain_collection` and `sharded_coll` got copied to the destination cluster. -To learn how MongoDB uses shard keys to distribute documents across shards, see [Shard Keys :octicons-link-external-16:](https://www.mongodb.com/docs/manual/core/sharding-shard-key/){:target="_blank"} in the MongoDB documentation. + +## Next steps + +* [Install {{pcsm.full_name}}](installation.md) +* [Configure authentication](install/authentication.md) +* [Start replication](install/usage.md) +* [Monitor replication status](install/usage.md#check-the-replication-status) +* [Monitor PCSM performance with Percona Monitoring and Management](pmm-setup.md) + + +## Learn more + +[Shard Keys :octicons-link-external-16:](https://www.mongodb.com/docs/manual/core/sharding-shard-key/){:target="_blank"} From 5ef5a009a34d6ae886e76875fd94c905f62c64e0 Mon Sep 17 00:00:00 2001 From: Rasika Chivate <95711051+rasika-chivate@users.noreply.github.com> Date: Mon, 7 Sep 2026 13:26:20 +0530 Subject: [PATCH 35/39] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- docs/deployment.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/deployment.md b/docs/deployment.md index 12f41539..4d78c7cc 100644 --- a/docs/deployment.md +++ b/docs/deployment.md @@ -4,7 +4,7 @@ * **Replica Set to Replica Set**: The source and target replica sets can have different numbers of nodes. * **Sharded cluster to Sharded cluster**: The source and target sharded clusters can have different numbers of shards. This functionality is in tech preview stage. See [Sharding support in {{pcsm.full_name}}](sharding.md) for details. -* **Sharded cluster to Replica Set**: A sharded source cluster can replicate to a replica set target. Collections that are sharded on the source are created as regular collections on the target. See [Replicate from a sharded cluster to a replica set](sharded-source-to-replica-set-target.md) for details. +* **Sharded cluster to Replica Set**: A sharded source cluster can replicate to a replica set target. Collections that are sharded on the source are created as regular collections on the target. This functionality is in tech preview stage. See [Replicate from a sharded cluster to a replica set](sharded-source-to-replica-set-target.md) for details. ## Version requirements From 4453888106cdd92a63d05e7f4d23bf88479a8ace Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 7 Sep 2026 07:58:46 +0000 Subject: [PATCH 36/39] Split sharding prerequisites by target topology Co-authored-by: rasika-chivate <95711051+rasika-chivate@users.noreply.github.com> --- docs/sharding.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/sharding.md b/docs/sharding.md index 56a4b0e6..b95a3f72 100644 --- a/docs/sharding.md +++ b/docs/sharding.md @@ -20,7 +20,8 @@ Also, {{pcsm.short}} replicates data and not metadata. This means chunk distribu ## Prerequisites -* {{pcsm.full_name}} version 0.7.0 or later +* If the target is a sharded MongoDB deployment, {{pcsm.full_name}} version 0.7.0 or later. +* If the target is a replica set, {{pcsm.full_name}} version 0.10.0 or later. * The source must be a sharded MongoDB deployment. * The target can be either a sharded MongoDB deployment or a replica set. * Both clusters must be running the same MongoDB version. Check [Version requirements](deployment.md#version-requirements) for more information about supported versions. From 5438446c70913ac919f11eae1c968b9577fe5925 Mon Sep 17 00:00:00 2001 From: rasika-chivate <95711051+rasika-chivate@users.noreply.github.com> Date: Mon, 7 Sep 2026 13:35:43 +0530 Subject: [PATCH 37/39] implement feedback --- docs/deployment.md | 2 +- docs/sharded-source-to-replica-set-target.md | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/deployment.md b/docs/deployment.md index 4d78c7cc..12f41539 100644 --- a/docs/deployment.md +++ b/docs/deployment.md @@ -4,7 +4,7 @@ * **Replica Set to Replica Set**: The source and target replica sets can have different numbers of nodes. * **Sharded cluster to Sharded cluster**: The source and target sharded clusters can have different numbers of shards. This functionality is in tech preview stage. See [Sharding support in {{pcsm.full_name}}](sharding.md) for details. -* **Sharded cluster to Replica Set**: A sharded source cluster can replicate to a replica set target. Collections that are sharded on the source are created as regular collections on the target. This functionality is in tech preview stage. See [Replicate from a sharded cluster to a replica set](sharded-source-to-replica-set-target.md) for details. +* **Sharded cluster to Replica Set**: A sharded source cluster can replicate to a replica set target. Collections that are sharded on the source are created as regular collections on the target. See [Replicate from a sharded cluster to a replica set](sharded-source-to-replica-set-target.md) for details. ## Version requirements diff --git a/docs/sharded-source-to-replica-set-target.md b/docs/sharded-source-to-replica-set-target.md index 11c89430..81713d96 100644 --- a/docs/sharded-source-to-replica-set-target.md +++ b/docs/sharded-source-to-replica-set-target.md @@ -14,8 +14,7 @@ When the PCSM server starts, it detects that the source is sharded and the targe During the initial sync, PCSM creates every source collection on the target, including the sharded ones, as a regular collection. It doesn't carry over the source shard key, because a replica set has no shards to distribute documents across and doesn't support [`shardCollection` :octicons-link-external-16:](https://www.mongodb.com/docs/manual/reference/command/shardCollection/){:target="_blank"}. -During change replication, PCSM skips `shardCollection` events coming from the source [change stream :octicons-link-external-16:](https://www.mongodb.com/docs/manual/changeStreams/){:target="_blank"} and keeps applying the data changes it supports. -No additional configuration is required. +During change replication, PCSM skips `shardCollection` events coming from the source [change stream :octicons-link-external-16:](https://www.mongodb.com/docs/manual/changeStreams/){:target="_blank"} and keeps applying the data changes it supports. No additional configuration is required. !!! note A collection that is sharded on the source is created as a regular collection on the replica set target. The collection data is copied, but the target collection isn't sharded. From 7421f627c33d616db280029c19397d795515cfa5 Mon Sep 17 00:00:00 2001 From: rasika-chivate <95711051+rasika-chivate@users.noreply.github.com> Date: Mon, 7 Sep 2026 13:41:26 +0530 Subject: [PATCH 38/39] Update sharded-source-to-replica-set-target.md --- docs/sharded-source-to-replica-set-target.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/sharded-source-to-replica-set-target.md b/docs/sharded-source-to-replica-set-target.md index 81713d96..27cd6b42 100644 --- a/docs/sharded-source-to-replica-set-target.md +++ b/docs/sharded-source-to-replica-set-target.md @@ -36,12 +36,14 @@ During change replication, PCSM skips `shardCollection` events coming from the s ## Connection string format -Point the source URI at the mongos hostname and port. Point the target URI at the replica set members and name the replica set: +Point the source URI at the `mongos` hostname and port. Point the target URI at the replica set members and name the replica set: + +**Example** ```sh -PCSM_SOURCE_URI="mongodb://source-user:password@mongos-source:27017/admin" +PCSM_SOURCE_URI="mongodb://source-user:password@mongos-source:27017/admin" -PCSM_TARGET_URI="mongodb://target-`user:password@target1:27017,target2:27017,target3:27017/admin?replicaSet=rs0" +PCSM_TARGET_URI="mongodb://target-user:password@target1:27017,target2:27017,target3:27017/admin?replicaSet=rs0" ``` ## usage From d43e402486d978d2ae07788f2340f0e79fa63fdb Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 7 Sep 2026 08:14:42 +0000 Subject: [PATCH 39/39] Addressed remaining review wording fixes Co-authored-by: rasika-chivate <95711051+rasika-chivate@users.noreply.github.com> --- docs/sharded-source-to-replica-set-target.md | 6 +++--- docs/sharding.md | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/sharded-source-to-replica-set-target.md b/docs/sharded-source-to-replica-set-target.md index 27cd6b42..82d36666 100644 --- a/docs/sharded-source-to-replica-set-target.md +++ b/docs/sharded-source-to-replica-set-target.md @@ -55,7 +55,7 @@ The commands and API endpoints are the same as for any other topology. See, [Per Follow these steps: {.power-number} - 1. Create two clusters, one sharded (source) and the other replica set (destination). + 1. Create two clusters: one sharded source cluster and one target replica set. 2. Create two collections on the sharded cluster: @@ -94,7 +94,7 @@ The commands and API endpoints are the same as for any other topology. See, [Per } ``` - 6. Confirm that both collections are present on the target and that document counts match: + 6. Run the same query against both deployments and compare the results to confirm that both collections are present and that document counts match: ```javascript db.sharded_coll.countDocuments() @@ -109,7 +109,7 @@ The commands and API endpoints are the same as for any other topology. See, [Per $ pcsm finalize ``` - 8. Check the status again: + 8. Check the status again until the state is `finalized`: ```{.bash data-prompt="$"} $ pcsm status diff --git a/docs/sharding.md b/docs/sharding.md index b95a3f72..2a73c5b7 100644 --- a/docs/sharding.md +++ b/docs/sharding.md @@ -14,7 +14,7 @@ For details about using a replica set as the target, see [Replicate from a shard The workflow for sharded clusters is similar to replica sets. See [How {{pcsm.full_name}} works](intro.md#replication-workflows) for the complete workflow overview. The key difference is the target topology: when the target is a sharded cluster, {{pcsm.short}} connects through `mongos` on both the source and target. When the target is a replica set, it connects through the source `mongos` and then the target replica set members instead of a target `mongos`. -In both cases, the source must be a sharded MongoDB deployment. The source and target can have different numbers of shards, and a replica set target does not require a target `mongos` instance. +In both cases, the source must be a sharded MongoDB deployment. When the target is a sharded cluster, the source and target can have different numbers of shards. A replica set target does not require a target `mongos` instance. Also, {{pcsm.short}} replicates data and not metadata. This means chunk distribution as well as the primary shard name for a collection may differ on source and target clusters.