-
Notifications
You must be signed in to change notification settings - Fork 176
[WIP] Use sharded cluster for replset remapping test #2187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,5 +7,6 @@ spec: | |
| backupName: | ||
| replsetRemapping: | ||
| rs0: replset0 | ||
| rs1: replset1 | ||
| pitr: | ||
| type: latest | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,3 +7,4 @@ spec: | |
| backupName: | ||
| replsetRemapping: | ||
| rs0: replset0 | ||
| rs1: replset1 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,29 +29,26 @@ function setup_source_cluster() { | |
| wait_cluster_consistency "${source_cluster}" | ||
|
|
||
| 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}" | ||
| compare_mongos_cmd \ | ||
| "find" \ | ||
| "databaseAdmin:databaseAdmin123456@${source_cluster}-rs0.${namespace}" \ | ||
| "databaseAdmin:databaseAdmin123456@${source_cluster}-mongos.${namespace}" \ | ||
| "" \ | ||
| ".svc.cluster.local" \ | ||
| myApp \ | ||
| test \ | ||
| '' \ | ||
| false \ | ||
| rs0 | ||
| test | ||
| run_backup "minio" "backup-minio-physical" "physical" | ||
| wait_backup "backup-minio-physical" | ||
|
Comment on lines
42
to
43
|
||
|
|
||
| run_backup "minio" "backup-minio-logical" | ||
| wait_backup "backup-minio-logical" | ||
|
|
||
| log "writing more data for PiTR" | ||
| run_mongo \ | ||
| run_mongos \ | ||
| 'use myApp\n db.test.insert({ x: 100501 })' \ | ||
| "databaseAdmin:databaseAdmin123456@${source_cluster}-rs0.${namespace}" | ||
| "databaseAdmin:databaseAdmin123456@${source_cluster}-mongos.${namespace}" | ||
| sleep_with_log 70 "wait for oplog chunk upload" | ||
|
|
||
| log "deleting PSMDB cluster: ${source_cluster}" | ||
|
|
@@ -75,37 +72,30 @@ function test_restores() { | |
| run_restore backup-minio-physical | ||
| wait_restore backup-minio-physical ${target_cluster} | ||
| wait_cluster_consistency "${target_cluster}" | ||
| compare_mongo_cmd \ | ||
| compare_mongos_cmd \ | ||
| "find" \ | ||
| "databaseAdmin:databaseAdmin123456@${target_cluster}-replset0.${namespace}" \ | ||
| "databaseAdmin:databaseAdmin123456@${target_cluster}-mongos.${namespace}" \ | ||
| "" \ | ||
| ".svc.cluster.local" \ | ||
| myApp \ | ||
| test \ | ||
| '' \ | ||
| false \ | ||
| replset0 | ||
| test | ||
| desc "CASE 1: PASSED" | ||
|
|
||
| log "dropping test collection" | ||
| run_mongo 'use myApp\n db.test.drop()' \ | ||
| "databaseAdmin:databaseAdmin123456@${target_cluster}-replset0.${namespace}" \ | ||
| "mongodb" ".svc.cluster.local" "" "replset0" | ||
| run_mongos 'use myApp\n db.test.drop()' \ | ||
| "databaseAdmin:databaseAdmin123456@${target_cluster}-mongos.${namespace}" | ||
|
|
||
| desc "CASE 2: Logical restore with replset remapping" | ||
| run_restore backup-minio-logical ${test_dir}/conf/restore-pitr.yml | ||
| wait_restore backup-minio-logical ${target_cluster} | ||
| wait_cluster_consistency "${target_cluster}" | ||
| compare_mongo_cmd \ | ||
| compare_mongos_cmd \ | ||
| "find" \ | ||
| "databaseAdmin:databaseAdmin123456@${target_cluster}-replset0.${namespace}" \ | ||
| "databaseAdmin:databaseAdmin123456@${target_cluster}-mongos.${namespace}" \ | ||
| "-2nd" \ | ||
| ".svc.cluster.local" \ | ||
| myApp \ | ||
| test \ | ||
| '' \ | ||
| false \ | ||
| replset0 | ||
| test | ||
| desc "CASE 2: PASSED" | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
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:
This is necessary to properly test replset remapping with a sharded cluster, as shown in the replset-remapping-sharded test.