-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…removal of Primary shards (#267) ## Issue Primary shards are not identified, this can pose problems if removing a primary shard ## Solution Identify primary shards and prevent their removal ## Follow up PR move databases that use a primary shard to a different shard if removing primary (I don't want to add this to this PR as to reduce the complexity in the review) ## Testing As this is a POC there are no integration tests added, instead tests were performed by hand ``` # deploy shards + config server juju deploy ./*charm --config role="config-server" config-server-one juju deploy ./*charm --config role="shard" shard-one juju deploy ./*charm --config role="shard" shard-two # relate shards juju integrate config-server-one:config-server shard-one:sharding juju integrate config-server-one:config-server shard-two:sharding # write data to shard-one juju ssh config-server-one/0 charmed-mongodb.mongosh <URI> use test_db db.createCollection("cool_animals") db.cool_animals.insertOne({"horses":"unicorn"}) sh.enableSharding("test_db") # write data to shard-two use test_db_2 db.createCollection("cool_animals") db.cool_animals.insertOne({"horses":"unicorn"}) sh.enableSharding("test_db") db.adminCommand( { movePrimary : "test_db_2", to : "shard-one" } ) # show both shards use config show collections db.databases.find() # exit exit exit # remove shard and verify error in config server and forever wait in shard juju remove-relation config-server-one:config-server shard-two:sharding juju status --watch 1s ```
- Loading branch information
1 parent
439c915
commit cef5746
Showing
2 changed files
with
57 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters