Skip to content

PCSM-283 Skip sharding operations for replica set - #67

Open
rasika-chivate wants to merge 54 commits into
mainfrom
PCSM-283-Skip-sharding-operations-for-replica-set
Open

rasika-chivate wants to merge 54 commits into
mainfrom
PCSM-283-Skip-sharding-operations-for-replica-set

Conversation

@rasika-chivate

Copy link
Copy Markdown
Collaborator

Add topology migration from Sharded Cluster to Replicaset.

For details, see the following ticket:

https://perconadev.atlassian.net/browse/PCSM-283

Co-authored-by: rasika-chivate <95711051+rasika-chivate@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Version guidance, URI syntax, migration prerequisites, and workflow instructions contain unresolved inaccuracies.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details

Suppressed comments (5)

docs/sharding.md:17

  • This sentence applies “different numbers of shards” to both target topologies, but a replica set has no shards. Limit that statement to the sharded-target case so the topology description remains accurate.
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.

docs/sharded-source-to-replica-set-target.md:41

  • The examples are not in one code block, and the stray backtick in target-userbreaks the target username and Markdown rendering. Present both complete environment assignments in a fenced block withtarget-user` intact.
    `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"`

docs/sharded-source-to-replica-set-target.md:53

  • The singular noun after “the other” is missing an article. This also switches from the page's established “target” terminology to “destination”; use a parallel source/target description.
    1. Create two clusters, one sharded (source) and the other replica set (destination).

docs/sharded-source-to-replica-set-target.md:92

  • These commands are described as running only on the target, so their output cannot establish that counts match the source. Instruct readers to run the same queries against both deployments before comparing the results.
    6. Confirm that both collections are present on the target and that document counts match:

docs/sharded-source-to-replica-set-target.md:107

  • Finalization can still be in progress when the first status request runs (docs/install/usage.md:171-175), so one immediate check is not guaranteed to produce the shown finalized response. Tell readers to poll until that state is reached.
    8. Check the status again:
  • Files reviewed: 4/4 changed files
  • Comments generated: 3
  • Review effort level: Balanced

Comment thread docs/sharded-source-to-replica-set-target.md Outdated
Comment thread docs/sharding.md
Comment thread docs/deployment.md Outdated

Copilot AI commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

🟡 Changes recommended

Version guidance, URI syntax, migration prerequisites, and workflow instructions contain unresolved inaccuracies....

Updated the source/target wording, clarified that finalization status should be polled until it reaches finalized, and narrowed the shard-count guidance to the sharded-target case.

Copilot AI and others added 2 commits September 7, 2026 08:14
Co-authored-by: rasika-chivate <95711051+rasika-chivate@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Some guidance remains incorrect for replica set targets and filtered replication.

Get a fresh assessment by requesting another Copilot review.

Review details

Suppressed comments (1)

docs/sharded-source-to-replica-set-target.md:53

  • The heading should be capitalized consistently, and the comma after “See” is grammatically incorrect.
## usage

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. 
  • Files reviewed: 4/4 changed files
  • Comments generated: 2
  • Review effort level: Balanced

Comment thread docs/sharded-source-to-replica-set-target.md Outdated
Comment thread docs/sharding.md
Comment on lines +7 to +11
{{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).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in 929f26e.

Comment thread docs/deployment.md Outdated
Comment thread docs/sharded-source-to-replica-set-target.md Outdated
rasika-chivate and others added 6 commits September 16, 2026 12:49
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Adnan <chupe@chupe.ba>
Co-authored-by: rasika-chivate <95711051+rasika-chivate@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@chupe chupe mentioned this pull request Sep 17, 2026

| **On the source** | **On the replica set target** |
|---|---|
| Sharded collection | Created as a regular collection. Documents are copied only if `_id` values are unique across all source shards because the replica set target enforces collection-wide `_id` uniqueness. The shard key isn't applied because it doesn't apply to a replica set. |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This reads like PCSM checks _id uniqueness which it doesn't. During clone the inserts are unordered and duplicate key errors swallowed. That means some documents might go missing and unreported at that.
During replication an _id collision goes through delete by _id then insert.

Can we make this a prerequisite and a warning instead? _id has to be unique across all source shards, PCSM doesnt verify it. Duplicates are silently dropped or overwritten rather than failing the run.

It could be a pre-migration check too since it might lead to a silent data-loss.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

Comment thread docs/sharding.md Outdated
Comment thread docs/deployment.md Outdated

* **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**: Starting with PCSM 0.10.0, 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. For details, see [Replicate from a sharded cluster to a replica set](sharded-source-to-replica-set-target.md) for details.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: "For details, see [...] for details."

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

Comment on lines +163 to +180


















Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are the empty lines for?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

Co-authored-by: Adnan <chupe@chupe.ba>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants