Ansible - check for migrations

@Albot wrote this some time ago community.general/plugins/modules/database/aerospike/aerospike_migrations.py at 771e9de010b2c4cb256f5fe2a9375d63e6eac511 · ansible-collections/community.general · GitHub

I am currently refactoring it to use the Python module “6 and up” for Python 3, for servers newer than v4.9

Albot’s script does a good deal of “extra” work regarding

  • Cluster stability
  • Checking individual namespaces for migrations
  • Is the cluster key consistent

There is _info_cmd_helper who’s job can now be done with info() or info_all()

My use case is quite simply “are all migrations finished, so that I can restart the next node”

I feel like I could just use info_all(“statistics”) , then just iterate over that and look for Metrics Reference | Aerospike Documentation and that’s it.

Am I off base here?

1 Like

A fair bit of paranoia went into this. There are potential edge cases that won’t be caught from simply checking if tx_remaining==0/&& rx_remaining==0. For example during split-brain scenarios or failure to actually cluster/reform a cluster, to name a couple, would result in migrate_remaining==0. I think the official answer from Aerospike has always been to use ‘cluster-stable’ info command but there are plenty of other checks you could add on top of this depending on your appetite for issues/issue avoidance (pre check for wiggle room in capacity, check for recent stability and changes, etc).

I don’t think you’re entirely off base, but that’s a judgement call you’ll have to make on your own on how many checks are sufficient. If you want to scrap the whole module and do a rewrite together, I’d be happy to add you as a contributor and work with you.

On the note of the migrate_partitions_remaining super metric, I don’t think that existed when I wrote this. It was only namespace-level migrate metrics.