TITLE:
Plesk Repair DB makes invalid attempt to repair
PRODUCT, VERSION, OPERATING SYSTEM, ARCHITECTURE:Plesk Onyx, latest version. Debian 8 or 9 (probably doesn't matter). MySQL is MariaDB
PROBLEM DESCRIPTION:If "plesk repair db" finds clients with a Pool ID 0 it returns a message that there is no IP Pool with ID 0. It asks the admin if it should create that IP Pool with ID 0.
STEPS TO REPRODUCE:Run "plesk repair db", and have atleast 1 client in the 'clients' table with a pool_id value of 0.
ACTUAL RESULT:New IP pool with an invalid value is created.
The 'ip_pool' table has the following layout:
A column with an auto_increment value CAN NOT have a value of 0, unless MySQL is explicitly configured to allow the value zero in an auto_increment column. Plesk doensn't set this parameter in MySQL.
Thus, as a result a new row with a new ID is created:
As one can see, MySQL sees the value '0' as NULL, which means instead of saving the value 0 it just uses the next auto increment counter as value.
EXPECTED RESULT:The 'ip_pool' table has the following layout:
Code:
MariaDB [psa]> describe ip_pool;
+---------------+----------------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------------+----------------------------+------+-----+---------+----------------+
| id | int(10) unsigned | NO | PRI | NULL | auto_increment |
| ip_address_id | int(10) unsigned | NO | PRI | NULL | |
| type | enum('shared','exclusive') | NO | | shared | |
+---------------+----------------------------+------+-----+---------+----------------+
3 rows in set (0.00 sec)
A column with an auto_increment value CAN NOT have a value of 0, unless MySQL is explicitly configured to allow the value zero in an auto_increment column. Plesk doensn't set this parameter in MySQL.
Thus, as a result a new row with a new ID is created:
Code:
MariaDB [psa]> insert into ip_pool values(0, 1, 'shared');
Query OK, 1 row affected (0.00 sec)
MariaDB [psa]> delete from ip_pool where id = 0;
Query OK, 0 rows affected (0.00 sec)
MariaDB [psa]> insert into ip_pool values(0, 999, 'exclusive');
Query OK, 1 row affected (0.00 sec)
MariaDB [psa]> select * from ip_pool where ip_address_id = 999;
+------+---------------+-----------+
| id | ip_address_id | type |
+------+---------------+-----------+
| 1046 | 999 | exclusive |
+------+---------------+-----------+
1 row in set (0.00 sec)
As one can see, MySQL sees the value '0' as NULL, which means instead of saving the value 0 it just uses the next auto increment counter as value.
plesk repair db should change the pool_id in the clients table, not create the pool as ID value of zero is invalid
ANY ADDITIONAL INFORMATION:
YOUR EXPECTATIONS FROM PLESK SERVICE TEAM:Confirm bug