Skip to content

[WIP] Use sharded cluster for replset remapping test#2187

Closed
mayankshah1607 wants to merge 2 commits intomainfrom
replset-remapping-sharded-test
Closed

[WIP] Use sharded cluster for replset remapping test#2187
mayankshah1607 wants to merge 2 commits intomainfrom
replset-remapping-sharded-test

Conversation

@mayankshah1607
Copy link
Member

@mayankshah1607 mayankshah1607 commented Jan 12, 2026

CHANGE DESCRIPTION

Problem:
Short explanation of the problem.

Cause:
Short explanation of the root cause of the issue if applicable.

Solution:
Short explanation of the solution we are providing with this PR.

CHECKLIST

Jira

  • Is the Jira ticket created and referenced properly?
  • Does the Jira ticket have the proper statuses for documentation (Needs Doc) and QA (Needs QA)?
  • Does the Jira ticket link to the proper milestone (Fix Version field)?

Tests

  • Is an E2E test/test case added for the new feature/change?
  • Are unit tests added where appropriate?
  • Are OpenShift compare files changed for E2E tests (compare/*-oc.yml)?

Config/Logging/Testability

  • Are all needed new/changed options added to default YAML files?
  • Are all needed new/changed options added to the Helm Chart?
  • Did we add proper logging messages for operator actions?
  • Did we ensure compatibility with the previous version or cluster upgrade process?
  • Does the change support oldest and newest supported MongoDB version?
  • Does the change support oldest and newest supported Kubernetes version?

Signed-off-by: Mayank Shah <mayank.shah@percona.com>
Copilot AI review requested due to automatic review settings January 12, 2026 05:57
@pull-request-size pull-request-size bot added the size/L 100-499 lines label Jan 12, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request converts the replset-remapping end-to-end test from using a simple replica set architecture to a sharded cluster architecture. The test validates that backup and restore operations with replica set remapping work correctly in sharded environments.

Changes:

  • Migrated test script to use run_mongos and compare_mongos_cmd functions for sharded cluster operations
  • Updated source and target cluster configurations to include sharding components (config servers, mongos routers, and multiple replica sets)
  • Added replica set remapping for the second replica set (rs1 -> replset1) in restore configurations

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
e2e-tests/replset-remapping/run Updated test script to connect via mongos instead of directly to replica sets, modified function calls to use sharded cluster equivalents
e2e-tests/replset-remapping/conf/some-name-source.yml Added sharding configuration with config servers, mongos routers, and a second replica set (rs1)
e2e-tests/replset-remapping/conf/some-name-target.yml Added sharding configuration with config servers, mongos routers, and a second replica set (replset1)
e2e-tests/replset-remapping/conf/restore.yml Added mapping for the second replica set (rs1 -> replset1)
e2e-tests/replset-remapping/conf/restore-pitr.yml Added mapping for the second replica set (rs1 -> replset1) for PITR restore

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 31 to +34
log "writing some data"
run_mongo \
run_mongos \
'use myApp\n db.test.insert({ x: 100500 })' \
"databaseAdmin:databaseAdmin123456@${source_cluster}-rs0.${namespace}"
compare_mongo_cmd \
"databaseAdmin:databaseAdmin123456@${source_cluster}-mongos.${namespace}"
Copy link

Copilot AI Jan 12, 2026

Choose a reason for hiding this comment

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

Missing sharding setup operations. For a sharded cluster, you need to enable sharding on the database and shard the collection before inserting data. Between line 30 and 31, you should add:

  1. Enable sharding on the database with sh.enableSharding("myApp") using the clusterAdmin credentials
  2. Insert the test data
  3. Shard the collection with sh.shardCollection("myApp.test", { _id: 1 })

This is necessary to properly test replset remapping with a sharded cluster, as shown in the replset-remapping-sharded test.

Copilot uses AI. Check for mistakes.
Comment on lines 42 to 43
run_backup "minio" "backup-minio-physical" "physical"
wait_backup "backup-minio-physical"
Copy link

Copilot AI Jan 12, 2026

Choose a reason for hiding this comment

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

The backup order has been changed from logical-then-physical (in the original) to physical-then-logical. This could affect test reliability if there are timing dependencies. Consider keeping the original order (logical backup first at line 42-43, then physical backup at line 45-46) to maintain consistency with established test patterns and avoid potential timing-related issues.

Copilot uses AI. Check for mistakes.
@mayankshah1607 mayankshah1607 deleted the replset-remapping-sharded-test branch January 12, 2026 06:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/L 100-499 lines tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants