MongoDB

Channel Revision Published Runs on
6/stable 199 04 Oct 2024
Ubuntu 22.04
6/candidate 199 04 Oct 2024
Ubuntu 22.04
6/beta 199 04 Oct 2024
Ubuntu 22.04
6/edge 202 16 Oct 2024
Ubuntu 22.04
5/stable 117 20 Apr 2023
Ubuntu 22.04
5/candidate 117 20 Apr 2023
Ubuntu 22.04
5/edge 139 21 Nov 2023
Ubuntu 22.04 Ubuntu 20.04
5/edge 109 06 Mar 2023
Ubuntu 22.04 Ubuntu 20.04
3.6/stable 100 28 Apr 2023
Ubuntu 20.04 Ubuntu 18.04
3.6/candidate 100 13 Apr 2023
Ubuntu 20.04 Ubuntu 18.04
3.6/edge 100 03 Feb 2023
Ubuntu 20.04 Ubuntu 18.04
juju deploy mongodb --channel 6/stable
Show information

Platform:

Ubuntu
22.04 20.04 18.04

charms.mongodb.v0.upgrade_helpers

Substrate agnostic manager for handling MongoDB in-place upgrades.


Index

def unit_number(unit_: Unit)

Description

Get unit number. None

class StatusException

Description

Exception with ops status. None

Methods

StatusException. __init__( self , status: StatusBase )

class PrecheckFailed

Description

App is not ready to upgrade. None

Methods

PrecheckFailed. __init__( self , message: str )

class FailedToElectNewPrimaryError

Description

Raised when a new primary isn't elected after stepping down. None

class ClusterNotHealthyError

Description

Raised when the cluster is not healthy. None

class BalancerStillRunningError

Description

Raised when the balancer is still running after stopping it. None

class PeerRelationNotReady

Description

Upgrade peer relation not available (to this unit). None

class UnitState

Description

Unit upgrade state. None

class AbstractUpgrade

In-place upgrades abstract class (typing).

Description

