[Kea-users] Kea-admin lease-upgrade was errored

Shane Kerr shane at time-travellers.org
Tue Jan 5 20:11:21 UTC 2016


Quang Trieu,

At 2016-01-05 22:28:02 +0700
"Quang. Trieu Minh" <quangtm at vng.com.vn> wrote:

> After I upgraded kea 0.9.0 to kea 1.0.0. I updated lease version and saw
> errors as bellows :
> 
> root at VNGHCMAPP01:/opt/kea/sbin# ./kea-admin lease-upgrade mysql -u sqluser
> -p *********** -n dhcp_management
> Lease DB version reported before upgrade: 3.0
> 
> Processing /opt/kea/share/kea/scripts/mysql/upgrade_1.0_to_2.0.sh file...
> This script upgrades 1.0 to 2.0. Reported version is 3.0. Skipping upgrade.
> Processing /opt/kea/share/kea/scripts/mysql/upgrade_2.0_to_3.0.sh file...
> This script upgrades 2.0 to 3.0. Reported version is 3.0. Skipping upgrade.
> Processing /opt/kea/share/kea/scripts/mysql/upgrade_3.0_to_4.0.sh file...
> ERROR 1060 (42S21) at line 2: Duplicate column name 'state'
> Processing /opt/kea/share/kea/scripts/mysql/upgrade_4.0_to_4.1.sh file...
> This script upgrades 4.0 to 4.1. Reported version is 3.0. Skipping upgrade.
> Lease DB version reported after upgrade: 3.0

It looks like the script is complaining about this command:

# Add state column to the lease4 table.
ALTER TABLE lease4
    ADD COLUMN state INT UNSIGNED DEFAULT 0;

The error indicates that for some reason the lease4 table already has a
column named 'state'.

I'm not sure how this could happen.

Was there an earlier attempt to upgrade the schema that failed?

You can see the current schema of your database by using the MySQL
command line:

mysql> show tables

That will list all the tables, then you can go through each and check
the structure: 

mysql> show columns from lease4;
mysql> show columns from lease6;
mysql> show columns from lease6_type;
mysql> show columns from lease_hwaddr_source;
mysql> show columns from hosts;
mysql> show columns from ipv6_reservations;
mysql> show columns from dhcpv4_options;
mysql> show columns from dhcpv6_options;
mysql> show columns from lease_state;

I don't know of any other way to see where things are broken.

Cheers,

--
Shane



More information about the Kea-users mailing list