[WIP] Use sharded cluster for replset remapping test#2187
[WIP] Use sharded cluster for replset remapping test#2187mayankshah1607 wants to merge 2 commits intomainfrom
Conversation
Signed-off-by: Mayank Shah <mayank.shah@percona.com>
There was a problem hiding this comment.
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_mongosandcompare_mongos_cmdfunctions 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.
| 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}" |
There was a problem hiding this comment.
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:
- Enable sharding on the database with sh.enableSharding("myApp") using the clusterAdmin credentials
- Insert the test data
- 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.
| run_backup "minio" "backup-minio-physical" "physical" | ||
| wait_backup "backup-minio-physical" |
There was a problem hiding this comment.
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.
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
Needs Doc) and QA (Needs QA)?Tests
compare/*-oc.yml)?Config/Logging/Testability