Based off specification: DA058 - In-Place Upgrades - Kubernetes v2 (https://docs.google.com/document/d/1tLjknwHudjcHs42nzPVBNkHs98XxAOT2BXGGpP7NyEU/)

Methods

AbstractUpgrade. __init__( self , charm_: CharmBase )

AbstractUpgrade. unit_state( self )

Description

Unit upgrade state. None

AbstractUpgrade. unit_state( self , value: UnitState )

AbstractUpgrade. is_compatible( self )

Description

Whether upgrade is supported from previous versions. None

AbstractUpgrade. in_progress( self )

Description

Whether upgrade is in progress. None

AbstractUpgrade. get_unit_juju_status( self )

Description

Unit upgrade status. None

AbstractUpgrade. app_status( self )

Description

App upgrade status. None

AbstractUpgrade. versions_set( self )

Whether versions have been saved in app databag.

Description

Should only be False during first charm install.

If a user upgrades from a charm that does not set versions, this charm will get stuck.

AbstractUpgrade. set_versions_in_app_databag( self )

Save current versions in app databag.

Description

Used after next upgrade to check compatibility (i.e. whether that upgrade should be allowed).

AbstractUpgrade. upgrade_resumed( self )

Description

Whether user has resumed upgrade with Juju action. None

AbstractUpgrade. reconcile_partition( self )

Description

If ready, allow next unit to upgrade. None

AbstractUpgrade. pre_upgrade_check( self )

Check if this app is ready to upgrade.

Description

Runs before any units are upgraded

Does not run during rollback

On machines, this runs before any units are upgraded (after juju refresh) On machines & Kubernetes, this also runs during pre-upgrade-check action

Can run on leader or non-leader unit

class GenericMongoDBUpgrade

Description

Substrate agnostif, abstract handler for upgrade events. None

Methods

GenericMongoDBUpgrade. __init__( self , charm: CharmBase )

GenericMongoDBUpgrade. move_primary_to_last_upgrade_unit( self )

Moves the primary to last unit that gets upgraded (the unit with the lowest id).

Description

Raises FailedToMovePrimaryError

GenericMongoDBUpgrade. wait_for_cluster_healthy( self )

Waits until the cluster is healthy after upgrading.

Description

After a unit restarts it can take some time for the cluster to settle.

Raises: ClusterNotHealthyError.

GenericMongoDBUpgrade. is_cluster_healthy( self )

Description

Returns True if all nodes in the cluster/replcia set are healthy. None

GenericMongoDBUpgrade. are_nodes_healthy( self )

Description

Returns true if all nodes in the MongoDB deployment are healthy. None

GenericMongoDBUpgrade. are_replicas_in_sharded_cluster_healthy( self , mongos_config: MongoConfiguration )

Description

Returns True if all replicas in the sharded cluster are healthy. None

GenericMongoDBUpgrade. are_shards_healthy( self , mongos_config: MongoConfiguration )

Description

Returns True if all shards in the cluster are healthy. None

GenericMongoDBUpgrade. get_all_replica_set_configs_in_cluster( self )

Description

Returns a list of all the mongodb_configurations for each application in the cluster. None

GenericMongoDBUpgrade. are_replica_set_nodes_healthy( self , mongodb_config: MongoConfiguration )

Description

Returns true if all nodes in the MongoDB replica set are healthy. None

GenericMongoDBUpgrade. is_cluster_able_to_read_write( self )

Description

Returns True if read and write is feasible for cluster. None

GenericMongoDBUpgrade. is_sharded_cluster_able_to_read_write( self )

Description

Returns True if possible to write all cluster shards and read from all replicas. None

GenericMongoDBUpgrade. get_mongodb_config_from_shard_entry( self , shard_entry: dict )

Description

Returns a replica set MongoConfiguration based on a shard entry from ListShards. None

GenericMongoDBUpgrade. get_cluster_mongos( self )

Description

Return a mongos configuration for the sharded cluster. None

GenericMongoDBUpgrade. is_replica_set_able_read_write( self )

Description

Returns True if is possible to write to primary and read from replicas. None

GenericMongoDBUpgrade. clear_db_collection( self , mongos_config: MongoConfiguration , db_name: str )

Description

Clears the temporary collection. None

GenericMongoDBUpgrade. clear_tmp_collection( self , mongodb_config: MongoConfiguration , collection_name: str )

Description

Clears the temporary collection. None

GenericMongoDBUpgrade. confirm_excepted_write_on_replica( self , host: str , db_name: str , collection: str , expected_write_value: str , secondary_config: MongoConfiguration )

Description

Returns True if the replica contains the expected write in the provided collection. None

GenericMongoDBUpgrade. get_random_write_and_collection( self )

Description

Returns a tuple for a random collection name and a unique write to add to it. None

GenericMongoDBUpgrade. add_write_to_sharded_cluster( self , mongos_config: MongoConfiguration , db_name , collection_name , write_value )

Description

Adds a the provided write to the provided database with the provided collection. None

GenericMongoDBUpgrade. add_write_to_replica_set( self , mongodb_config: MongoConfiguration , collection_name , write_value )

Description

Adds a the provided write to the admin database with the provided collection. None

GenericMongoDBUpgrade. is_write_on_secondaries( self , mongodb_config: MongoConfiguration , collection_name , expected_write_value , db_name: str )

Description

Returns true if the expected write. None

GenericMongoDBUpgrade. step_down_primary_and_wait_reelection( self )

Description

Steps down the current primary and waits for a new one to be elected. None

GenericMongoDBUpgrade. are_pre_upgrade_operations_config_server_successful( self )

Description

Runs pre-upgrade operations for config-server and returns True if successful. None

GenericMongoDBUpgrade. is_feature_compatibility_version( self , expected_feature_version )

Returns True if all nodes in the sharded cluster have the expected_feature_version.

Description

Note it is NOT sufficient to check only mongos or the individual shards. It is necessary to check each node according to MongoDB upgrade docs.

GenericMongoDBUpgrade. set_mongos_feature_compatibilty_version( self , feature_version )

Description

Sets the mongos feature compatibility version. None

GenericMongoDBUpgrade. turn_off_and_wait_for_balancer( self )

Description

Sends the stop command to the balancer and wait for it to stop running. None