Bug #105649 Dba.upgradeMetadata: invalid stoi argument (ArgumentError)
Submitted: 22 Nov 2021 0:32 Modified: 4 Mar 2022 16:03
Reporter: Yoseph Phillips Email Updates:
Status: Closed Impact on me:
None 
Category:Shell AdminAPI InnoDB Cluster / ReplicaSet Severity:S3 (Non-critical)
Version:8.0.27, 8.0.28 OS:Windows
Assigned to: CPU Architecture:x86
Tags: stoi, upgradeMetadata

[22 Nov 2021 0:32] Yoseph Phillips
Description:
Dba.upgradeMetadata: invalid stoi argument (ArgumentError)

Following an offline upgrade from 8.0.26 to 8.0.27, dba.upgradeMetadata now results in Dba.upgradeMetadata: invalid stoi argument (ArgumentError).

Note that the cluster status is 'Cluster is ONLINE and can tolerate up to ONE failure'

> dba.upgradeMetadata()
InnoDB Cluster Metadata Upgrade

The cluster you are connected to is using an outdated metadata schema version 2.0.0 and needs to be upgraded to 2.1.0.

Without doing this upgrade, no AdminAPI calls except read only operations will be allowed.

The grants for the MySQL Router accounts that were created automatically when bootstrapping need to be updated to match the new metadata version's requirements.
Updating Router accounts...
NOTE: 5 Router accounts have been updated.
WARNING: If MySQL Routers have been bootstrapped using custom accounts, their grants can not be updated during the metadata upgrade, they have to be updated using the setupRouterAccount function.
For additional information use: \? setupRouterAccount

Dba.upgradeMetadata: invalid stoi argument (ArgumentError)

How to repeat:
* Using 3 nodes using single primary mode, and 1 MySQL Router, 1 MySQL Shell.
Start with them on 8.0.26 with everything running normally.

* Close down all of the 3 MySQL instances, the MySQL Router, and the MySQL Shell. 

* Replace the 8.0.26 binaries with 8.0.27 ones

* Start the 3 MySQL instances 

* Start the MySQL Router 

* Run the Shell

* Use shell.connect(...) to connect to an instance

* Call dba.upgradeMetadata()
[24 Nov 2021 4:01] MySQL Verification Team
Hi,

Thanks for the report. I could not reproduce this on Linux setup but I'll see if our replication team can figure out what is going on. We will update the bug report if we have additional questions.

Thanks
[21 Dec 2021 14:11] MySQL Verification Team
Hi,

Dev team is asking if you bootstrap Router using the options "--conf-use-sockets" and/or "--conf-skip-tcp" ? 

Thanks
Bogdan
[22 Dec 2021 22:34] Yoseph Phillips
We don't use either of those options. 
Please note that we are seeing this issue on Windows, not on Linux.
[13 Feb 2022 22:24] Yoseph Phillips
Those replies in the previous comment are from a different customer.
We have upgraded everything to 8.0.28 and we still still see the exact same error message.
[14 Feb 2022 11:35] Pedro Pinheiro
Most probably there is something in the router metadata that MySQL Shell cannt interpret.

That is possible to check, by executing:
==
select attributes from mysql_innodb_cluster_metadata.routers\G
==
[15 Feb 2022 22:58] Yoseph Phillips
That returns: 
{"ROEndpoint": "6447", "RWEndpoint": "6446", "ROXEndpoint": "", "RWXEndpoint": "", "MetadataUser": "mysql_router1_84zap5l3izv4"}
[16 Feb 2022 14:18] Pedro Pinheiro
The issue is the empty X endpoints:
==
{"ROEndpoint": "6447", "RWEndpoint": "6446", "ROXEndpoint": "", "RWXEndpoint": "", "MetadataUser": "mysql_router1_84zap5l3izv4"}
==

This is a known issue, already being work on.

I would help if it's possible to describe what was the exact command that was used to bootstrap the router.
[17 Feb 2022 21:13] Yoseph Phillips
The following was done using MySQL 8.0.26 or earlier:

1) C:\Program Files\MySQL\MySQL Router 8.0\bin>mysqlrouter --bootstrap clusteradmin@xxx.xxx.xxx.xxx:3306 --directory "D:\MySQL\MySQL Router 8.0" --conf-bind-address yyy.yyy.yyy.yyy

2) Edit the D:\MySQL\MySQL Router 8.0\mysqlrouter.conf file to remove the last 2 X Protocol sections

There were no issues with this until MySQL 8.0.27 and later.
[4 Mar 2022 16:03] Margaret Fisher
Posted by developer:
 
Changelog entry added for MySQL Shell 8.0.29:

If MySQL Router was bootstrapped to use Unix sockets or to disable TCP ports, AdminAPI did not handle the resulting endpoint values correctly, resulting in errors during &adminapi; operations relating to MySQL Router management such as Cluster.listRouters(). The issue has now been fixed.