I was able to easily reproduce this by running "watch juju status" during an upgrade to 1.26.
The problem stems from users accessing the API during the upgrade. Running status during the upgrade results in the login time being recorded for the user before the MigrateLastLoginAndLastConnection step runs. That step will then fail because it tries to insert a doc for that user's last login time, but the doc already exists.
We could fix this by inserting the lastlogin docs individually and ignoring duplicate key errors. We shouldn't use Upsert in this case, as what's written to the new lastLoginDoc will be more up to date than what's read in through the usersC collection.
I was able to easily reproduce this by running "watch juju status" during an upgrade to 1.26.
The problem stems from users accessing the API during the upgrade. Running status during the upgrade results in the login time being recorded for the user before the MigrateLastLogi nAndLastConnect ion step runs. That step will then fail because it tries to insert a doc for that user's last login time, but the doc already exists.
We could fix this by inserting the lastlogin docs individually and ignoring duplicate key errors. We shouldn't use Upsert in this case, as what's written to the new lastLoginDoc will be more up to date than what's read in through the usersC collection.